Re-add explicit instantiation of FlexibleSolver to reduce compile time.

This commit is contained in:
Atgeirr Flø Rasmussen 2022-05-19 11:35:11 +02:00
parent 6c5988f011
commit a0f16089f7
3 changed files with 39 additions and 28 deletions

View File

@ -42,12 +42,12 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.cpp
opm/simulators/flow/ValidationFunctions.cpp
opm/simulators/linalg/ExtractParallelGridInformationToISTL.cpp
# opm/simulators/linalg/FlexibleSolver1.cpp
# opm/simulators/linalg/FlexibleSolver2.cpp
# opm/simulators/linalg/FlexibleSolver3.cpp
# opm/simulators/linalg/FlexibleSolver4.cpp
# opm/simulators/linalg/FlexibleSolver5.cpp
# opm/simulators/linalg/FlexibleSolver6.cpp
opm/simulators/linalg/FlexibleSolver1.cpp
opm/simulators/linalg/FlexibleSolver2.cpp
opm/simulators/linalg/FlexibleSolver3.cpp
opm/simulators/linalg/FlexibleSolver4.cpp
opm/simulators/linalg/FlexibleSolver5.cpp
opm/simulators/linalg/FlexibleSolver6.cpp
opm/simulators/linalg/PropertyTree.cpp
opm/simulators/linalg/setupPropertyTree.cpp
opm/simulators/utils/PartiallySupportedFlowKeywords.cpp

View File

@ -101,7 +101,7 @@ private:
} // namespace Dune
#include <opm/simulators/linalg/FlexibleSolver_impl.hpp>
//#include <opm/simulators/linalg/FlexibleSolver_impl.hpp>
#endif // OPM_FLEXIBLE_SOLVER_HEADER_INCLUDED

View File

@ -198,45 +198,56 @@ namespace Dune
// Macros to simplify explicit instantiation of FlexibleSolver for various block sizes.
/*
// Vectors and matrices.
template <int N>
using BV = Dune::BlockVector<Dune::FieldVector<double, N>>;
template <int N>
using BM = Dune::BCRSMatrix<Dune::FieldMatrix<double, N, N>>;
template <int N>
using OBM = Dune::BCRSMatrix<Opm::MatrixBlock<double, N, N>>;
// Sequential operators.
template <int N>
using SeqOpM = Dune::MatrixAdapter<OBM<N>, BV<N>, BV<N>>;
template <int N>
using SeqOpW = Opm::WellModelMatrixAdapter<OBM<N>, BV<N>, BV<N>, false>;
#if HAVE_MPI
// Parallel communicator and operators.
using Comm = Dune::OwnerOverlapCopyCommunication<int, int>;
template <int N>
using ParOpM = Dune::OverlappingSchwarzOperator<OBM<N>, BV<N>, BV<N>, Comm>;
template <int N>
using ParOpW = Opm::WellModelGhostLastMatrixAdapter<OBM<N>, BV<N>, BV<N>, true>;
// Note: we must instantiate the constructor that is a template.
// This is only needed in the parallel case, since otherwise the Comm type is
// not a template argument but always SequentialInformation.
#define INSTANTIATE_FLEXIBLESOLVER(N) \
template class Dune::FlexibleSolver<BM<N>, BV<N>>; \
template class Dune::FlexibleSolver<OBM<N>, BV<N>>; \
template Dune::FlexibleSolver<BM<N>, BV<N>>::FlexibleSolver(AbstractOperatorType& op, \
const Comm& comm, \
const Opm::PropertyTree& prm, \
const std::function<BV<N>()>& weightsCalculator, \
std::size_t); \
template Dune::FlexibleSolver<OBM<N>, BV<N>>::FlexibleSolver(AbstractOperatorType& op, \
const Comm& comm, \
const Opm::PropertyTree& prm, \
const std::function<BV<N>()>& weightsCalculator, \
std::size_t);
#define INSTANTIATE_FLEXIBLESOLVER_OP(Operator) \
template class Dune::FlexibleSolver<Operator>; \
template Dune::FlexibleSolver<Operator>::FlexibleSolver(Operator& op, \
const Comm& comm, \
const Opm::PropertyTree& prm, \
const std::function<typename Operator::domain_type()>& weightsCalculator, \
std::size_t pressureIndex);
#define INSTANTIATE_FLEXIBLESOLVER(N) \
INSTANTIATE_FLEXIBLESOLVER_OP(SeqOpM<N>); \
INSTANTIATE_FLEXIBLESOLVER_OP(SeqOpW<N>); \
INSTANTIATE_FLEXIBLESOLVER_OP(ParOpM<N>); \
INSTANTIATE_FLEXIBLESOLVER_OP(ParOpW<N>);
#else // HAVE_MPI
#define INSTANTIATE_FLEXIBLESOLVER(N) \
template class Dune::FlexibleSolver<BM<N>, BV<N>>; \
template class Dune::FlexibleSolver<OBM<N>, BV<N>>;
#define INSTANTIATE_FLEXIBLESOLVER_OP(Operator) \
template class Dune::FlexibleSolver<Operator>;
#define INSTANTIATE_FLEXIBLESOLVER(N) \
INSTANTIATE_FLEXIBLESOLVER_OP(SeqOpM<N>); \
INSTANTIATE_FLEXIBLESOLVER_OP(SeqOpW<N>);
#endif // HAVE_MPI
*/
#define INSTANTIATE_FLEXIBLESOLVER(N) do(){}
#endif // OPM_FLEXIBLE_SOLVER_IMPL_HEADER_INCLUDED