diff --git a/dumux/multidomain/facet/box/couplingmanager.hh b/dumux/multidomain/facet/box/couplingmanager.hh index 9ef71a27f7cbb03ca977beec7910b16af0e700c5..fd2229e4b982ffb132ce71d8541c6c35a49623b6 100644 --- a/dumux/multidomain/facet/box/couplingmanager.hh +++ b/dumux/multidomain/facet/box/couplingmanager.hh @@ -204,7 +204,7 @@ public: // determine all bulk elements that couple to low dim elements const auto& bulkMap = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); - bulkElemIsCoupled_.resize(bulkProblem->fvGridGeometry().gridView().size(0), false); + bulkElemIsCoupled_.assign(bulkProblem->fvGridGeometry().gridView().size(0), false); std::for_each( bulkMap.begin(), bulkMap.end(), [&] (const auto& entry) { bulkElemIsCoupled_[entry.first] = true; }); diff --git a/dumux/multidomain/facet/cellcentered/mpfa/couplingmanager.hh b/dumux/multidomain/facet/cellcentered/mpfa/couplingmanager.hh index 03276ccc5dbcfb38d7af985e7fd40885d5f1ec71..8140c253e9e300a3019abf4a2054034ccf88888d 100644 --- a/dumux/multidomain/facet/cellcentered/mpfa/couplingmanager.hh +++ b/dumux/multidomain/facet/cellcentered/mpfa/couplingmanager.hh @@ -112,7 +112,7 @@ public: ParentType::init(bulkProblem, lowDimProblem, couplingMapper, curSol); // determine all bulk scvfs that coincide with low dim elements - bulkScvfIsOnFacetElement_.resize(bulkProblem->fvGridGeometry().numScvf(), false); + bulkScvfIsOnFacetElement_.assign(bulkProblem->fvGridGeometry().numScvf(), false); const auto& bulkMap = couplingMapper->couplingMap(bulkGridId, lowDimGridId); for (const auto& entry : bulkMap) for (const auto& couplingEntry : entry.second.elementToScvfMap) diff --git a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh index 96f508b2ea1a7d78889b66c0da976fc4f4a48d93..e6752cf99560c6640c9790ba0a2df342027c08e3 100644 --- a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh +++ b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh @@ -181,8 +181,8 @@ public: ParentType::updateSolution(curSol); // determine all bulk elements/scvfs that couple to low dim elements - bulkElemIsCoupled_.resize(bulkProblem->fvGridGeometry().gridView().size(0), false); - bulkScvfIsCoupled_.resize(bulkProblem->fvGridGeometry().numScvf(), false); + bulkElemIsCoupled_.assign(bulkProblem->fvGridGeometry().gridView().size(0), false); + bulkScvfIsCoupled_.assign(bulkProblem->fvGridGeometry().numScvf(), false); const auto& bulkMap = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); for (const auto& entry : bulkMap) diff --git a/dumux/multidomain/facet/couplingmapperbase.hh b/dumux/multidomain/facet/couplingmapperbase.hh index 93da620d23f0fcdf9c9e0a0760f9d9a58ce187d0..42aab8a65835ef867996400348e34dba62d41d79 100644 --- a/dumux/multidomain/facet/couplingmapperbase.hh +++ b/dumux/multidomain/facet/couplingmapperbase.hh @@ -197,7 +197,7 @@ protected: continue; // turn (insertion) indices into actual grid element indices ... - std::for_each(adjoinedEntities.begin(), adjoinedEntities.end(), [&] (auto& idx) { idx = bulkInsertionToElemIdxMap[idx]; }); + std::for_each(adjoinedEntities.begin(), adjoinedEntities.end(), [&] (auto& idx) { idx = bulkInsertionToElemIdxMap.at(idx); }); // ... and add them addCouplingEntryPolicy(std::move(adjoinedEntities), element, lowDimFvGridGeometry, bulkFvGridGeometry); @@ -233,14 +233,14 @@ private: //! Creates the map from element insertion index to grid element index template< class Embeddings, class FVGridGeometry> - std::vector< typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex > + std::unordered_map< typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex, typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex > makeInsertionToGridIndexMap_(std::shared_ptr<const Embeddings> embeddings, const FVGridGeometry& fvGridGeometry) const { using GridIndexType = typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex; - std::vector< GridIndexType > map(fvGridGeometry.gridView().size(0)); + std::unordered_map< GridIndexType, GridIndexType > map; for (const auto& e : elements(fvGridGeometry.gridView())) - map[ embeddings->template insertionIndex<bulkId>(e) ] = fvGridGeometry.elementMapper().index(e); + map.insert( std::make_pair( embeddings->template insertionIndex<bulkId>(e), fvGridGeometry.elementMapper().index(e) ) ); return map; } diff --git a/dumux/multidomain/facet/gridmanager.hh b/dumux/multidomain/facet/gridmanager.hh index 5366ed14d488e6d48dce9720d6140a6e65fc8f3f..4382b5f529040df4a24b423b23ebbefa10f9fd79 100644 --- a/dumux/multidomain/facet/gridmanager.hh +++ b/dumux/multidomain/facet/gridmanager.hh @@ -215,14 +215,22 @@ public: else return typename std::unordered_map< GridIndexType, std::vector<GridIndexType> >::mapped_type(); } - //! Returns the maps of the embedded entities + //! Returns const reference to maps of the embedded entities const std::unordered_map< GridIndexType, std::vector<GridIndexType> >& embeddedEntityMap(std::size_t id) const { assert(id < numGrids); return embeddedEntityMaps_[id]; } - //! Returns the maps of the adjoined entities of dimension d+1 + //! Returns non-const reference to maps of the embedded entities + std::unordered_map< GridIndexType, std::vector<GridIndexType> >& embeddedEntityMap(std::size_t id) + { assert(id < numGrids); return embeddedEntityMaps_[id]; } + + //! Returns const reference to the maps of the adjoined entities of dimension d+1 const std::unordered_map< GridIndexType, std::vector<GridIndexType> >& adjoinedEntityMap(std::size_t id) const { assert(id < numGrids); return adjoinedEntityMaps_[id]; } + //! Returns non-const reference to the maps of the adjoined entities of dimension d+1 + std::unordered_map< GridIndexType, std::vector<GridIndexType> >& adjoinedEntityMap(std::size_t id) + { assert(id < numGrids); return adjoinedEntityMaps_[id]; } + //! Returns the hierachy's insertion indices that make up the grid for the given id const std::vector<GridIndexType>& lowDimVertexIndices(std::size_t id) const { assert(id > 0 && id < numGrids); return lowDimGridVertexIndices_[id-1]; } @@ -363,6 +371,16 @@ public: }); } +protected: + //! return non-const reference to i-th grid + template<std::size_t id> + Grid<id>& grid_() + { return *std::get<id>(gridPtrTuple_); } + + //! return non-const pointer to the object containing embeddings + std::shared_ptr<Embeddings> getEmbeddings_() + { return embeddingsPtr_; } + private: //! Returns the filename extension of a given filename static std::string getFileExtension(const std::string& fileName)