move ebos/eclgenericcpgridvanguard.[hh|cc] to opm/simulators/flow

This commit is contained in:
Arne Morten Kvarving 2024-02-02 10:46:44 +01:00
parent 04ed17ebd0
commit 9fe969378d
4 changed files with 44 additions and 43 deletions

View File

@ -23,7 +23,6 @@
# originally generated with the command: # originally generated with the command:
# find opm -name '*.c*' -printf '\t%p\n' | sort # find opm -name '*.c*' -printf '\t%p\n' | sort
list (APPEND MAIN_SOURCE_FILES list (APPEND MAIN_SOURCE_FILES
ebos/eclgenericcpgridvanguard.cc
ebos/eclgenericproblem.cc ebos/eclgenericproblem.cc
ebos/eclgenericvanguard.cc ebos/eclgenericvanguard.cc
ebos/ecltransmissibility.cc ebos/ecltransmissibility.cc
@ -38,6 +37,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/EclGenericWriter.cpp opm/simulators/flow/EclGenericWriter.cpp
opm/simulators/flow/ExtraConvergenceOutputThread.cpp opm/simulators/flow/ExtraConvergenceOutputThread.cpp
opm/simulators/flow/FlowUtils.cpp opm/simulators/flow/FlowUtils.cpp
opm/simulators/flow/GenericCpGridVanguard.cpp
opm/simulators/flow/GenericOutputBlackoilModule.cpp opm/simulators/flow/GenericOutputBlackoilModule.cpp
opm/simulators/flow/GenericThresholdPressure.cpp opm/simulators/flow/GenericThresholdPressure.cpp
opm/simulators/flow/GenericTracerModel.cpp opm/simulators/flow/GenericTracerModel.cpp
@ -411,7 +411,6 @@ list (APPEND TEST_DATA_FILES
list (APPEND PUBLIC_HEADER_FILES list (APPEND PUBLIC_HEADER_FILES
ebos/ebos.hh ebos/ebos.hh
ebos/eclbasevanguard.hh ebos/eclbasevanguard.hh
ebos/eclgenericcpgridvanguard.hh
ebos/eclgenericproblem.hh ebos/eclgenericproblem.hh
ebos/eclgenericproblem_impl.hh ebos/eclgenericproblem_impl.hh
ebos/eclgenericvanguard.hh ebos/eclgenericvanguard.hh
@ -445,6 +444,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/FlowUtils.hpp opm/simulators/flow/FlowUtils.hpp
opm/simulators/flow/FlowsData.hpp opm/simulators/flow/FlowsData.hpp
opm/simulators/flow/FlowThresholdPressure.hpp opm/simulators/flow/FlowThresholdPressure.hpp
opm/simulators/flow/GenericCpGridVanguard.hpp
opm/simulators/flow/GenericOutputBlackoilModule.hpp opm/simulators/flow/GenericOutputBlackoilModule.hpp
opm/simulators/flow/GenericThresholdPressure.hpp opm/simulators/flow/GenericThresholdPressure.hpp
opm/simulators/flow/GenericThresholdPressure_impl.hpp opm/simulators/flow/GenericThresholdPressure_impl.hpp

View File

@ -28,7 +28,6 @@
#define OPM_CPGRID_VANGUARD_HPP #define OPM_CPGRID_VANGUARD_HPP
#include <ebos/eclbasevanguard.hh> #include <ebos/eclbasevanguard.hh>
#include <ebos/eclgenericcpgridvanguard.hh>
#include <ebos/ecltransmissibility.hh> #include <ebos/ecltransmissibility.hh>
#include <opm/common/TimingMacros.hpp> #include <opm/common/TimingMacros.hpp>
@ -37,6 +36,7 @@
#include <opm/models/blackoil/blackoilproperties.hh> #include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/simulators/flow/FemCpGridCompat.hpp> #include <opm/simulators/flow/FemCpGridCompat.hpp>
#include <opm/simulators/flow/GenericCpGridVanguard.hpp>
#include <array> #include <array>
#include <functional> #include <functional>
@ -85,9 +85,9 @@ namespace Opm {
*/ */
template <class TypeTag> template <class TypeTag>
class CpGridVanguard : public EclBaseVanguard<TypeTag> class CpGridVanguard : public EclBaseVanguard<TypeTag>
, public EclGenericCpGridVanguard<GetPropType<TypeTag, Properties::ElementMapper>, , public GenericCpGridVanguard<GetPropType<TypeTag, Properties::ElementMapper>,
GetPropType<TypeTag, Properties::GridView>, GetPropType<TypeTag, Properties::GridView>,
GetPropType<TypeTag, Properties::Scalar>> GetPropType<TypeTag, Properties::Scalar>>
{ {
friend class EclBaseVanguard<TypeTag>; friend class EclBaseVanguard<TypeTag>;
using ParentType = EclBaseVanguard<TypeTag>; using ParentType = EclBaseVanguard<TypeTag>;

View File

@ -22,29 +22,28 @@
*/ */
#include <config.h> #include <config.h>
#include <opm/simulators/flow/GenericCpGridVanguard.hpp>
#include <ebos/eclgenericcpgridvanguard.hh> #include <dune/grid/common/mcmgmapper.hh>
#include <dune/grid/common/partitionset.hh>
#include <dune/common/version.hh>
#if HAVE_MPI #include <opm/common/TimingMacros.hpp>
#include <opm/simulators/utils/MPISerializer.hpp> #include <opm/common/utility/ActiveGridCells.hpp>
#endif
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>
#include <opm/simulators/utils/PropsDataHandle.hpp>
#include <opm/simulators/utils/SetupZoltanParams.hpp>
#include <opm/grid/cpgrid/GridHelpers.hpp> #include <opm/grid/cpgrid/GridHelpers.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp> #include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Schedule/Well/Well.hpp> #include <opm/input/eclipse/Schedule/Well/Well.hpp>
#include <opm/common/TimingMacros.hpp> #include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/common/utility/ActiveGridCells.hpp> #include <opm/simulators/utils/ParallelSerialization.hpp>
#include <opm/simulators/utils/PropsDataHandle.hpp>
#include <opm/simulators/utils/SetupZoltanParams.hpp>
#include <dune/grid/common/mcmgmapper.hh> #if HAVE_MPI
#include <dune/grid/common/partitionset.hh> #include <opm/simulators/utils/MPISerializer.hpp>
#include <dune/common/version.hh> #endif
#if HAVE_DUNE_FEM #if HAVE_DUNE_FEM
#include <dune/fem/gridpart/adaptiveleafgridpart.hh> #include <dune/fem/gridpart/adaptiveleafgridpart.hh>
@ -123,7 +122,7 @@ MPIPartitionFromFile::operator()(const Dune::CpGrid& grid) const
std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer; std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer;
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::EclGenericCpGridVanguard() GenericCpGridVanguard<ElementMapper,GridView,Scalar>::GenericCpGridVanguard()
{ {
this->mpiRank = 0; this->mpiRank = 0;
@ -133,7 +132,7 @@ EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::EclGenericCpGridVanguar
} }
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::releaseEquilGrid() void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::releaseEquilGrid()
{ {
this->equilGrid_.reset(); this->equilGrid_.reset();
this->equilCartesianIndexMapper_.reset(); this->equilCartesianIndexMapper_.reset();
@ -141,7 +140,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::releaseEquilGrid()
#if HAVE_MPI #if HAVE_MPI
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
void EclGenericCpGridVanguard<ElementMapper, GridView, Scalar>:: void GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod, doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst, const bool ownersFirst,
const bool serialPartitioning, const bool serialPartitioning,
@ -219,7 +218,8 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
} }
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::distributeFieldProps_(EclipseState& eclState1) void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::
distributeFieldProps_(EclipseState& eclState1)
{ {
OPM_TIMEBLOCK(distributeFProps); OPM_TIMEBLOCK(distributeFProps);
const auto mpiSize = this->grid_->comm().size(); const auto mpiSize = this->grid_->comm().size();
@ -250,7 +250,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::distributeFieldPro
template <class ElementMapper, class GridView, class Scalar> template <class ElementMapper, class GridView, class Scalar>
std::vector<double> std::vector<double>
EclGenericCpGridVanguard<ElementMapper, GridView, Scalar>:: GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
extractFaceTrans(const GridView& gridView) const extractFaceTrans(const GridView& gridView) const
{ {
auto faceTrans = std::vector<double>(this->grid_->numFaces(), 0.0); auto faceTrans = std::vector<double>(this->grid_->numFaces(), 0.0);
@ -275,7 +275,7 @@ extractFaceTrans(const GridView& gridView) const
template <class ElementMapper, class GridView, class Scalar> template <class ElementMapper, class GridView, class Scalar>
void void
EclGenericCpGridVanguard<ElementMapper, GridView, Scalar>:: GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod, distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst, const bool ownersFirst,
const bool serialPartitioning, const bool serialPartitioning,
@ -311,7 +311,7 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
template <class ElementMapper, class GridView, class Scalar> template <class ElementMapper, class GridView, class Scalar>
void void
EclGenericCpGridVanguard<ElementMapper, GridView, Scalar>:: GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod, distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst, const bool ownersFirst,
const bool serialPartitioning, const bool serialPartitioning,
@ -358,7 +358,7 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
#endif // HAVE_MPI #endif // HAVE_MPI
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(EclipseState& eclState) void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(EclipseState& eclState)
{ {
const EclipseGrid* input_grid = nullptr; const EclipseGrid* input_grid = nullptr;
std::vector<double> global_porv; std::vector<double> global_porv;
@ -462,7 +462,8 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
} }
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doFilterConnections_(Schedule& schedule) void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::
doFilterConnections_(Schedule& schedule)
{ {
// We only filter if we hold the global grid. Otherwise the filtering // We only filter if we hold the global grid. Otherwise the filtering
// is done after load balancing as in the future the other processes // is done after load balancing as in the future the other processes
@ -493,7 +494,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doFilterConnection
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
const Dune::CpGrid& const Dune::CpGrid&
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::equilGrid() const GenericCpGridVanguard<ElementMapper,GridView,Scalar>::equilGrid() const
{ {
assert(mpiRank == 0); assert(mpiRank == 0);
return *equilGrid_; return *equilGrid_;
@ -501,14 +502,14 @@ EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::equilGrid() const
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
const Dune::CartesianIndexMapper<Dune::CpGrid>& const Dune::CartesianIndexMapper<Dune::CpGrid>&
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::cartesianIndexMapper() const GenericCpGridVanguard<ElementMapper,GridView,Scalar>::cartesianIndexMapper() const
{ {
return *cartesianIndexMapper_; return *cartesianIndexMapper_;
} }
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
const Dune::CartesianIndexMapper<Dune::CpGrid>& const Dune::CartesianIndexMapper<Dune::CpGrid>&
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::equilCartesianIndexMapper() const GenericCpGridVanguard<ElementMapper,GridView,Scalar>::equilCartesianIndexMapper() const
{ {
assert(mpiRank == 0); assert(mpiRank == 0);
assert(equilCartesianIndexMapper_); assert(equilCartesianIndexMapper_);
@ -517,7 +518,7 @@ EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::equilCartesianIndexMapp
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
Scalar Scalar
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>:: GenericCpGridVanguard<ElementMapper,GridView,Scalar>::
computeCellThickness(const typename GridView::template Codim<0>::Entity& element) const computeCellThickness(const typename GridView::template Codim<0>::Entity& element) const
{ {
typedef typename Element::Geometry Geometry; typedef typename Element::Geometry Geometry;
@ -540,7 +541,7 @@ computeCellThickness(const typename GridView::template Codim<0>::Entity& element
zz2 /=4; zz2 /=4;
return zz2-zz1; return zz2-zz1;
} }
template class EclGenericCpGridVanguard< template class GenericCpGridVanguard<
Dune::MultipleCodimMultipleGeomTypeMapper< Dune::MultipleCodimMultipleGeomTypeMapper<
Dune::GridView< Dune::GridView<
Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>>, Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>>,
@ -549,7 +550,7 @@ template class EclGenericCpGridVanguard<
double>; double>;
#if HAVE_DUNE_FEM #if HAVE_DUNE_FEM
template class EclGenericCpGridVanguard< template class GenericCpGridVanguard<
Dune::MultipleCodimMultipleGeomTypeMapper< Dune::MultipleCodimMultipleGeomTypeMapper<
Dune::GridView< Dune::GridView<
Dune::Fem::GridPart2GridViewTraits< Dune::Fem::GridPart2GridViewTraits<
@ -565,7 +566,7 @@ template class EclGenericCpGridVanguard<
false>>>, false>>>,
double>; double>;
template class EclGenericCpGridVanguard< template class GenericCpGridVanguard<
Dune::MultipleCodimMultipleGeomTypeMapper< Dune::MultipleCodimMultipleGeomTypeMapper<
Dune::Fem::GridPart2GridViewImpl< Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart< Dune::Fem::AdaptiveLeafGridPart<

View File

@ -22,10 +22,10 @@
*/ */
/*! /*!
* \file * \file
* \copydoc Opm::EclCpGridVanguard * \copydoc Opm::CpGridVanguard
*/ */
#ifndef EWOMS_ECL_CP_GRID_GENERIC_VANGUARD_HH #ifndef OPM_GENERIC_CPGRID_VANGUARD_HPP
#define EWOMS_ECL_CP_GRID_GENERIC_VANGUARD_HH #define OPM_GENERIC_CPGRID_VANGUARD_HPP
#include <ebos/eclgenericvanguard.hh> #include <ebos/eclgenericvanguard.hh>
@ -74,15 +74,15 @@ private:
extern std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer; extern std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer;
template<class ElementMapper, class GridView, class Scalar> template<class ElementMapper, class GridView, class Scalar>
class EclGenericCpGridVanguard { class GenericCpGridVanguard {
protected: protected:
using CartesianIndexMapper = Dune::CartesianIndexMapper<Dune::CpGrid>; using CartesianIndexMapper = Dune::CartesianIndexMapper<Dune::CpGrid>;
using Element = typename GridView::template Codim<0>::Entity; using Element = typename GridView::template Codim<0>::Entity;
public: public:
EclGenericCpGridVanguard(); GenericCpGridVanguard();
virtual ~EclGenericCpGridVanguard() = default; virtual ~GenericCpGridVanguard() = default;
/*! /*!
* \brief Return a reference to the simulation grid. * \brief Return a reference to the simulation grid.
@ -213,4 +213,4 @@ protected:
} // namespace Opm } // namespace Opm
#endif #endif // OPM_GENERIC_CPGRID_VANGUARD_HPP