From b74b170d5b7f1d9685bf3ee72cf85de9a1f620ed Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 May 2024 10:58:08 +0200 Subject: [PATCH] fixed: build with dune-fem 2.9 --- opm/simulators/flow/CollectDataOnIORank.cpp | 12 ++++++++++++ opm/simulators/flow/EclGenericWriter.cpp | 14 ++++++++++++++ opm/simulators/flow/FemCpGridCompat.hpp | 2 ++ opm/simulators/flow/FlowGenericProblem.cpp | 11 +++++++++++ opm/simulators/flow/GenericCpGridVanguard.cpp | 11 +++++++++++ opm/simulators/flow/GenericThresholdPressure.cpp | 13 +++++++++++++ opm/simulators/flow/GenericTracerModel.cpp | 14 ++++++++++++++ opm/simulators/flow/Transmissibility.cpp | 14 ++++++++++++++ opm/simulators/flow/equil/InitStateEquil.cpp | 9 +++++++++ opm/simulators/utils/GridDataOutput.cpp | 10 ++++++++++ tests/test_RestartSerialization.cpp | 16 +++++++++++++++- 11 files changed, 125 insertions(+), 1 deletion(-) diff --git a/opm/simulators/flow/CollectDataOnIORank.cpp b/opm/simulators/flow/CollectDataOnIORank.cpp index 7ae952f45..e817f7a07 100644 --- a/opm/simulators/flow/CollectDataOnIORank.cpp +++ b/opm/simulators/flow/CollectDataOnIORank.cpp @@ -27,8 +27,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif // HAVE_DUNE_FEM @@ -39,6 +42,14 @@ template class CollectDataOnIORank>>; #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +template class CollectDataOnIORank; +#else template class CollectDataOnIORank>>>; @@ -49,6 +60,7 @@ template class CollectDataOnIORank > >; +#endif #endif // HAVE_DUNE_FEM } // end namespace Opm diff --git a/opm/simulators/flow/EclGenericWriter.cpp b/opm/simulators/flow/EclGenericWriter.cpp index fe4f34c53..bc5e6307e 100644 --- a/opm/simulators/flow/EclGenericWriter.cpp +++ b/opm/simulators/flow/EclGenericWriter.cpp @@ -30,8 +30,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif // HAVE_DUNE_FEM @@ -44,6 +47,16 @@ template class EclGenericWriter; #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +template class EclGenericWriter, + double>; +#else template class EclGenericWriter>>, Dune::MultipleCodimMultipleGeomTypeMapper>>>, @@ -62,6 +75,7 @@ template class EclGenericWriter>>, double>; +#endif #endif // HAVE_DUNE_FEM*/ } // namespace Opm diff --git a/opm/simulators/flow/FemCpGridCompat.hpp b/opm/simulators/flow/FemCpGridCompat.hpp index e41c87665..aee4f6b3e 100644 --- a/opm/simulators/flow/FemCpGridCompat.hpp +++ b/opm/simulators/flow/FemCpGridCompat.hpp @@ -34,7 +34,9 @@ #if HAVE_DUNE_FEM #include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include namespace Dune { diff --git a/opm/simulators/flow/FlowGenericProblem.cpp b/opm/simulators/flow/FlowGenericProblem.cpp index be82b452d..711679f30 100644 --- a/opm/simulators/flow/FlowGenericProblem.cpp +++ b/opm/simulators/flow/FlowGenericProblem.cpp @@ -33,8 +33,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif // HAVE_DUNE_FEM @@ -44,6 +47,13 @@ template class FlowGenericProblem>; #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +template class FlowGenericProblem>; +#else template class FlowGenericProblem>>, BlackOilFluidSystem>; template class FlowGenericProblem >, BlackOilFluidSystem>; +#endif #endif // HAVE_DUNE_FEM } // end namespace Opm diff --git a/opm/simulators/flow/GenericCpGridVanguard.cpp b/opm/simulators/flow/GenericCpGridVanguard.cpp index 44524e0a2..68ccd1b22 100644 --- a/opm/simulators/flow/GenericCpGridVanguard.cpp +++ b/opm/simulators/flow/GenericCpGridVanguard.cpp @@ -48,7 +48,9 @@ #if HAVE_DUNE_FEM #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif //HAVE_DUNE_FEM @@ -588,6 +590,14 @@ template class GenericCpGridVanguard< double>; #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +template class GenericCpGridVanguard, + GV, + double>; +#else template class GenericCpGridVanguard< Dune::MultipleCodimMultipleGeomTypeMapper< Dune::GridView< @@ -617,6 +627,7 @@ template class GenericCpGridVanguard< Dune::PartitionIteratorType(4), false> >, double>; +#endif #endif // HAVE_DUNE_FEM } // namespace Opm diff --git a/opm/simulators/flow/GenericThresholdPressure.cpp b/opm/simulators/flow/GenericThresholdPressure.cpp index 10e7547fd..6b701ff25 100644 --- a/opm/simulators/flow/GenericThresholdPressure.cpp +++ b/opm/simulators/flow/GenericThresholdPressure.cpp @@ -28,8 +28,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif // HAVE_DUNE_FEM @@ -41,6 +44,15 @@ template class GenericThresholdPressure; #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +template class GenericThresholdPressure, + double>; +#else template class GenericThresholdPressure>>, Dune::MultipleCodimMultipleGeomTypeMapper>>>, @@ -58,6 +70,7 @@ template class GenericThresholdPressure>>, double>; +#endif #endif // HAVE_DUNE_FEM } // namespace Opm diff --git a/opm/simulators/flow/GenericTracerModel.cpp b/opm/simulators/flow/GenericTracerModel.cpp index df8f3519e..007684792 100644 --- a/opm/simulators/flow/GenericTracerModel.cpp +++ b/opm/simulators/flow/GenericTracerModel.cpp @@ -25,8 +25,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif // HAVE_DUNE_FEM @@ -39,6 +42,16 @@ template class GenericTracerModel; #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +template class GenericTracerModel, + EcfvStencil, + double>; +#else template class GenericTracerModel>>, Dune::MultipleCodimMultipleGeomTypeMapper>>>, @@ -53,6 +66,7 @@ template class GenericTracerModel >, false, false>, double>; +#endif #endif // HAVE_DUNE_FEM } // namespace Opm diff --git a/opm/simulators/flow/Transmissibility.cpp b/opm/simulators/flow/Transmissibility.cpp index bd3ea0d50..f2fb4d77c 100644 --- a/opm/simulators/flow/Transmissibility.cpp +++ b/opm/simulators/flow/Transmissibility.cpp @@ -28,8 +28,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif @@ -42,6 +45,16 @@ template class Transmissibility; #ifdef HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +template class Transmissibility, + Dune::CartesianIndexMapper, + double>; +#else template class Transmissibility>>, Dune::MultipleCodimMultipleGeomTypeMapper>>>, @@ -61,6 +74,7 @@ template class Transmissibility > >, Dune::CartesianIndexMapper, double>; +#endif #endif // HAVE_DUNE_FEM } // namespace Opm diff --git a/opm/simulators/flow/equil/InitStateEquil.cpp b/opm/simulators/flow/equil/InitStateEquil.cpp index 18d532bb6..55539455e 100644 --- a/opm/simulators/flow/equil/InitStateEquil.cpp +++ b/opm/simulators/flow/equil/InitStateEquil.cpp @@ -27,8 +27,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif @@ -63,11 +66,17 @@ using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper; INSTANCE_COMP(GridView, Mapper) #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GridViewFem = Dune::Fem::AdaptiveLeafGridPart; +#else using GridViewFem = Dune::Fem::GridPart2GridViewImpl< Dune::Fem::AdaptiveLeafGridPart< Dune::CpGrid, Dune::PartitionIteratorType(4), false>>; +#endif using MapperFem = Dune::MultipleCodimMultipleGeomTypeMapper; INSTANCE_COMP(GridViewFem, MapperFem) #endif // HAVE_DUNE_FEM diff --git a/opm/simulators/utils/GridDataOutput.cpp b/opm/simulators/utils/GridDataOutput.cpp index 37192240b..25cf80ba0 100644 --- a/opm/simulators/utils/GridDataOutput.cpp +++ b/opm/simulators/utils/GridDataOutput.cpp @@ -24,8 +24,11 @@ #include #if HAVE_DUNE_FEM +#include #include +#if !DUNE_VERSION_GTE(DUNE_FEM, 2, 9) #include +#endif #include #endif // HAVE_DUNE_FEM @@ -47,8 +50,15 @@ template using DV = DamarisOutput::DamarisVar; INSTANCE(1, Dune::GridView>) #if HAVE_DUNE_FEM +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) +using GV = Dune::Fem::AdaptiveLeafGridPart; +INSTANCE(1, GV) +#else INSTANCE(1, Dune::Fem::GridPart2GridViewImpl >) INSTANCE(1, Dune::GridView>>) #endif +#endif } // namespace Opm::GridDataOutput diff --git a/tests/test_RestartSerialization.cpp b/tests/test_RestartSerialization.cpp index ed780f613..7645c45c8 100644 --- a/tests/test_RestartSerialization.cpp +++ b/tests/test_RestartSerialization.cpp @@ -256,10 +256,17 @@ BOOST_AUTO_TEST_CASE(FlowGenericProblemFem) Opm::EclipseState eclState; Opm::Schedule schedule; Dune::CpGrid grid; +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) using GridPart = Dune::Fem::AdaptiveLeafGridPart; - using GridView = Dune::GridView; + using GridView = GridPart::GridViewType; + auto gridPart = GridPart(grid); + auto gridView = gridPart.gridView(); +#else + using GridPart = Dune::Fem::AdaptiveLeafGridPart; + using GridView = Dune::GridView>; auto gridPart = GridPart(grid); auto gridView = GridView(static_cast(gridPart)); +#endif auto data_out = Opm::FlowGenericProblem>:: serializationTestObject(eclState, schedule, gridView); @@ -451,10 +458,17 @@ BOOST_AUTO_TEST_CASE(FlowGenericTracerModelFem) Opm::EclipseState eclState; Dune::CartesianIndexMapper mapper(grid); auto centroids = [](int) { return std::array{}; }; +#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9) + using GridPart = Dune::Fem::AdaptiveLeafGridPart; + using GridView = GridPart::GridViewType; + auto gridPart = GridPart(grid); + auto gridView = gridPart.gridView(); +#else using GridPart = Dune::Fem::AdaptiveLeafGridPart; using GridView = Dune::GridView>; auto gridPart = GridPart(grid); auto gridView = GridView(static_cast(gridPart)); +#endif Dune::MultipleCodimMultipleGeomTypeMapper dofMapper(gridView, Dune::mcmgElementLayout()); auto data_out = GenericTracerModelTest