diff --git a/dumux/multidomain/facet/box/couplingmanager.hh b/dumux/multidomain/facet/box/couplingmanager.hh index 04333c95dff337ed941118f870738ea132418930..9e8509c9c5529d0ae555e4423d837aaeaf0285fa 100644 --- a/dumux/multidomain/facet/box/couplingmanager.hh +++ b/dumux/multidomain/facet/box/couplingmanager.hh @@ -297,6 +297,34 @@ public: return bulkContext_.lowDimElemVolVars[idxInContext][lowDimElemIdx]; } + /*! + * \brief returns the lower-dimensional element coinciding with a bulk scvf. + */ + const Element<lowDimId> getLowDimElement(const Element<bulkId>& element, + const SubControlVolumeFace<bulkId>& scvf) const + { + const auto eIdx = problem<bulkId>().fvGridGeometry().elementMapper().index(element); + assert(bulkContext_.isSet); + assert(bulkElemIsCoupled_[eIdx]); + + const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); + const auto& couplingData = map.find(eIdx)->second; + + // search the low dim element idx this scvf is embedded in + auto it = std::find_if( couplingData.elementToScvfMap.begin(), + couplingData.elementToScvfMap.end(), + [&] (auto& dataPair) + { + const auto& scvfList = dataPair.second; + auto it = std::find(scvfList.begin(), scvfList.end(), scvf.index()); + return it != scvfList.end(); + } ); + + assert(it != couplingData.elementToScvfMap.end()); + const auto lowDimElemIdx = it->first; + return problem<lowDimId>().fvGridGeometry().element(lowDimElemIdx); + } + /*! * \brief Evaluates the coupling element residual of a bulk domain element with respect * to a dof in the lower-dimensional domain (dofIdxGlobalJ). This is essentially diff --git a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh index 3a8e5e380244e0f8af1a86bdfb180bd1811065f0..13c1bff57b5c988a15a6d95b940f020aab5384c6 100644 --- a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh +++ b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh @@ -272,6 +272,33 @@ public: return bulkContext_.lowDimVolVars[idxInContext]; } + /*! + * \brief returns the lower-dimensional element coinciding with a bulk scvf. + */ + const Element<lowDimId> getLowDimElement(const Element<bulkId>& element, + const SubControlVolumeFace<bulkId>& scvf) const + { + assert(bulkContext_.isSet); + assert(bulkScvfIsCoupled_[scvf.index()]); + assert(scvf.insideScvIdx() == problem<bulkId>().fvGridGeometry().elementMapper().index(element)); + + const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); + const auto& couplingData = map.find(scvf.insideScvIdx())->second; + + // search the low dim element idx this scvf is embedded in + auto it = std::find_if( couplingData.elementToScvfMap.begin(), + couplingData.elementToScvfMap.end(), + [&scvf] (auto& dataPair) + { + const auto& scvfs = dataPair.second; + return std::find(scvfs.begin(), scvfs.end(), scvf.index()) != scvfs.end(); + } ); + + assert(it != couplingData.elementToScvfMap.end()); + const auto lowDimElemIdx = it->first; + return problem<lowDimId>().fvGridGeometry().element(lowDimElemIdx); + } + /*! * \brief Evaluates the coupling element residual of a bulk domain element with respect * to a dof in the lower-dimensional domain (dofIdxGlobalJ). This is essentially diff --git a/dumux/multidomain/facet/gridmanager.hh b/dumux/multidomain/facet/gridmanager.hh index 8d5c39a8fc60bc58bd183f4d3ce75e30b1109f32..e0fa3aa993650e30b34fe84ca09944563863c446 100644 --- a/dumux/multidomain/facet/gridmanager.hh +++ b/dumux/multidomain/facet/gridmanager.hh @@ -108,6 +108,11 @@ public: std::get<id>(gridDataPtrTuple_) = std::make_shared<GridData<id>>( std::move(gridData) ); } + //! return the grid data for a specific grid + template<std::size_t id> + std::shared_ptr<const GridData<id>> getSubDomainGridData() const + { return std::get<id>(gridDataPtrTuple_); } + //! Returns domain marker of an element template<std::size_t id> int getElementDomainMarker(const typename Grid<id>::template Codim<0>::Entity& element) const