diff --git a/dumux/common/fvproblem.hh b/dumux/common/fvproblem.hh index c8b534f55feb6e5db75299f2ad3347d53a086aee..1dd4a57920faad72c2101f1e813e3e367213b408 100644 --- a/dumux/common/fvproblem.hh +++ b/dumux/common/fvproblem.hh @@ -25,6 +25,7 @@ #define DUMUX_FV_PROBLEM_HH #include <memory> +#include <map> #include <dune/common/version.hh> #include <dune/common/fvector.hh> @@ -75,6 +76,9 @@ class FVProblem static constexpr bool isBox = GET_PROP_VALUE(TypeTag, DiscretizationMethod) == DiscretizationMethods::Box; + using PointSourceMap = std::map<std::pair<std::size_t, std::size_t>, + std::vector<PointSource> >; + public: /*! * \brief Constructor @@ -431,7 +435,7 @@ public: * \brief Compute the point source map, i.e. which scvs have point source contributions * \note Call this on the problem before assembly if you want to enable point sources set * via the addPointSources member function. - */ + */ void computePointSourceMap() { // clear the given point source maps in case it's not empty @@ -451,10 +455,16 @@ public: } } + /*! + * \brief Get the point source map. It stores the point sources per scv + */ + const PointSourceMap& pointSourceMap() const + { return pointSourceMap_; } + /*! * \brief Applies the initial solution for all degrees of freedom of the grid. * \param sol the initial solution vector - */ + */ void applyInitialSolution(SolutionVector& sol) const { // set the initial values by forwarding to a specialized method @@ -569,8 +579,7 @@ private: std::string problemName_; //! A map from an scv to a vector of point sources - std::map<std::pair<unsigned int, unsigned int>, - std::vector<PointSource> > pointSourceMap_; + PointSourceMap pointSourceMap_; }; } // end namespace Dumux diff --git a/dumux/common/pointsource.hh b/dumux/common/pointsource.hh index c20c52bd692ef3010787130846a385c8613b066f..271228fe8e1c6a34e92ca007e659d641025e9216 100644 --- a/dumux/common/pointsource.hh +++ b/dumux/common/pointsource.hh @@ -290,9 +290,10 @@ class BoundingBoxTreePointSourceHelper public: //! calculate a DOF index to point source map from given vector of point sources + template<class PointSourceMap> static void computePointSourceMap(const FVGridGeometry& fvGridGeometry, std::vector<PointSource>& sources, - std::map<std::pair<unsigned int, unsigned int>, std::vector<PointSource> >& pointSourceMap) + PointSourceMap& pointSourceMap) { const auto& boundingBoxTree = fvGridGeometry.boundingBoxTree();