diff --git a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh index 96f508b2ea1a7d78889b66c0da976fc4f4a48d93..0b4f65ab61a3df1a3578dfdcc3fa75986feb8a0a 100644 --- a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh +++ b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh @@ -181,7 +181,9 @@ public: ParentType::updateSolution(curSol); // determine all bulk elements/scvfs that couple to low dim elements + bulkElemIsCoupled_.clear(); bulkElemIsCoupled_.resize(bulkProblem->fvGridGeometry().gridView().size(0), false); + bulkScvfIsCoupled_.clear(); bulkScvfIsCoupled_.resize(bulkProblem->fvGridGeometry().numScvf(), false); const auto& bulkMap = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); diff --git a/dumux/multidomain/facet/couplingmapperbase.hh b/dumux/multidomain/facet/couplingmapperbase.hh index 93da620d23f0fcdf9c9e0a0760f9d9a58ce187d0..c36de3299a59ba24d28ced266fbf8bb6831bb2cf 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::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::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..b09a7f04e2a89a1d18e337bca5542807e78d4013 100644 --- a/dumux/multidomain/facet/gridmanager.hh +++ b/dumux/multidomain/facet/gridmanager.hh @@ -251,7 +251,6 @@ public: if (id > bulkGridId) lowDimGridVertexIndices_[id-1] = std::move(lowDimGridVertexIndices); } -private: //! data on connectivity between the grids std::array<EmbedmentMap, numGrids> embeddedEntityMaps_; std::array<EmbedmentMap, numGrids> adjoinedEntityMaps_; @@ -259,6 +258,7 @@ private: //! Contains the hierarchy insertion indices that make up a lower-dimensional grid std::array<std::vector<GridIndexType>, numGrids-1> lowDimGridVertexIndices_; +private: //! tuple to store the grids using Indices = std::make_index_sequence<numGrids>; template<std::size_t id> using GridViewPtr = std::shared_ptr<GridView<id>>; @@ -310,6 +310,11 @@ public: const Grid<id>& grid() const { return *std::get<id>(gridPtrTuple_); } + //! returns the i-th grid + template<std::size_t id> + Grid<id>& grid() + { return *std::get<id>(gridPtrTuple_); } + //! return a pointer to the grid data object std::shared_ptr<const GridData> getGridData() const { @@ -436,12 +441,14 @@ private: //! tuple to store the grids using Indices = std::make_index_sequence<numGrids>; using GridPtrTuple = typename makeFromIndexedType<std::tuple, GridPtr, Indices>::type; + protected: GridPtrTuple gridPtrTuple_; - + private: //! grid data, i.e. parameters and markers bool enableEntityMarkers_; std::shared_ptr<GridData> gridDataPtr_; + protected: //! data on embeddings std::shared_ptr<Embeddings> embeddingsPtr_; };