From b412e93682254e64363f611b10cbb7b41dbf2996 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 19 Nov 2018 19:40:55 +0100 Subject: [PATCH 01/12] [cleanup] Remove obsolete aliases for IndexType --- dumux/flux/box/fickslaw.hh | 1 - dumux/flux/box/fourierslaw.hh | 1 - dumux/flux/cctpfa/fickslaw.hh | 1 - dumux/flux/cctpfa/fourierslaw.hh | 1 - dumux/multidomain/facet/cellcentered/tpfa/darcyslaw.hh | 2 -- dumux/porousmediumflow/2p1c/darcyslaw.hh | 3 +-- dumux/porousmediumflow/fluxvariables.hh | 1 - 7 files changed, 1 insertion(+), 9 deletions(-) diff --git a/dumux/flux/box/fickslaw.hh b/dumux/flux/box/fickslaw.hh index 46f65da48e..b4b85ee8f3 100644 --- a/dumux/flux/box/fickslaw.hh +++ b/dumux/flux/box/fickslaw.hh @@ -55,7 +55,6 @@ class FicksLawImplementation using BalanceEqOpts = GetPropType; using GridView = GetPropType; using Element = typename GridView::template Codim<0>::Entity; - using IndexType = typename GridView::IndexSet::IndexType; using ModelTraits = GetPropType; using Indices = typename ModelTraits::Indices; diff --git a/dumux/flux/box/fourierslaw.hh b/dumux/flux/box/fourierslaw.hh index 279adc65a9..8b38adc96f 100644 --- a/dumux/flux/box/fourierslaw.hh +++ b/dumux/flux/box/fourierslaw.hh @@ -49,7 +49,6 @@ class FouriersLawImplementation using ElementVolumeVariables = typename GetPropType::LocalView; using ElementFluxVariablesCache = typename GetPropType::LocalView; using GridView = GetPropType; - using Element = typename GridView::template Codim<0>::Entity; public: diff --git a/dumux/flux/cctpfa/fickslaw.hh b/dumux/flux/cctpfa/fickslaw.hh index 3c79c259f2..32c64328f0 100644 --- a/dumux/flux/cctpfa/fickslaw.hh +++ b/dumux/flux/cctpfa/fickslaw.hh @@ -50,7 +50,6 @@ class FicksLawImplementation using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = GetPropType; - using IndexType = typename GridView::IndexSet::IndexType; using VolumeVariables = GetPropType; using ElementVolumeVariables = typename GetPropType::LocalView; using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/flux/cctpfa/fourierslaw.hh b/dumux/flux/cctpfa/fourierslaw.hh index 3e7d9d708e..3ded09a9c8 100644 --- a/dumux/flux/cctpfa/fourierslaw.hh +++ b/dumux/flux/cctpfa/fourierslaw.hh @@ -50,7 +50,6 @@ class FouriersLawImplementation using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = GetPropType; - using IndexType = typename GridView::IndexSet::IndexType; using ElementVolumeVariables = typename GetPropType::LocalView; using Element = typename GridView::template Codim<0>::Entity; using ElementFluxVarsCache = typename GetPropType::LocalView; diff --git a/dumux/multidomain/facet/cellcentered/tpfa/darcyslaw.hh b/dumux/multidomain/facet/cellcentered/tpfa/darcyslaw.hh index 22caec258c..82403ba3e3 100644 --- a/dumux/multidomain/facet/cellcentered/tpfa/darcyslaw.hh +++ b/dumux/multidomain/facet/cellcentered/tpfa/darcyslaw.hh @@ -150,7 +150,6 @@ class CCTpfaFacetCouplingDarcysLawImpl::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; - using IndexType = typename GridView::IndexSet::IndexType; //! Compute the transmissibility associated with the facet element template @@ -429,7 +428,6 @@ class CCTpfaFacetCouplingDarcysLawImpl::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; - using IndexType = typename GridView::IndexSet::IndexType; public: //! state the scalar type of the law diff --git a/dumux/porousmediumflow/2p1c/darcyslaw.hh b/dumux/porousmediumflow/2p1c/darcyslaw.hh index 6e3ae6dfe4..ca947fdcf0 100644 --- a/dumux/porousmediumflow/2p1c/darcyslaw.hh +++ b/dumux/porousmediumflow/2p1c/darcyslaw.hh @@ -62,7 +62,6 @@ class TwoPOneCDarcysLaw : public DarcysLaw using FluidSystem = GetPropType; using Indices = typename GetPropType::Indices; using Element = typename GridView::template Codim<0>::Entity; - using IndexType = typename GridView::IndexSet::IndexType; using CoordScalar = typename GridView::ctype; enum { dim = GridView::dimension}; @@ -86,7 +85,7 @@ public: const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars, const SubControlVolumeFace& scvf, - const IndexType phaseIdx, + const int phaseIdx, const ElemFluxVarCache& elemFluxVarCache) { const Scalar flux = ParentType::flux(problem, element, fvGeometry, elemVolVars, scvf, phaseIdx, elemFluxVarCache); diff --git a/dumux/porousmediumflow/fluxvariables.hh b/dumux/porousmediumflow/fluxvariables.hh index 0c04ffade6..f84d64497f 100644 --- a/dumux/porousmediumflow/fluxvariables.hh +++ b/dumux/porousmediumflow/fluxvariables.hh @@ -55,7 +55,6 @@ class PorousMediumFluxVariables using FVElementGeometry = typename FVGridGeometry::LocalView; using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; - using IndexType = typename GridView::IndexSet::IndexType; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using VolumeVariables = GetPropType; -- GitLab From c558c756646d79418df8dcfb556fa1041149abb2 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 19 Nov 2018 19:48:56 +0100 Subject: [PATCH 02/12] [cleanup][facet] Use GridIndexType instead of IndexType --- .../multidomain/facet/box/couplingmanager.hh | 22 ++++++++-------- .../facet/box/fvelementgeometry.hh | 16 ++++++------ dumux/multidomain/facet/box/fvgridgeometry.hh | 10 +++---- .../cellcentered/tpfa/couplingmanager.hh | 18 ++++++------- dumux/multidomain/facet/couplingmapperbase.hh | 8 +++--- dumux/multidomain/facet/enrichmenthelper.hh | 10 +++---- dumux/multidomain/facet/gmshreader.hh | 18 ++++++------- dumux/multidomain/facet/gridmanager.hh | 26 +++++++++---------- dumux/multidomain/facet/vertexmapper.hh | 12 ++++----- 9 files changed, 70 insertions(+), 70 deletions(-) diff --git a/dumux/multidomain/facet/box/couplingmanager.hh b/dumux/multidomain/facet/box/couplingmanager.hh index 51849758ac..ba8fbb2859 100644 --- a/dumux/multidomain/facet/box/couplingmanager.hh +++ b/dumux/multidomain/facet/box/couplingmanager.hh @@ -74,7 +74,7 @@ class FacetCouplingManager using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; template using GridView = typename FVGridGeometry::GridView; template using Element = typename GridView::template Codim<0>::Entity; - template using IndexType = typename GridView::IndexSet::IndexType; + template using GridIndexType = typename GridView::IndexSet::IndexType; template using GridVariables = GetPropType, Properties::GridVariables>; template using GridVolumeVariables = typename GridVariables::GridVolumeVariables; @@ -98,7 +98,7 @@ class FacetCouplingManager elementIdx; + GridIndexType< bulkId > elementIdx; std::vector< FVElementGeometry > lowDimFvGeometries; std::vector< ElementVolumeVariables > lowDimElemVolVars; @@ -136,7 +136,7 @@ class FacetCouplingManager elementIdx; + GridIndexType< lowDimId > elementIdx; ContainerType< std::unique_ptr> > bulkFvGeometries; ContainerType< std::unique_ptr> > bulkElemVolVars; ContainerType< std::unique_ptr> > bulkElemFluxVarsCache; @@ -336,7 +336,7 @@ public: evalCouplingResidual(BulkIdType, const BulkLocalAssembler& bulkLocalAssembler, LowDimIdType, - IndexType dofIdxGlobalJ) + GridIndexType dofIdxGlobalJ) { const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); @@ -361,7 +361,7 @@ public: bulkLocalAssembler.elemBcTypes(), bulkLocalAssembler.elemFluxVarsCache(), bulkLocalAssembler.localResidual(), - std::array, 1>({scvfIdx}) ); + std::array, 1>({scvfIdx}) ); } return res; @@ -378,7 +378,7 @@ public: evalCouplingResidual(LowDimIdType, const LowDimLocalAssembler& lowDimLocalAssembler, BulkIdType, - IndexType dofIdxGlobalJ) + GridIndexType dofIdxGlobalJ) { // make sure this is called for the element for which the context was set assert(lowDimContext_.isSet); @@ -423,7 +423,7 @@ public: // if it uses box, it is the one scvf coinciding with the given scv static constexpr bool lowDimUsesBox = FVGridGeometry::discMethod == DiscretizationMethod::box; const auto& coincidingScvfs = bulkMap.find(embedment.first)->second.elementToScvfMap.at(lowDimContext_.elementIdx); - const auto& scvfList = lowDimUsesBox ? std::vector>{ coincidingScvfs[scv.localDofIndex()] } + const auto& scvfList = lowDimUsesBox ? std::vector>{ coincidingScvfs[scv.localDofIndex()] } : coincidingScvfs; sources += evalBulkFluxes_(this->problem(bulkId).fvGridGeometry().element(embedment.first), @@ -551,7 +551,7 @@ public: void updateCouplingContext(BulkIdType domainI, const BulkLocalAssembler& bulkLocalAssembler, LowDimIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -620,7 +620,7 @@ public: void updateCouplingContext(BulkIdType domainI, const BulkLocalAssembler& bulkLocalAssembler, BulkIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -637,7 +637,7 @@ public: void updateCouplingContext(LowDimIdType domainI, const LowDimLocalAssembler& lowDimLocalAssembler, BulkIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -696,7 +696,7 @@ public: void updateCouplingContext(LowDimIdType domainI, const LowDimLocalAssembler& lowDimLocalAssembler, LowDimIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { diff --git a/dumux/multidomain/facet/box/fvelementgeometry.hh b/dumux/multidomain/facet/box/fvelementgeometry.hh index 01b36c8b79..e1a92cef5e 100644 --- a/dumux/multidomain/facet/box/fvelementgeometry.hh +++ b/dumux/multidomain/facet/box/fvelementgeometry.hh @@ -52,7 +52,7 @@ class BoxFacetCouplingFVElementGeometry using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; @@ -72,11 +72,11 @@ public: : fvGridGeometryPtr_(&fvGridGeometry) {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(GridIndexType scvIdx) const { return fvGridGeometry().scvs(eIdx_)[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const { return fvGridGeometry().scvfs(eIdx_)[scvfIdx]; } //! iterator range for sub control volumes. Iterates over @@ -142,7 +142,7 @@ private: const Element* elementPtr_; const FVGridGeometry* fvGridGeometryPtr_; - IndexType eIdx_; + GridIndexType eIdx_; }; //! specialization in case the geometries are not stored grid-wide @@ -153,7 +153,7 @@ class BoxFacetCouplingFVElementGeometry static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; @@ -178,11 +178,11 @@ public: : fvGridGeometryPtr_(&fvGridGeometry) {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(GridIndexType scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const { return scvfs_[scvfIdx]; } //! iterator range for sub control volumes. Iterates over @@ -328,7 +328,7 @@ private: //! The bound element const Element* elementPtr_; - IndexType eIdx_; + GridIndexType eIdx_; //! The global geometry this is a restriction of const FVGridGeometry* fvGridGeometryPtr_; diff --git a/dumux/multidomain/facet/box/fvgridgeometry.hh b/dumux/multidomain/facet/box/fvgridgeometry.hh index 2356745288..4e8921b230 100644 --- a/dumux/multidomain/facet/box/fvgridgeometry.hh +++ b/dumux/multidomain/facet/box/fvgridgeometry.hh @@ -95,7 +95,7 @@ class BoxFacetCouplingFVGridGeometry { using ThisType = BoxFacetCouplingFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename GV::IndexSet::IndexType; using Element = typename GV::template Codim<0>::Entity; using CoordScalar = typename GV::ctype; @@ -290,11 +290,11 @@ public: { return feCache_; } //! Get the local scvs for an element - const std::vector& scvs(IndexType eIdx) const + const std::vector& scvs(GridIndexType eIdx) const { return scvs_[eIdx]; } //! Get the local scvfs for an element - const std::vector& scvfs(IndexType eIdx) const + const std::vector& scvfs(GridIndexType eIdx) const { return scvfs_[eIdx]; } //! If a d.o.f. is on the boundary @@ -346,7 +346,7 @@ class BoxFacetCouplingFVGridGeometry { using ThisType = BoxFacetCouplingFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename GV::IndexSet::IndexType; static const int dim = GV::dimension; static const int dimWorld = GV::dimensionworld; @@ -456,7 +456,7 @@ public: for (int i = 0; i < numFaceCorners; ++i) vIndicesLocal[i] = static_cast(referenceElement.subEntity(idxInInside, 1, i, dim)); - std::vector gridVertexIndices(numFaceCorners); + std::vector gridVertexIndices(numFaceCorners); for (int i = 0; i < numFaceCorners; ++i) gridVertexIndices[i] = this->vertexMapper().vertexIndex(element, vIndicesLocal[i], dim); diff --git a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh index 75bfe44a07..45aee970be 100644 --- a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh +++ b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh @@ -73,7 +73,7 @@ class FacetCouplingManager using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; template using GridView = typename FVGridGeometry::GridView; template using Element = typename GridView::template Codim<0>::Entity; - template using IndexType = typename GridView::IndexSet::IndexType; + template using GridIndexType = typename GridView::IndexSet::IndexType; template using GridVariables = GetPropType, Properties::GridVariables>; template using GridVolumeVariables = typename GridVariables::GridVolumeVariables; @@ -105,7 +105,7 @@ class FacetCouplingManager elementIdx; + GridIndexType< bulkId > elementIdx; std::vector< FVElementGeometry > lowDimFvGeometries; std::vector< VolumeVariables > lowDimVolVars; @@ -131,7 +131,7 @@ class FacetCouplingManager elementIdx; + GridIndexType< lowDimId > elementIdx; std::unique_ptr< FVElementGeometry > bulkFvGeometry; std::unique_ptr< ElementVolumeVariables > bulkElemVolVars; std::unique_ptr< ElementFluxVariablesCache > bulkElemFluxVarsCache; @@ -309,7 +309,7 @@ public: evalCouplingResidual(BulkIdType, const BulkLocalAssembler& bulkLocalAssembler, LowDimIdType, - IndexType dofIdxGlobalJ) + GridIndexType dofIdxGlobalJ) { const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); @@ -340,7 +340,7 @@ public: evalCouplingResidual(LowDimIdType, const LowDimLocalAssembler& lowDimLocalAssembler, BulkIdType, - IndexType dofIdxGlobalJ) + GridIndexType dofIdxGlobalJ) { // make sure this is called for the element for which the context was set assert(lowDimContext_.isSet); @@ -513,7 +513,7 @@ public: void updateCouplingContext(BulkIdType domainI, const BulkLocalAssembler& bulkLocalAssembler, LowDimIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -593,7 +593,7 @@ public: void updateCouplingContext(BulkIdType domainI, const BulkLocalAssembler& bulkLocalAssembler, BulkIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -610,7 +610,7 @@ public: void updateCouplingContext(LowDimIdType domainI, const LowDimLocalAssembler& lowDimLocalAssembler, BulkIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -657,7 +657,7 @@ public: void updateCouplingContext(LowDimIdType domainI, const LowDimLocalAssembler& lowDimLocalAssembler, LowDimIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { diff --git a/dumux/multidomain/facet/couplingmapperbase.hh b/dumux/multidomain/facet/couplingmapperbase.hh index 0f174b6946..e7e975b1f0 100644 --- a/dumux/multidomain/facet/couplingmapperbase.hh +++ b/dumux/multidomain/facet/couplingmapperbase.hh @@ -210,10 +210,10 @@ protected: const FVGridGeometry& fvGridGeometry) { static constexpr int dim = FVGridGeometry::GridView::dimension; - using IndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; + using GridIndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; const auto numCorners = element.subEntities(dim); - std::vector< IndexType > nodalDofs(numCorners); + std::vector< GridIndexType > nodalDofs(numCorners); for (unsigned int i = 0; i < numCorners; ++i) nodalDofs[i] = fvGridGeometry.vertexMapper().subIndex(element, i, dim); @@ -235,9 +235,9 @@ private: std::vector< typename FVGridGeometry::GridView::IndexSet::IndexType > makeInsertionToGridIndexMap_(std::shared_ptr embeddings, const FVGridGeometry& fvGridGeometry) const { - using IndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; + using GridIndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; - std::vector< IndexType > map(fvGridGeometry.gridView().size(0)); + std::vector< GridIndexType > map(fvGridGeometry.gridView().size(0)); for (const auto& e : elements(fvGridGeometry.gridView())) map[ embeddings->template insertionIndex(e) ] = fvGridGeometry.elementMapper().index(e); diff --git a/dumux/multidomain/facet/enrichmenthelper.hh b/dumux/multidomain/facet/enrichmenthelper.hh index 3f2728cff6..4c633d9063 100644 --- a/dumux/multidomain/facet/enrichmenthelper.hh +++ b/dumux/multidomain/facet/enrichmenthelper.hh @@ -63,11 +63,11 @@ class VertexEnrichmentHelper using Intersection = typename GridView::Intersection; using ReferenceElements = typename Dune::ReferenceElements; using MCMGMapper = Dune::MultipleCodimMultipleGeomTypeMapper; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; - using ElementPath = std::vector< IndexType >; + using ElementPath = std::vector< GridIndexType >; using NodalElementPaths = std::vector< std::vector >; public: @@ -116,7 +116,7 @@ public: // first, get indices of all vertices of this intersection const auto numCorners = is.geometry().corners(); - std::vector faceVertexIndices(numCorners); + std::vector faceVertexIndices(numCorners); for (int i = 0; i < numCorners; ++i) faceVertexIndices[i] = vertexMapper.subIndex( e, refElement.subEntity(is.indexInInside(), 1, i, dim), @@ -226,7 +226,7 @@ private: const Element& element, const ReferenceElement& refElement, const Intersection& prevIntersection, - IndexType vIdxGlobal) + GridIndexType vIdxGlobal) { // on 2d/3d grids, we need to find 1/2 more intersections at vertex static constexpr int numIsToFind = dim == 3 ? 2 : 1; @@ -241,7 +241,7 @@ private: // determine all vertex indices of this face const auto numCorners = is.geometry().corners(); - std::vector faceVertexIndices(numCorners); + std::vector faceVertexIndices(numCorners); for (int i = 0; i < numCorners; ++i) faceVertexIndices[i] = vertexMapper.subIndex( element, refElement.subEntity(is.indexInInside(), 1, i, dim), diff --git a/dumux/multidomain/facet/gmshreader.hh b/dumux/multidomain/facet/gmshreader.hh index f3c45a8181..b472abab71 100644 --- a/dumux/multidomain/facet/gmshreader.hh +++ b/dumux/multidomain/facet/gmshreader.hh @@ -61,7 +61,7 @@ class FacetCouplingGmshReader static constexpr int bulkDim = BulkGrid::dimension; static constexpr int bulkDimWorld = BulkGrid::dimensionworld; using ctype = typename BulkGrid::ctype; - using IndexType = typename BulkGrid::LeafGridView::IndexSet::IndexType; + using GridIndexType = typename BulkGrid::LeafGridView::IndexSet::IndexType; using GlobalPosition = Dune::FieldVector; // determine minimum dimension for which a grid is created @@ -69,7 +69,7 @@ class FacetCouplingGmshReader static_assert(minGridDim >= 1, "Grids with dim < 1 cannot be read!"); // structure to store data on an element - using VertexIndexSet = std::vector; + using VertexIndexSet = std::vector; struct ElementData { Dune::GeometryType gt; @@ -143,10 +143,10 @@ public: // indices to lowDim vertex indices. -1 indicates non-initialized status std::size_t elemCount = 0; std::array lowDimVertexCount; - std::array, numGrids-1> lowDimVertexMap; + std::array, numGrids-1> lowDimVertexMap; std::array, numGrids-1> idxIsAssigned; std::fill(lowDimVertexCount.begin(), lowDimVertexCount.end(), 0); - std::fill(lowDimVertexMap.begin(), lowDimVertexMap.end(), std::vector(vertexCount)); + std::fill(lowDimVertexMap.begin(), lowDimVertexMap.end(), std::vector(vertexCount)); std::fill(idxIsAssigned.begin(), idxIsAssigned.end(), std::vector(vertexCount, false)); std::getline(gridFile, line); while (line.find("$EndElements") == std::string::npos) @@ -314,14 +314,14 @@ public: } //! Returns the maps of the embedded entities - std::unordered_map< IndexType, std::vector >& embeddedEntityMap(std::size_t id) + std::unordered_map< GridIndexType, std::vector >& embeddedEntityMap(std::size_t id) { assert(id < numGrids && "Index exceeds number of grids provided"); return embeddedEntityMaps_[id]; } //! Returns the maps of the embedments - std::unordered_map< IndexType, std::vector >& adjoinedEntityMap(std::size_t id) + std::unordered_map< GridIndexType, std::vector >& adjoinedEntityMap(std::size_t id) { assert(id < numGrids && "Index exceeds number of grids provided"); return adjoinedEntityMaps_[id]; @@ -374,7 +374,7 @@ private: void addEmbeddings(const VertexIndexSet& corners, unsigned int gridIdx, std::size_t curElemIdx, - const std::vector& lowDimVIndices, + const std::vector& lowDimVIndices, const std::vector& idxIsAssigned) { const unsigned int embeddedGridIdx = gridIdx+1; @@ -413,8 +413,8 @@ private: std::array, numGrids> boundarySegments_; //! data on connectivity between the grids - std::array< std::unordered_map< IndexType, std::vector >, numGrids > embeddedEntityMaps_; - std::array< std::unordered_map< IndexType, std::vector >, numGrids > adjoinedEntityMaps_; + std::array< std::unordered_map< GridIndexType, std::vector >, numGrids > embeddedEntityMaps_; + std::array< std::unordered_map< GridIndexType, std::vector >, numGrids > adjoinedEntityMaps_; //! data on domain and boundary markers std::array< std::vector, numGrids > elementMarkerMaps_; diff --git a/dumux/multidomain/facet/gridmanager.hh b/dumux/multidomain/facet/gridmanager.hh index c970bdd37c..44c0ed38bd 100644 --- a/dumux/multidomain/facet/gridmanager.hh +++ b/dumux/multidomain/facet/gridmanager.hh @@ -162,9 +162,9 @@ class FacetCouplingEmbeddings template using GridFactory = typename Dune::GridFactory>; //! we use the bulk grid's index type here - using IT = typename Grid<0>::LeafGridView::IndexSet::IndexType; + using GIType = typename Grid<0>::LeafGridView::IndexSet::IndexType; //! the map type to store embedment data - using EmbedmentMap = std::unordered_map>; + using EmbedmentMap = std::unordered_map>; public: //! export the i-th grid view type @@ -180,7 +180,7 @@ public: //! export the bulk grid type using BulkGridView = GridView; //! export the type used for indices - using IndexType = IT; + using GridIndexType = GIType; //! return reference to the i-th grid view template @@ -189,41 +189,41 @@ public: //! return the insertion index of an entity of the i-th grid template - IndexType insertionIndex(const Entity& entity) const + GridIndexType insertionIndex(const Entity& entity) const { return std::get(gridFactoryPtrTuple_)->insertionIndex(entity); } //! Returns the insertion indices of the entities embedded in given element template - typename std::unordered_map< IndexType, std::vector >::mapped_type + typename std::unordered_map< GridIndexType, std::vector >::mapped_type embeddedEntityIndices(const typename Grid::template Codim<0>::Entity& element) const { const auto& map = embeddedEntityMaps_[id]; auto it = map.find( std::get(gridFactoryPtrTuple_)->insertionIndex(element) ); if (it != map.end()) return it->second; - else return typename std::unordered_map< IndexType, std::vector >::mapped_type(); + else return typename std::unordered_map< GridIndexType, std::vector >::mapped_type(); } //! Returns the insertion indices of the entities in which the element is embedded template - typename std::unordered_map< IndexType, std::vector >::mapped_type + typename std::unordered_map< GridIndexType, std::vector >::mapped_type adjoinedEntityIndices(const typename Grid::template Codim<0>::Entity& element) const { const auto& map = adjoinedEntityMaps_[id]; auto it = map.find( std::get(gridFactoryPtrTuple_)->insertionIndex(element) ); if (it != map.end()) return it->second; - else return typename std::unordered_map< IndexType, std::vector >::mapped_type(); + else return typename std::unordered_map< GridIndexType, std::vector >::mapped_type(); } //! Returns the maps of the embedded entities - const std::unordered_map< IndexType, std::vector >& embeddedEntityMap(std::size_t id) const + const std::unordered_map< GridIndexType, std::vector >& embeddedEntityMap(std::size_t id) const { assert(id < numGrids); return embeddedEntityMaps_[id]; } //! Returns the maps of the adjoined entities of dimension d+1 - const std::unordered_map< IndexType, std::vector >& adjoinedEntityMap(std::size_t id) const + const std::unordered_map< GridIndexType, std::vector >& adjoinedEntityMap(std::size_t id) const { assert(id < numGrids); return adjoinedEntityMaps_[id]; } //! Returns the hierachy's insertion indices that make up the grid for the given id - const std::vector& lowDimVertexIndices(std::size_t id) const + const std::vector& lowDimVertexIndices(std::size_t id) const { assert(id > 0 && id < numGrids); return lowDimGridVertexIndices_[id-1]; } /*! @@ -240,7 +240,7 @@ public: std::shared_ptr> gridFactoryPtr, EmbedmentMap&& embeddedEntityMap, EmbedmentMap&& adjoinedEntityMap, - std::vector&& lowDimGridVertexIndices = std::vector() ) + std::vector&& lowDimGridVertexIndices = std::vector() ) { std::get(gridViewPtrTuple_) = std::make_shared>(gridPtr->leafGridView()); std::get(gridFactoryPtrTuple_) = gridFactoryPtr; @@ -256,7 +256,7 @@ private: std::array adjoinedEntityMaps_; //! Contains the hierarchy insertion indices that make up a lower-dimensional grid - std::array, numGrids-1> lowDimGridVertexIndices_; + std::array, numGrids-1> lowDimGridVertexIndices_; //! tuple to store the grids using Indices = std::make_index_sequence; diff --git a/dumux/multidomain/facet/vertexmapper.hh b/dumux/multidomain/facet/vertexmapper.hh index 23a1de8cca..aee6692eb1 100644 --- a/dumux/multidomain/facet/vertexmapper.hh +++ b/dumux/multidomain/facet/vertexmapper.hh @@ -147,7 +147,7 @@ class EnrichedVertexDofMapper static constexpr int dim = GV::dimension; static_assert(dim > 1, "Vertex dof enrichment mapper currently only works for dim > 1!"); - using IT = typename GV::IndexSet::IndexType; + using GIType = typename GV::IndexSet::IndexType; using Vertex = typename GV::template Codim::Entity; using Element = typename GV::template Codim<0>::Entity; using MCMGMapper = Dune::MultipleCodimMultipleGeomTypeMapper; @@ -156,7 +156,7 @@ public: //! export the underlying grid view type using GridView = GV; //! export the grid index type - using IndexType = IT; + using GridIndexType = GIType; //! the constructor EnrichedVertexDofMapper(const GV& gridView) @@ -176,21 +176,21 @@ public: } //! map nodal subentity of codim 0 entity to the grid dof - IndexType subIndex(const Element& e, unsigned int i, unsigned int codim) const + GridIndexType subIndex(const Element& e, unsigned int i, unsigned int codim) const { assert(codim == dim && "Only element corners can be mapped by this mapper"); return indexMap_[elementMapper_.index(e)][i]; } //! map nodal subentity of codim 0 entity to the grid vertex index - IndexType vertexIndex(const Element& e, unsigned int i, unsigned int codim) const + GridIndexType vertexIndex(const Element& e, unsigned int i, unsigned int codim) const { assert(codim == dim && "Only element corners can be mapped by this mapper"); return vertexMapper_.subIndex(e, i, codim); } //! map nodal entity to the grid vertex index - IndexType vertexIndex(const Vertex& v) const + GridIndexType vertexIndex(const Vertex& v) const { assert(Vertex::Geometry::mydimension == 0 && "Only vertices can be mapped by this mapper"); return vertexMapper_.index(v); @@ -201,7 +201,7 @@ public: //! We therefore ask this in every call. This means quite some overhead, but //! this mapper is not designed optimally for the case of no enriched nodes. template< class EntityType > - IndexType index(const EntityType& e) const + GridIndexType index(const EntityType& e) const { if (hasEnrichedVertices_) DUNE_THROW(Dune::InvalidStateException, "Index map contains enriched vertex dofs. Direct mapping from vertex to index not possible."); -- GitLab From 8014ca17bbc0e7ac299e6909da3d487048c3797c Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 19 Nov 2018 20:08:52 +0100 Subject: [PATCH 03/12] [cleanup][tpfa] Use correct index types --- .../cellcentered/tpfa/fvgridgeometry.hh | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh index 9d59a04246..4432bbe5c7 100644 --- a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh @@ -89,7 +89,9 @@ class CCTpfaFVGridGeometry using ThisType = CCTpfaFVGridGeometry; using ParentType = BaseFVGridGeometry; using ConnectivityMap = typename Traits::template ConnectivityMap; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename GV::IndexSet::IndexType; + using ScvfIndexType = typename Traits::SubControlVolumeFace::Traits::GridIndexType; + using ScvIndexType = typename Traits::SubControlVolume::Traits::GridIndexType; using Element = typename GV::template Codim<0>::Entity; static const int dim = GV::dimension; @@ -163,8 +165,8 @@ public: flipScvfIndices_.clear(); // determine size of containers - IndexType numScvs = numDofs(); - IndexType numScvf = 0; + std::size_t numScvs = numDofs(); + std::size_t numScvf = 0; for (const auto& element : elements(this->gridView())) numScvf += element.subEntities(1); @@ -175,7 +177,7 @@ public: hasBoundaryScvf_.resize(numScvs, false); // Build the scvs and scv faces - IndexType scvfIdx = 0; + ScvfIndexType scvfIdx = 0; numBoundaryScvf_ = 0; for (const auto& element : elements(this->gridView())) { @@ -183,7 +185,7 @@ public: scvs_[eIdx] = SubControlVolume(element.geometry(), eIdx); // the element-wise index sets for finite volume geometry - std::vector scvfsIndexSet; + std::vector scvfsIndexSet; scvfsIndexSet.reserve(element.subEntities(1)); // for network grids there might be multiple intersection with the same geometryInInside @@ -286,26 +288,26 @@ public: } //! Get a sub control volume with a global scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(ScvIndexType scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a global scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(ScvfIndexType scvfIdx) const { return scvfs_[scvfIdx]; } //! Get the scvf on the same face but from the other side //! Note that e.g. the normals might be different in the case of surface grids - const SubControlVolumeFace& flipScvf(IndexType scvfIdx, unsigned int outsideScvfIdx = 0) const + const SubControlVolumeFace& flipScvf(ScvfIndexType scvfIdx, unsigned int outsideScvfIdx = 0) const { return scvfs_[flipScvfIndices_[scvfIdx][outsideScvfIdx]]; } //! Get the sub control volume face indices of an scv by global index - const std::vector& scvfIndicesOfScv(IndexType scvIdx) const + const std::vector& scvfIndicesOfScv(ScvIndexType scvIdx) const { return scvfIndicesOfScv_[scvIdx]; } @@ -318,12 +320,12 @@ public: { return connectivityMap_; } //! Returns whether one of the geometry's scvfs lies on a boundary - bool hasBoundaryScvf(IndexType eIdx) const + bool hasBoundaryScvf(GridIndexType eIdx) const { return hasBoundaryScvf_[eIdx]; } private: // find the scvf that has insideScvIdx in its outsideScvIdx list and outsideScvIdx as its insideScvIdx - IndexType findFlippedScvfIndex_(IndexType insideScvIdx, IndexType outsideScvIdx) + ScvfIndexType findFlippedScvfIndex_(ScvIndexType insideScvIdx, ScvIndexType outsideScvIdx) { // go over all potential scvfs of the outside scv for (auto outsideScvfIndex : scvfIndicesOfScv_[outsideScvIdx]) @@ -343,12 +345,12 @@ private: //! containers storing the global data std::vector scvs_; std::vector scvfs_; - std::vector> scvfIndicesOfScv_; - IndexType numBoundaryScvf_; + std::vector> scvfIndicesOfScv_; + std::size_t numBoundaryScvf_; std::vector hasBoundaryScvf_; //! needed for embedded surface and network grids (dim < dimWorld) - std::vector> flipScvfIndices_; + std::vector> flipScvfIndices_; }; /*! @@ -366,7 +368,9 @@ class CCTpfaFVGridGeometry using ParentType = BaseFVGridGeometry; using ConnectivityMap = typename Traits::template ConnectivityMap; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename GV::IndexSet::IndexType; + using ScvfIndexType = typename Traits::SubControlVolumeFace::Traits::GridIndexType; + using ScvIndexType = typename Traits::SubControlVolume::Traits::GridIndexType; using Element = typename GV::template Codim<0>::Entity; static const int dim = GV::dimension; @@ -375,7 +379,7 @@ class CCTpfaFVGridGeometry using ScvfGridIndexStorage = typename Traits::SubControlVolumeFace::Traits::GridIndexStorage; using NeighborVolVarIndices = typename std::conditional_t< (dim >; + Dune::ReservedVector >; public: //! export the type of the fv element geometry (the local view type) @@ -456,7 +460,7 @@ public: // the element-wise index sets for finite volume geometry auto numLocalFaces = element.subEntities(1); - std::vector scvfsIndexSet; + std::vector scvfsIndexSet; std::vector neighborVolVarIndexSet; scvfsIndexSet.reserve(numLocalFaces); neighborVolVarIndexSet.reserve(numLocalFaces); @@ -525,11 +529,11 @@ public: connectivityMap_.update(*this); } - const std::vector& scvfIndicesOfScv(IndexType scvIdx) const + const std::vector& scvfIndicesOfScv(ScvIndexType scvIdx) const { return scvfIndicesOfScv_[scvIdx]; } //! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx - const std::vector& neighborVolVarIndices(IndexType scvIdx) const + const std::vector& neighborVolVarIndices(ScvIndexType scvIdx) const { return neighborVolVarIndices_[scvIdx]; } /*! @@ -542,15 +546,15 @@ public: private: //! Information on the global number of geometries - IndexType numScvs_; - IndexType numScvf_; - IndexType numBoundaryScvf_; + std::size_t numScvs_; + std::size_t numScvf_; + std::size_t numBoundaryScvf_; //! connectivity map for efficient assembly ConnectivityMap connectivityMap_; //! vectors that store the global data - std::vector> scvfIndicesOfScv_; + std::vector> scvfIndicesOfScv_; std::vector> neighborVolVarIndices_; }; -- GitLab From 7cb8925a3e4c47a21b0835fc9c945ab926c6b3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 09:15:14 +0100 Subject: [PATCH 04/12] [facet][box][fvgridgeom] cleanup index types --- .../facet/box/fvelementgeometry.hh | 14 ++++++----- dumux/multidomain/facet/box/fvgridgeometry.hh | 24 +++++++++---------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/dumux/multidomain/facet/box/fvelementgeometry.hh b/dumux/multidomain/facet/box/fvelementgeometry.hh index e1a92cef5e..a4e2b2b1b1 100644 --- a/dumux/multidomain/facet/box/fvelementgeometry.hh +++ b/dumux/multidomain/facet/box/fvelementgeometry.hh @@ -69,14 +69,15 @@ public: //! Constructor BoxFacetCouplingFVElementGeometry(const FVGridGeometry& fvGridGeometry) - : fvGridGeometryPtr_(&fvGridGeometry) {} + : fvGridGeometryPtr_(&fvGridGeometry) + {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(GridIndexType scvIdx) const + const SubControlVolume& scv(unsigned int scvIdx) const { return fvGridGeometry().scvs(eIdx_)[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const + const SubControlVolumeFace& scvf(unsigned int scvfIdx) const { return fvGridGeometry().scvfs(eIdx_)[scvfIdx]; } //! iterator range for sub control volumes. Iterates over @@ -175,14 +176,15 @@ public: //! Constructor BoxFacetCouplingFVElementGeometry(const FVGridGeometry& fvGridGeometry) - : fvGridGeometryPtr_(&fvGridGeometry) {} + : fvGridGeometryPtr_(&fvGridGeometry) + {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(GridIndexType scvIdx) const + const SubControlVolume& scv(unsigned int scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const + const SubControlVolumeFace& scvf(unsigned int scvfIdx) const { return scvfs_[scvfIdx]; } //! iterator range for sub control volumes. Iterates over diff --git a/dumux/multidomain/facet/box/fvgridgeometry.hh b/dumux/multidomain/facet/box/fvgridgeometry.hh index 4e8921b230..f1bd32dcec 100644 --- a/dumux/multidomain/facet/box/fvgridgeometry.hh +++ b/dumux/multidomain/facet/box/fvgridgeometry.hh @@ -96,6 +96,7 @@ class BoxFacetCouplingFVGridGeometry using ThisType = BoxFacetCouplingFVGridGeometry; using ParentType = BaseFVGridGeometry; using GridIndexType = typename GV::IndexSet::IndexType; + using LocalIndexType = unsigned int; using Element = typename GV::template Codim<0>::Entity; using CoordScalar = typename GV::ctype; @@ -201,7 +202,6 @@ public: // construct the sub control volumes scvs_[eIdx].clear(); scvs_[eIdx].reserve(elementGeometry.corners()); - using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx) scvs_[eIdx].emplace_back(geometryHelper, scvLocalIdx, @@ -298,24 +298,24 @@ public: { return scvfs_[eIdx]; } //! If a d.o.f. is on the boundary - bool dofOnBoundary(unsigned int dofIdx) const + bool dofOnBoundary(GridIndexType dofIdx) const { return boundaryDofIndices_[dofIdx]; } //! If a d.o.f. is on an interior boundary - bool dofOnInteriorBoundary(unsigned int dofIdx) const + bool dofOnInteriorBoundary(GridIndexType dofIdx) const { return interiorBoundaryDofIndices_[dofIdx]; } //! Periodic boundaries are not supported for the box facet coupling scheme - bool dofOnPeriodicBoundary(std::size_t dofIdx) const + bool dofOnPeriodicBoundary(GridIndexType dofIdx) const { return false; } //! The index of the vertex / d.o.f. on the other side of the periodic boundary - std::size_t periodicallyMappedDof(std::size_t dofIdx) const + GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const { DUNE_THROW(Dune::InvalidStateException, "Periodic boundaries are not supported by the box facet coupling scheme"); } //! Returns the map between dofs across periodic boundaries - std::unordered_map periodicVertexMap() const - { return std::unordered_map(); } + std::unordered_map periodicVertexMap() const + { return std::unordered_map(); } private: const FeCache feCache_; @@ -347,6 +347,7 @@ class BoxFacetCouplingFVGridGeometry using ThisType = BoxFacetCouplingFVGridGeometry; using ParentType = BaseFVGridGeometry; using GridIndexType = typename GV::IndexSet::IndexType; + using LocalIndexType = unsigned int; static const int dim = GV::dimension; static const int dimWorld = GV::dimensionworld; @@ -451,7 +452,6 @@ public: const auto idxInInside = intersection.indexInInside(); const auto boundary = intersection.boundary(); - using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; std::vector vIndicesLocal(numFaceCorners); for (int i = 0; i < numFaceCorners; ++i) vIndicesLocal[i] = static_cast(referenceElement.subEntity(idxInInside, 1, i, dim)); @@ -506,16 +506,16 @@ public: { return facetIsOnInteriorBoundary_[ facetMapper_.subIndex(element, intersection.indexInInside(), 1) ]; } //! Periodic boundaries are not supported for the box facet coupling scheme - bool dofOnPeriodicBoundary(std::size_t dofIdx) const + bool dofOnPeriodicBoundary(GridIndexType dofIdx) const { return false; } //! The index of the vertex / d.o.f. on the other side of the periodic boundary - std::size_t periodicallyMappedDof(std::size_t dofIdx) const + GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const { DUNE_THROW(Dune::InvalidStateException, "Periodic boundaries are not supported by the facet coupling scheme"); } //! Returns the map between dofs across periodic boundaries - std::unordered_map periodicVertexMap() const - { return std::unordered_map(); } + std::unordered_map periodicVertexMap() const + { return std::unordered_map(); } private: const FeCache feCache_; -- GitLab From ffca0c5d1d7feba1eb340da201fd72609bd20cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 09:22:11 +0100 Subject: [PATCH 05/12] [tpfa][fvgridgeom] use one single grid index type --- .../cellcentered/tpfa/fvgridgeometry.hh | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh index 4432bbe5c7..1f9ddfa93a 100644 --- a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh @@ -90,8 +90,6 @@ class CCTpfaFVGridGeometry using ParentType = BaseFVGridGeometry; using ConnectivityMap = typename Traits::template ConnectivityMap; using GridIndexType = typename GV::IndexSet::IndexType; - using ScvfIndexType = typename Traits::SubControlVolumeFace::Traits::GridIndexType; - using ScvIndexType = typename Traits::SubControlVolume::Traits::GridIndexType; using Element = typename GV::template Codim<0>::Entity; static const int dim = GV::dimension; @@ -177,7 +175,7 @@ public: hasBoundaryScvf_.resize(numScvs, false); // Build the scvs and scv faces - ScvfIndexType scvfIdx = 0; + GridIndexType scvfIdx = 0; numBoundaryScvf_ = 0; for (const auto& element : elements(this->gridView())) { @@ -185,7 +183,7 @@ public: scvs_[eIdx] = SubControlVolume(element.geometry(), eIdx); // the element-wise index sets for finite volume geometry - std::vector scvfsIndexSet; + std::vector scvfsIndexSet; scvfsIndexSet.reserve(element.subEntities(1)); // for network grids there might be multiple intersection with the same geometryInInside @@ -288,26 +286,26 @@ public: } //! Get a sub control volume with a global scv index - const SubControlVolume& scv(ScvIndexType scvIdx) const + const SubControlVolume& scv(GridIndexType scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a global scvf index - const SubControlVolumeFace& scvf(ScvfIndexType scvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const { return scvfs_[scvfIdx]; } //! Get the scvf on the same face but from the other side //! Note that e.g. the normals might be different in the case of surface grids - const SubControlVolumeFace& flipScvf(ScvfIndexType scvfIdx, unsigned int outsideScvfIdx = 0) const + const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvfIdx = 0) const { return scvfs_[flipScvfIndices_[scvfIdx][outsideScvfIdx]]; } //! Get the sub control volume face indices of an scv by global index - const std::vector& scvfIndicesOfScv(ScvIndexType scvIdx) const + const std::vector& scvfIndicesOfScv(GridIndexType scvIdx) const { return scvfIndicesOfScv_[scvIdx]; } @@ -325,7 +323,7 @@ public: private: // find the scvf that has insideScvIdx in its outsideScvIdx list and outsideScvIdx as its insideScvIdx - ScvfIndexType findFlippedScvfIndex_(ScvIndexType insideScvIdx, ScvIndexType outsideScvIdx) + GridIndexType findFlippedScvfIndex_(GridIndexType insideScvIdx, GridIndexType outsideScvIdx) { // go over all potential scvfs of the outside scv for (auto outsideScvfIndex : scvfIndicesOfScv_[outsideScvIdx]) @@ -345,12 +343,12 @@ private: //! containers storing the global data std::vector scvs_; std::vector scvfs_; - std::vector> scvfIndicesOfScv_; + std::vector> scvfIndicesOfScv_; std::size_t numBoundaryScvf_; std::vector hasBoundaryScvf_; //! needed for embedded surface and network grids (dim < dimWorld) - std::vector> flipScvfIndices_; + std::vector> flipScvfIndices_; }; /*! @@ -369,8 +367,6 @@ class CCTpfaFVGridGeometry using ConnectivityMap = typename Traits::template ConnectivityMap; using GridIndexType = typename GV::IndexSet::IndexType; - using ScvfIndexType = typename Traits::SubControlVolumeFace::Traits::GridIndexType; - using ScvIndexType = typename Traits::SubControlVolume::Traits::GridIndexType; using Element = typename GV::template Codim<0>::Entity; static const int dim = GV::dimension; @@ -460,7 +456,7 @@ public: // the element-wise index sets for finite volume geometry auto numLocalFaces = element.subEntities(1); - std::vector scvfsIndexSet; + std::vector scvfsIndexSet; std::vector neighborVolVarIndexSet; scvfsIndexSet.reserve(numLocalFaces); neighborVolVarIndexSet.reserve(numLocalFaces); @@ -529,11 +525,11 @@ public: connectivityMap_.update(*this); } - const std::vector& scvfIndicesOfScv(ScvIndexType scvIdx) const + const std::vector& scvfIndicesOfScv(GridIndexType scvIdx) const { return scvfIndicesOfScv_[scvIdx]; } //! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx - const std::vector& neighborVolVarIndices(ScvIndexType scvIdx) const + const std::vector& neighborVolVarIndices(GridIndexType scvIdx) const { return neighborVolVarIndices_[scvIdx]; } /*! @@ -554,7 +550,7 @@ private: ConnectivityMap connectivityMap_; //! vectors that store the global data - std::vector> scvfIndicesOfScv_; + std::vector> scvfIndicesOfScv_; std::vector> neighborVolVarIndices_; }; -- GitLab From 600427def5ab97b1ae84e3e75e835cffd285178e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 09:43:38 +0100 Subject: [PATCH 06/12] [box][fvelemgeom] cleanup index types --- dumux/discretization/box/fvelementgeometry.hh | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh index 3b06ab5230..665fbd0a67 100644 --- a/dumux/discretization/box/fvelementgeometry.hh +++ b/dumux/discretization/box/fvelementgeometry.hh @@ -52,7 +52,7 @@ class BoxFVElementGeometry using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using IndexType = typename GridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; @@ -72,13 +72,13 @@ public: : fvGridGeometryPtr_(&fvGridGeometry) {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(LocalIndexType scvIdx) const { return fvGridGeometry().scvs(eIdx_)[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const { return fvGridGeometry().scvfs(eIdx_)[scvfIdx]; } @@ -156,7 +156,7 @@ private: const Element* elementPtr_; const FVGridGeometry* fvGridGeometryPtr_; - IndexType eIdx_; + typename GridView::IndexSet::IndexType eIdx_; }; //! specialization in case the FVElementGeometries are not stored @@ -166,10 +166,8 @@ class BoxFVElementGeometry using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - - using IndexType = typename GridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; using Element = typename GridView::template Codim<0>::Entity; - using CoordScalar = typename GridView::ctype; using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; using ReferenceElements = typename Dune::ReferenceElements; @@ -192,13 +190,13 @@ public: : fvGridGeometryPtr_(&fvGridGeometry) {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(LocalIndexType scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const { return scvfs_[scvfIdx]; } @@ -287,7 +285,6 @@ private: // construct the sub control volumes scvs_.resize(elementGeometry.corners()); - using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx) { // get asssociated dof index @@ -304,7 +301,7 @@ private: const auto numInnerScvf = (dim==1) ? 1 : element.subEntities(dim-1); scvfs_.resize(numInnerScvf); - unsigned int scvfLocalIdx = 0; + LocalIndexType scvfLocalIdx = 0; for (; scvfLocalIdx < numInnerScvf; ++scvfLocalIdx) { // find the local scv indices this scvf is connected to @@ -350,7 +347,7 @@ private: //! The bound element const Element* elementPtr_; - IndexType eIdx_; + typename GridView::IndexSet::IndexType eIdx_; //! The global geometry this is a restriction of const FVGridGeometry* fvGridGeometryPtr_; -- GitLab From 7c6201371158ad90bb4bb49ce419b9e9a56931ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 10:04:26 +0100 Subject: [PATCH 07/12] [common] introduce index traits --- dumux/common/CMakeLists.txt | 1 + dumux/common/indextraits.hh | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 dumux/common/indextraits.hh diff --git a/dumux/common/CMakeLists.txt b/dumux/common/CMakeLists.txt index 9d1bee358a..d99fec1490 100644 --- a/dumux/common/CMakeLists.txt +++ b/dumux/common/CMakeLists.txt @@ -16,6 +16,7 @@ entitymap.hh exceptions.hh fixedlengthspline_.hh fvproblem.hh +indextraits.hh intersectionmapper.hh intrange.hh loggingparametertree.hh diff --git a/dumux/common/indextraits.hh b/dumux/common/indextraits.hh new file mode 100644 index 0000000000..f976a277af --- /dev/null +++ b/dumux/common/indextraits.hh @@ -0,0 +1,46 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *****************************************************************************/ +/*! + * \file + * \ingroup Common + * \brief Defines the index types used for grid and local indices. + */ +#ifndef DUMUX_COMMON_INDEX_TRAITS_HH +#define DUMUX_COMMON_INDEX_TRAITS_HH + +#include + +namespace Dumux { + +/*! + * \ingroup Common + * \brief Struture to define the index types used for grid and local indices. + * \tparam GridView The grid view type + */ +template +struct IndexTraits +{ + using GridIndex = typename GridView::IndexSet::IndexType; + using LocalIndex = unsigned int; + using SmallLocalIndex = std::uint_least8_t; +}; + +} // namespace Dumux + +#endif // DUMUX_COMMON_INDEX_TRAITS_HH -- GitLab From 4ba29c1cc21efd2349238a6c96fa56c1b9722066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 15:09:26 +0100 Subject: [PATCH 08/12] [facet] use index traits class to obtain indices --- dumux/multidomain/facet/box/couplingmapper.hh | 5 +- .../facet/box/fvelementgeometry.hh | 15 +- dumux/multidomain/facet/box/fvgridgeometry.hh | 9 +- .../facet/cellcentered/mpfa/localassembler.hh | 292 ++++++++++++++++++ .../cellcentered/tpfa/couplingmanager.hh | 3 +- .../facet/cellcentered/tpfa/couplingmapper.hh | 5 +- .../multidomain/facet/codimonegridadapter.hh | 7 +- dumux/multidomain/facet/couplingmanager.hh | 10 +- dumux/multidomain/facet/couplingmapperbase.hh | 13 +- dumux/multidomain/facet/enrichmenthelper.hh | 3 +- dumux/multidomain/facet/gmshreader.hh | 4 +- dumux/multidomain/facet/gridmanager.hh | 3 +- dumux/multidomain/facet/vertexmapper.hh | 2 +- 13 files changed, 340 insertions(+), 31 deletions(-) create mode 100644 dumux/multidomain/facet/cellcentered/mpfa/localassembler.hh diff --git a/dumux/multidomain/facet/box/couplingmapper.hh b/dumux/multidomain/facet/box/couplingmapper.hh index d96a9d68b2..338fa965b9 100644 --- a/dumux/multidomain/facet/box/couplingmapper.hh +++ b/dumux/multidomain/facet/box/couplingmapper.hh @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -99,8 +100,8 @@ public: const LowDimFVG& lowDimFvGridGeometry, const BulkFVG& bulkFvGridGeometry) { - using LowDimIndexType = typename LowDimGridView::IndexSet::IndexType; - using BulkIndexType = typename BulkGridView::IndexSet::IndexType; + using LowDimIndexType = typename IndexTraits::GridIndex; + using BulkIndexType = typename IndexTraits::GridIndex; using BulkReferenceElements = Dune::ReferenceElements; const auto lowDimElemIdx = lowDimFvGridGeometry.elementMapper().index(lowDimElement); diff --git a/dumux/multidomain/facet/box/fvelementgeometry.hh b/dumux/multidomain/facet/box/fvelementgeometry.hh index a4e2b2b1b1..9b53e71ae8 100644 --- a/dumux/multidomain/facet/box/fvelementgeometry.hh +++ b/dumux/multidomain/facet/box/fvelementgeometry.hh @@ -28,6 +28,7 @@ #include +#include #include #include @@ -52,7 +53,8 @@ class BoxFacetCouplingFVElementGeometry using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using GridIndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; @@ -73,11 +75,11 @@ public: {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(unsigned int scvIdx) const + const SubControlVolume& scv(LocalIndexType scvIdx) const { return fvGridGeometry().scvs(eIdx_)[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(unsigned int scvfIdx) const + const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const { return fvGridGeometry().scvfs(eIdx_)[scvfIdx]; } //! iterator range for sub control volumes. Iterates over @@ -154,7 +156,8 @@ class BoxFacetCouplingFVElementGeometry static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using GridIndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; @@ -180,11 +183,11 @@ public: {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(unsigned int scvIdx) const + const SubControlVolume& scv(LocalIndexType scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(unsigned int scvfIdx) const + const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const { return scvfs_[scvfIdx]; } //! iterator range for sub control volumes. Iterates over diff --git a/dumux/multidomain/facet/box/fvgridgeometry.hh b/dumux/multidomain/facet/box/fvgridgeometry.hh index f1bd32dcec..fcc5f6e806 100644 --- a/dumux/multidomain/facet/box/fvgridgeometry.hh +++ b/dumux/multidomain/facet/box/fvgridgeometry.hh @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -95,8 +96,8 @@ class BoxFacetCouplingFVGridGeometry { using ThisType = BoxFacetCouplingFVGridGeometry; using ParentType = BaseFVGridGeometry; - using GridIndexType = typename GV::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GV::template Codim<0>::Entity; using CoordScalar = typename GV::ctype; @@ -346,8 +347,8 @@ class BoxFacetCouplingFVGridGeometry { using ThisType = BoxFacetCouplingFVGridGeometry; using ParentType = BaseFVGridGeometry; - using GridIndexType = typename GV::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; static const int dim = GV::dimension; static const int dimWorld = GV::dimensionworld; diff --git a/dumux/multidomain/facet/cellcentered/mpfa/localassembler.hh b/dumux/multidomain/facet/cellcentered/mpfa/localassembler.hh new file mode 100644 index 0000000000..370e6e656f --- /dev/null +++ b/dumux/multidomain/facet/cellcentered/mpfa/localassembler.hh @@ -0,0 +1,292 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *****************************************************************************/ +/*! + * \file + * \ingroup CCMpfaDiscretization + * \brief Class for the assembly of the local systems of equations + * involved in the transmissibility computaion in the mpfa-o + * scheme with domain coupling across the element facets. + */ +#ifndef DUMUX_DISCRETIZATION_CC_MPFA_O_FACET_COUPLING_LOCAL_ASSEMBLER_HH +#define DUMUX_DISCRETIZATION_CC_MPFA_O_FACET_COUPLING_LOCAL_ASSEMBLER_HH + +#include +#include + +#include +#include +#include + +namespace Dumux +{ + +/*! + * \ingroup CCMpfaDiscretization + * \brief Specialization of the interaction volume-local + * assembler class for the schemes using an mpfa-o type assembly. + * + * \tparam P The problem type + * \tparam EG The element finite volume geometry + * \tparam EV The element volume variables type + */ +template< class P, class EG, class EV > +class InteractionVolumeAssemblerImpl< P, EG, EV, MpfaMethods::oMethodFacetCoupling > + : public InteractionVolumeAssemblerBase< P, EG, EV > +{ + using ParentType = InteractionVolumeAssemblerBase< P, EG, EV >; + +public: + //! Use the constructor of the base class + using ParentType::ParentType; + + /*! + * \brief Assembles the transmissibility matrix within an + * interaction volume of the mpfa-o scheme in the + * context of . + * + * \tparam IV The interaction volume type implementation + * \tparam TensorFunc Lambda to obtain the tensor w.r.t. + * which the local system is to be solved + * + * \param T The transmissibility matrix to be assembled + * \param iv The interaction volume + * \param getT Lambda to evaluate the scv-wise tensors + */ + template< class IV, class TensorFunc > + void assemble(typename IV::Traits::MatVecTraits::TMatrix& T, IV& iv, const TensorFunc& getT) + { + // assemble D into T directly + assembleLocalMatrices_(iv.A(), iv.B(), iv.C(), T, iv, getT); + + // maybe solve the local system + if (iv.numUnknowns() > 0) + { + // T = C*A^-1*B + D + iv.A().invert(); + iv.C().rightmultiply(iv.A()); + T += multiplyMatrices(iv.C(), iv.B()); + } + } + + /*! + * \brief Assembles the vector of primary (cell) unknowns and (maybe) + * Dirichlet boundary conditions within an interaction volume. + * + * \tparam IV The interaction volume type implementation + * \tparam GetU Lambda to obtain the cell unknowns from grid indices + * + * \param u The vector to be filled with the cell unknowns + * \param iv The mpfa-o interaction volume + * \param getU Lambda to obtain the desired cell/Dirichlet value from grid index + */ + template< class IV, class GetU > + void assemble(typename IV::Traits::MatVecTraits::CellVector& u, const IV& iv, const GetU& getU) + { + // put the cell pressures first + using LocalIndexType = typename IV::Traits::IndexSet::LocalIndexType; + for (LocalIndexType i = 0; i < iv.numScvs(); ++i) + u[i] = getU( iv.localScv(i).globalScvIndex() ); + + // Dirichlet BCs come afterwards + LocalIndexType i = iv.numScvs(); + for (const auto& data : iv.dirichletData()) + u[i++] = getU( data.volVarIndex() ); + } + +private: + /*! + * \brief Assemble the matrices involved in the flux expressions + * across the scvfs inside an interaction volume as well as those involved + * in the interaction volume-local system of equations resulting from flux + * and solution continuity across the scvfs. + * + * Flux expressions: \f$\mathbf{f} = \mathbf{C} \bar{\mathbf{u}} + \mathbf{D} \mathbf{u}\f$. + * + * Continuity equations: \f$\mathbf{A} \, \bar{\mathbf{u}} = \mathbf{B} \, \mathbf{u}\f$. + * + * \note The matrices are expected to have been resized beforehand. + * + * \tparam IV The interaction volume type implementation + * \tparam TensorFunc Lambda to obtain the tensor w.r.t. + * which the local system is to be solved + * + * \param A The A matrix of the iv-local equation system + * \param B The B matrix of the iv-local equation system + * \param C The C matrix of the iv-local flux expressions + * \param D The D matrix of the iv-local flux expressions + * \param iv The mpfa-o interaction volume + * \param getT Lambda to evaluate the scv-wise tensors + */ + template< class IV, class TensorFunc > + void assembleLocalMatrices_(typename IV::Traits::MatVecTraits::AMatrix& A, + typename IV::Traits::MatVecTraits::BMatrix& B, + typename IV::Traits::MatVecTraits::CMatrix& C, + typename IV::Traits::MatVecTraits::DMatrix& D, + IV& iv, const TensorFunc& getT) + { + using LocalIndexType = typename IV::Traits::IndexSet::LocalIndexType; + static constexpr int dim = IV::Traits::GridView::dimension; + static constexpr int dimWorld = IV::Traits::GridView::dimensionworld; + + // Matrix D is assumed to have the right size already + assert(D.rows() == iv.numFaces() && D.cols() == iv.numKnowns()); + + // if only Dirichlet faces are present in the iv, + // the matrices A, B & C are undefined and D = T + if (iv.numUnknowns() == 0) + { + // reset matrix beforehand + D = 0.0; + + // Loop over all the faces, in this case these are all dirichlet boundaries + for (LocalIndexType faceIdx = 0; faceIdx < iv.numFaces(); ++faceIdx) + { + const auto& curLocalScvf = iv.localScvf(faceIdx); + const auto& curGlobalScvf = this->fvGeometry().scvf(curLocalScvf.globalScvfIndex()); + const auto& neighborScvIndices = curLocalScvf.neighboringLocalScvIndices(); + + // get tensor in "positive" sub volume + const auto& posLocalScv = iv.localScv(neighborScvIndices[0]); + const auto& posGlobalScv = this->fvGeometry().scv(posLocalScv.globalScvIndex()); + const auto& posVolVars = this->elemVolVars()[posGlobalScv]; + const auto& posElement = iv.element(neighborScvIndices[0]); + const auto tensor = getT(this->problem(), posElement, posVolVars, this->fvGeometry(), posGlobalScv); + + // the omega factors of the "positive" sub volume + const auto wijk = computeMpfaTransmissibility(posLocalScv, curGlobalScvf, tensor, posVolVars.extrusionFactor()); + + const auto posScvLocalDofIdx = posLocalScv.localDofIndex(); + for (LocalIndexType localDir = 0; localDir < dim; localDir++) + { + const auto& otherLocalScvf = iv.localScvf( posLocalScv.scvfIdxLocal(localDir) ); + const auto otherLocalDofIdx = otherLocalScvf.localDofIndex(); + D[faceIdx][otherLocalDofIdx] -= wijk[localDir]; + D[faceIdx][posScvLocalDofIdx] += wijk[localDir]; + } + } + } + else + { + // we require the matrices A,B,C to have the correct size already + assert(A.rows() == iv.numUnknowns() && A.cols() == iv.numUnknowns()); + assert(B.rows() == iv.numUnknowns() && B.cols() == iv.numKnowns()); + assert(C.rows() == iv.numFaces() && C.cols() == iv.numUnknowns()); + + // reset matrices + A = 0.0; + B = 0.0; + C = 0.0; + D = 0.0; + + auto& wijk = iv.omegas(); + for (LocalIndexType faceIdx = 0; faceIdx < iv.numFaces(); ++faceIdx) + { + const auto& curLocalScvf = iv.localScvf(faceIdx); + const auto& curGlobalScvf = this->fvGeometry().scvf(curLocalScvf.globalScvfIndex()); + const auto curIsDirichlet = curLocalScvf.isDirichlet(); + const auto curLocalDofIdx = curLocalScvf.localDofIndex(); + + // get tensor in "positive" sub volume + const auto& neighborScvIndices = curLocalScvf.neighboringLocalScvIndices(); + const auto& posLocalScv = iv.localScv(neighborScvIndices[0]); + const auto& posGlobalScv = this->fvGeometry().scv(posLocalScv.globalScvIndex()); + const auto& posVolVars = this->elemVolVars()[posGlobalScv]; + const auto& posElement = iv.element(neighborScvIndices[0]); + const auto tensor = getT(this->problem(), posElement, posVolVars, this->fvGeometry(), posGlobalScv); + + // the omega factors of the "positive" sub volume + wijk[faceIdx][0] = computeMpfaTransmissibility(posLocalScv, curGlobalScvf, tensor, posVolVars.extrusionFactor()); + + // go over the coordinate directions in the positive sub volume + for (unsigned int localDir = 0; localDir < dim; localDir++) + { + const auto& otherLocalScvf = iv.localScvf( posLocalScv.scvfIdxLocal(localDir) ); + const auto otherLocalDofIdx = otherLocalScvf.localDofIndex(); + + // if we are not on a Dirichlet face, add entries associated with unknown face pressures + // i.e. in matrix C and maybe A (if current face is not a Dirichlet face) + if (!otherLocalScvf.isDirichlet()) + { + C[faceIdx][otherLocalDofIdx] -= wijk[faceIdx][0][localDir]; + if (!curIsDirichlet) + A[curLocalDofIdx][otherLocalDofIdx] -= wijk[faceIdx][0][localDir]; + } + // the current face is a Dirichlet face and creates entries in D & maybe B + else + { + D[faceIdx][otherLocalDofIdx] -= wijk[faceIdx][0][localDir]; + if (!curIsDirichlet) + B[curLocalDofIdx][otherLocalDofIdx] += wijk[faceIdx][0][localDir]; + } + + // add entries related to pressures at the scv centers (dofs) + const auto posScvLocalDofIdx = posLocalScv.localDofIndex(); + D[faceIdx][posScvLocalDofIdx] += wijk[faceIdx][0][localDir]; + + if (!curIsDirichlet) + B[curLocalDofIdx][posScvLocalDofIdx] -= wijk[faceIdx][0][localDir]; + } + + // If we are on an interior face, add values from negative sub volume + if (!curGlobalScvf.boundary()) + { + // loop over all the outside neighbors of this face and add entries + for (unsigned int idxInOutside = 0; idxInOutside < curGlobalScvf.numOutsideScvs(); ++idxInOutside) + { + const auto idxOnScvf = idxInOutside+1; + const auto& negLocalScv = iv.localScv( neighborScvIndices[idxOnScvf] ); + const auto& negGlobalScv = this->fvGeometry().scv(negLocalScv.globalScvIndex()); + const auto& negVolVars = this->elemVolVars()[negGlobalScv]; + const auto& negElement = iv.element( neighborScvIndices[idxOnScvf] ); + const auto negTensor = getT(this->problem(), negElement, negVolVars, this->fvGeometry(), negGlobalScv); + + // On surface grids, use outside face for "negative" transmissibility calculation + const auto& scvf = dim < dimWorld ? this->fvGeometry().flipScvf(curGlobalScvf.index(), idxInOutside) + : curGlobalScvf; + wijk[faceIdx][idxOnScvf] = computeMpfaTransmissibility(negLocalScv, scvf, negTensor, negVolVars.extrusionFactor()); + + // flip sign on surface grids (since we used the "outside" normal) + if (dim < dimWorld) + wijk[faceIdx][idxOnScvf] *= -1.0; + + // go over the coordinate directions in the positive sub volume + for (int localDir = 0; localDir < dim; localDir++) + { + const auto otherLocalScvfIdx = negLocalScv.scvfIdxLocal(localDir); + const auto& otherLocalScvf = iv.localScvf(otherLocalScvfIdx); + const auto otherLocalDofIdx = otherLocalScvf.localDofIndex(); + + if (!otherLocalScvf.isDirichlet()) + A[curLocalDofIdx][otherLocalDofIdx] += wijk[faceIdx][idxOnScvf][localDir]; + else + B[curLocalDofIdx][otherLocalDofIdx] -= wijk[faceIdx][idxOnScvf][localDir]; + + // add entries to matrix B + B[curLocalDofIdx][negLocalScv.localDofIndex()] += wijk[faceIdx][idxOnScvf][localDir]; + } + } + } + } + } + } +}; + +} // end namespace + +#endif diff --git a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh index 45aee970be..52dbd09b5b 100644 --- a/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh +++ b/dumux/multidomain/facet/cellcentered/tpfa/couplingmanager.hh @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -73,7 +74,7 @@ class FacetCouplingManager using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; template using GridView = typename FVGridGeometry::GridView; template using Element = typename GridView::template Codim<0>::Entity; - template using GridIndexType = typename GridView::IndexSet::IndexType; + template using GridIndexType = typename IndexTraits< GridView >::GridIndex; template using GridVariables = GetPropType, Properties::GridVariables>; template using GridVolumeVariables = typename GridVariables::GridVolumeVariables; diff --git a/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh b/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh index 910b5b10e4..df2697a615 100644 --- a/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh +++ b/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -73,8 +74,8 @@ public: const LowDimFVG& lowDimFvGridGeometry, const BulkFVG& bulkFvGridGeometry) { - using LowDimIndexType = typename LowDimFVG::GridView::IndexSet::IndexType; - using BulkIndexType = typename BulkFVG::GridView::IndexSet::IndexType; + using LowDimIndexType = typename IndexTraits::GridIndex; + using BulkIndexType = typename IndexTraits::GridIndex; const auto lowDimElemIdx = lowDimFvGridGeometry.elementMapper().index(lowDimElement); auto& lowDimData = this->couplingMap_(facetGridId, bulkGridId)[lowDimElemIdx]; diff --git a/dumux/multidomain/facet/codimonegridadapter.hh b/dumux/multidomain/facet/codimonegridadapter.hh index 536ea8589f..47e392ec00 100644 --- a/dumux/multidomain/facet/codimonegridadapter.hh +++ b/dumux/multidomain/facet/codimonegridadapter.hh @@ -26,9 +26,12 @@ #define DUMUX_FACETCOUPLING_CODIM_ONE_GRID_ADAPTER_HH #include + #include #include +#include + namespace Dumux { /*! @@ -50,7 +53,7 @@ class CodimOneGridAdapter using FacetGridView = typename Embeddings::template GridView; using FacetGridVertex = typename FacetGridView::template Codim::Entity; using FacetGridElement = typename FacetGridView::template Codim<0>::Entity; - using FacetGridIndexType = typename FacetGridView::IndexSet::IndexType; + using FacetGridIndexType = typename IndexTraits::GridIndex; // Extract some types of the bulk grid using BulkGridView = typename Embeddings::template GridView; @@ -59,7 +62,7 @@ class CodimOneGridAdapter using BulkGridElement = typename BulkGridView::template Codim<0>::Entity; using BulkGridIntersection = typename BulkGridView::Intersection; using BulkGridVertex = typename BulkGridView::template Codim::Entity; - using BulkIndexType = typename BulkGridView::IndexSet::IndexType; + using BulkIndexType = typename IndexTraits::GridIndex; // Find out if the given bulk grid is the one with highest dimensionality among the created grids static constexpr bool bulkHasHighestDimension = (int(BulkGridView::dimension) == Embeddings::bulkDim); diff --git a/dumux/multidomain/facet/couplingmanager.hh b/dumux/multidomain/facet/couplingmanager.hh index b6ffd6188f..16d4cce63f 100644 --- a/dumux/multidomain/facet/couplingmanager.hh +++ b/dumux/multidomain/facet/couplingmanager.hh @@ -25,6 +25,8 @@ #define DUMUX_FACETCOUPLING_MANAGER_HH #include +#include + #include #include #include @@ -133,7 +135,7 @@ class FacetCouplingThreeDomainManager template using FVGridGeometry = GetPropType, Properties::FVGridGeometry>; template using FVElementGeometry = typename FVGridGeometry::LocalView; template using GridView = typename FVGridGeometry::GridView; - template using IndexType = typename GridView::IndexSet::IndexType; + template using GridIndexType = typename IndexTraits>::GridIndex; template using Element = typename GridView::template Codim<0>::Entity; template using GridVariables = GetPropType, Properties::GridVariables>; @@ -237,7 +239,7 @@ public: evalCouplingResidual(Dune::index_constant domainI, const LocalAssembler& localAssembler, Dune::index_constant domainJ, - IndexType dofIdxGlobalJ) + GridIndexType dofIdxGlobalJ) { typename LocalResidual::ElementResidualVector res(1); res = 0.0; @@ -263,7 +265,7 @@ public: void updateCouplingContext(FacetIdType domainI, const FacetLocalAssembler& facetLocalAssembler, FacetIdType domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -283,7 +285,7 @@ public: void updateCouplingContext(Dune::index_constant domainI, const LocalAssembler& localAssembler, Dune::index_constant domainJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { /*do nothing here*/ } diff --git a/dumux/multidomain/facet/couplingmapperbase.hh b/dumux/multidomain/facet/couplingmapperbase.hh index e7e975b1f0..51be7248c2 100644 --- a/dumux/multidomain/facet/couplingmapperbase.hh +++ b/dumux/multidomain/facet/couplingmapperbase.hh @@ -29,6 +29,7 @@ #include #include +#include namespace Dumux { @@ -49,11 +50,11 @@ template< class BulkFVG, class FacetCouplingMapperBase { using BulkGridView = typename BulkFVG::GridView; - using BulkIndexType = typename BulkGridView::IndexSet::IndexType; + using BulkIndexType = typename IndexTraits::GridIndex; using LowDimGridView = typename LowDimFVG::GridView; using LowDimElement = typename LowDimGridView::template Codim<0>::Entity; - using LowDimIndexType = typename LowDimGridView::IndexSet::IndexType; + using LowDimIndexType = typename IndexTraits::GridIndex; // make sure the grid geometry combination makes sense static constexpr int bulkDim = BulkGridView::dimension; @@ -205,12 +206,12 @@ protected: //! Creates a container with the nodal dofs within an element template< class FVGridGeometry> - std::vector< typename FVGridGeometry::GridView::IndexSet::IndexType > + std::vector< typename IndexTraits::GridIndex > extractNodalDofs_(const typename FVGridGeometry::GridView::template Codim<0>::Entity& element, const FVGridGeometry& fvGridGeometry) { static constexpr int dim = FVGridGeometry::GridView::dimension; - using GridIndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; const auto numCorners = element.subEntities(dim); std::vector< GridIndexType > nodalDofs(numCorners); @@ -232,10 +233,10 @@ private: //! Creates the map from element insertion index to grid element index template< class Embeddings, class FVGridGeometry> - std::vector< typename FVGridGeometry::GridView::IndexSet::IndexType > + std::vector< typename IndexTraits::GridIndex > makeInsertionToGridIndexMap_(std::shared_ptr embeddings, const FVGridGeometry& fvGridGeometry) const { - using GridIndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; std::vector< GridIndexType > map(fvGridGeometry.gridView().size(0)); for (const auto& e : elements(fvGridGeometry.gridView())) diff --git a/dumux/multidomain/facet/enrichmenthelper.hh b/dumux/multidomain/facet/enrichmenthelper.hh index 4c633d9063..c8e89a53ba 100644 --- a/dumux/multidomain/facet/enrichmenthelper.hh +++ b/dumux/multidomain/facet/enrichmenthelper.hh @@ -37,6 +37,7 @@ #include #include +#include namespace Dumux { @@ -63,7 +64,7 @@ class VertexEnrichmentHelper using Intersection = typename GridView::Intersection; using ReferenceElements = typename Dune::ReferenceElements; using MCMGMapper = Dune::MultipleCodimMultipleGeomTypeMapper; - using GridIndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; diff --git a/dumux/multidomain/facet/gmshreader.hh b/dumux/multidomain/facet/gmshreader.hh index b472abab71..8dbd4ab741 100644 --- a/dumux/multidomain/facet/gmshreader.hh +++ b/dumux/multidomain/facet/gmshreader.hh @@ -35,6 +35,8 @@ #include #include +#include + namespace Dumux { /*! @@ -61,7 +63,7 @@ class FacetCouplingGmshReader static constexpr int bulkDim = BulkGrid::dimension; static constexpr int bulkDimWorld = BulkGrid::dimensionworld; using ctype = typename BulkGrid::ctype; - using GridIndexType = typename BulkGrid::LeafGridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits< typename BulkGrid::LeafGridView >::GridIndex; using GlobalPosition = Dune::FieldVector; // determine minimum dimension for which a grid is created diff --git a/dumux/multidomain/facet/gridmanager.hh b/dumux/multidomain/facet/gridmanager.hh index 44c0ed38bd..ab07a202ce 100644 --- a/dumux/multidomain/facet/gridmanager.hh +++ b/dumux/multidomain/facet/gridmanager.hh @@ -39,6 +39,7 @@ #include #include +#include #include #include "gmshreader.hh" @@ -162,7 +163,7 @@ class FacetCouplingEmbeddings template using GridFactory = typename Dune::GridFactory>; //! we use the bulk grid's index type here - using GIType = typename Grid<0>::LeafGridView::IndexSet::IndexType; + using GIType = typename IndexTraits< typename Grid<0>::LeafGridView >::GridIndex; //! the map type to store embedment data using EmbedmentMap = std::unordered_map>; diff --git a/dumux/multidomain/facet/vertexmapper.hh b/dumux/multidomain/facet/vertexmapper.hh index aee6692eb1..2750c0ed94 100644 --- a/dumux/multidomain/facet/vertexmapper.hh +++ b/dumux/multidomain/facet/vertexmapper.hh @@ -294,7 +294,7 @@ private: MCMGMapper vertexMapper_; //! unmodified vertex mapper bool hasEnrichedVertices_; //! keeps track of if vertices are enriched std::vector isEnriched_; //! keeps track which vertices are enriched - std::vector< std::vector > indexMap_; //! contains the new dof indices + std::vector< std::vector > indexMap_; //! contains the new dof indices }; } // end namespace Dumux -- GitLab From 7daf9226d13ba98a317b3ae39bbd128d99f9d85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 10:05:29 +0100 Subject: [PATCH 09/12] [discretization] use index traits class to obtain indices --- dumux/discretization/basefvgridgeometry.hh | 5 +- dumux/discretization/box/fvelementgeometry.hh | 11 ++-- dumux/discretization/box/fvgridgeometry.hh | 33 ++++++----- dumux/discretization/box/subcontrolvolume.hh | 7 ++- .../box/subcontrolvolumeface.hh | 5 +- .../cellcentered/connectivitymap.hh | 10 ++-- .../cellcentered/mpfa/dualgridindexset.hh | 5 +- .../cellcentered/mpfa/fvelementgeometry.hh | 5 +- .../cellcentered/mpfa/fvgridgeometry.hh | 5 +- .../mpfa/gridinteractionvolumeindexsets.hh | 2 +- .../cellcentered/mpfa/subcontrolvolumeface.hh | 7 ++- .../cellcentered/subcontrolvolume.hh | 8 ++- .../cellcentered/tpfa/fvelementgeometry.hh | 50 ++++++++-------- .../cellcentered/tpfa/fvgridgeometry.hh | 8 ++- .../cellcentered/tpfa/subcontrolvolumeface.hh | 5 +- dumux/discretization/fluxstencil.hh | 9 +-- .../staggered/freeflow/connectivitymap.hh | 21 +++---- .../freeflow/subcontrolvolumeface.hh | 8 ++- .../staggered/fvelementgeometry.hh | 36 ++++++----- .../staggered/fvgridgeometry.hh | 59 ++++++++++--------- .../staggered/subcontrolvolumeface.hh | 14 +++-- dumux/multidomain/staggeredcouplingmanager.hh | 6 +- 22 files changed, 178 insertions(+), 141 deletions(-) diff --git a/dumux/discretization/basefvgridgeometry.hh b/dumux/discretization/basefvgridgeometry.hh index 4f208835d9..129dd96d0d 100644 --- a/dumux/discretization/basefvgridgeometry.hh +++ b/dumux/discretization/basefvgridgeometry.hh @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -52,7 +53,7 @@ class BaseFVGridGeometry static constexpr int dim = GV::dimension; static constexpr int dimWorld = GV::dimensionworld; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using Element = typename GV::template Codim<0>::Entity; using SubControlVolume = typename Traits::SubControlVolume; @@ -161,7 +162,7 @@ public: { return elementMap()[scv.elementIndex()]; } //! Get an element from a global element index - Element element(IndexType eIdx) const + Element element(GridIndexType eIdx) const { return elementMap()[eIdx]; } /*! diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh index 665fbd0a67..9ecea90d7b 100644 --- a/dumux/discretization/box/fvelementgeometry.hh +++ b/dumux/discretization/box/fvelementgeometry.hh @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -52,7 +53,8 @@ class BoxFVElementGeometry using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; @@ -156,7 +158,7 @@ private: const Element* elementPtr_; const FVGridGeometry* fvGridGeometryPtr_; - typename GridView::IndexSet::IndexType eIdx_; + GridIndexType eIdx_; }; //! specialization in case the FVElementGeometries are not stored @@ -166,7 +168,8 @@ class BoxFVElementGeometry using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; @@ -347,7 +350,7 @@ private: //! The bound element const Element* elementPtr_; - typename GridView::IndexSet::IndexType eIdx_; + GridIndexType eIdx_; //! The global geometry this is a restriction of const FVGridGeometry* fvGridGeometryPtr_; diff --git a/dumux/discretization/box/fvgridgeometry.hh b/dumux/discretization/box/fvgridgeometry.hh index b6d0a3b803..85351e1e76 100644 --- a/dumux/discretization/box/fvgridgeometry.hh +++ b/dumux/discretization/box/fvgridgeometry.hh @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -83,7 +84,8 @@ class BoxFVGridGeometry { using ThisType = BoxFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GV::template Codim<0>::Entity; using CoordScalar = typename GV::ctype; @@ -182,7 +184,6 @@ public: // construct the sub control volumes scvs_[eIdx].resize(elementGeometry.corners()); - using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx) { const auto dofIdxGlobal = this->vertexMapper().subIndex(element, scvLocalIdx, dim); @@ -297,31 +298,31 @@ public: { return feCache_; } //! Get the local scvs for an element - const std::vector& scvs(IndexType eIdx) const + const std::vector& scvs(GridIndexType eIdx) const { return scvs_[eIdx]; } //! Get the local scvfs for an element - const std::vector& scvfs(IndexType eIdx) const + const std::vector& scvfs(GridIndexType eIdx) const { return scvfs_[eIdx]; } //! If a vertex / d.o.f. is on the boundary - bool dofOnBoundary(unsigned int dofIdx) const + bool dofOnBoundary(GridIndexType dofIdx) const { return boundaryDofIndices_[dofIdx]; } //! If a vertex / d.o.f. is on a periodic boundary - bool dofOnPeriodicBoundary(std::size_t dofIdx) const + bool dofOnPeriodicBoundary(GridIndexType dofIdx) const { return periodicVertexMap_.count(dofIdx); } //! The index of the vertex / d.o.f. on the other side of the periodic boundary - std::size_t periodicallyMappedDof(std::size_t dofIdx) const + GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const { return periodicVertexMap_.at(dofIdx); } //! Returns the map between dofs across periodic boundaries - const std::unordered_map& periodicVertexMap() const + const std::unordered_map& periodicVertexMap() const { return periodicVertexMap_; } //! Returns whether one of the geometry's scvfs lies on a boundary - bool hasBoundaryScvf(std::size_t eIdx) const + bool hasBoundaryScvf(GridIndexType eIdx) const { return hasBoundaryScvf_[eIdx]; } private: @@ -340,7 +341,7 @@ private: std::vector hasBoundaryScvf_; // a map for periodic boundary vertices - std::unordered_map periodicVertexMap_; + std::unordered_map periodicVertexMap_; }; /*! @@ -356,7 +357,7 @@ class BoxFVGridGeometry { using ThisType = BoxFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; static const int dim = GV::dimension; static const int dimWorld = GV::dimensionworld; @@ -501,19 +502,19 @@ public: { return feCache_; } //! If a vertex / d.o.f. is on the boundary - bool dofOnBoundary(std::size_t dofIdx) const + bool dofOnBoundary(GridIndexType dofIdx) const { return boundaryDofIndices_[dofIdx]; } //! If a vertex / d.o.f. is on a periodic boundary - bool dofOnPeriodicBoundary(std::size_t dofIdx) const + bool dofOnPeriodicBoundary(GridIndexType dofIdx) const { return periodicVertexMap_.count(dofIdx); } //! The index of the vertex / d.o.f. on the other side of the periodic boundary - std::size_t periodicallyMappedDof(std::size_t dofIdx) const + GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const { return periodicVertexMap_.at(dofIdx); } //! Returns the map between dofs across periodic boundaries - const std::unordered_map& periodicVertexMap() const + const std::unordered_map& periodicVertexMap() const { return periodicVertexMap_; } private: @@ -530,7 +531,7 @@ private: std::vector boundaryDofIndices_; // a map for periodic boundary vertices - std::unordered_map periodicVertexMap_; + std::unordered_map periodicVertexMap_; }; } // end namespace Dumux diff --git a/dumux/discretization/box/subcontrolvolume.hh b/dumux/discretization/box/subcontrolvolume.hh index 88eed544da..d9fab14136 100644 --- a/dumux/discretization/box/subcontrolvolume.hh +++ b/dumux/discretization/box/subcontrolvolume.hh @@ -26,9 +26,10 @@ #include +#include +#include #include #include -#include namespace Dumux { @@ -66,8 +67,8 @@ struct BoxDefaultScvGeometryTraits }; }; - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Scalar = typename Grid::ctype; using Geometry = Dune::MultiLinearGeometry>; using CornerStorage = typename ScvMLGTraits::template CornerStorage::Type; diff --git a/dumux/discretization/box/subcontrolvolumeface.hh b/dumux/discretization/box/subcontrolvolumeface.hh index 9eca2a0652..8652a2aefa 100644 --- a/dumux/discretization/box/subcontrolvolumeface.hh +++ b/dumux/discretization/box/subcontrolvolumeface.hh @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -68,8 +69,8 @@ struct BoxDefaultScvfGeometryTraits }; }; - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Scalar = typename Grid::ctype; using Geometry = Dune::MultiLinearGeometry>; using CornerStorage = typename ScvfMLGTraits::template CornerStorage::Type; diff --git a/dumux/discretization/cellcentered/connectivitymap.hh b/dumux/discretization/cellcentered/connectivitymap.hh index faf6ad07c2..707903afe9 100644 --- a/dumux/discretization/cellcentered/connectivitymap.hh +++ b/dumux/discretization/cellcentered/connectivitymap.hh @@ -32,6 +32,8 @@ #include #include + +#include #include namespace Dumux { @@ -51,13 +53,13 @@ class CCSimpleConnectivityMap { using FVElementGeometry = typename FVGridGeometry::LocalView; using GridView = typename FVGridGeometry::GridView; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using FluxStencil = Dumux::FluxStencil; static constexpr int maxElemStencilSize = FVGridGeometry::maxElementStencilSize; struct DataJ { - IndexType globalJ; + GridIndexType globalJ; typename FluxStencil::ScvfStencilIForJ scvfsJ; // A list of additional scvfs is needed for compatibility // reasons with more complex connectivity maps (see mpfa) @@ -79,7 +81,7 @@ public: map_.resize(fvGridGeometry.gridView().size(0)); // container to store for each element J the elements I which have J in their flux stencil - Dune::ReservedVector, maxElemStencilSize> dataJForI; + Dune::ReservedVector, maxElemStencilSize> dataJForI; for (const auto& element : elements(fvGridGeometry.gridView())) { @@ -125,7 +127,7 @@ public: } } - const std::vector& operator[] (const IndexType globalI) const + const std::vector& operator[] (const GridIndexType globalI) const { return map_[globalI]; } private: diff --git a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh index fcd012caaf..a851d98773 100644 --- a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh +++ b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh @@ -29,6 +29,7 @@ #include #include +#include namespace Dumux { @@ -43,8 +44,8 @@ template struct NodalIndexSetDefaultTraits { using GridView = GV; - using GridIndexType = typename GV::IndexSet::IndexType; - using LocalIndexType = std::uint8_t; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::SmallLocalIndex; //! per default, we use dynamic data containers (iv size unknown) template< class T > using NodalScvDataStorage = std::vector< T >; diff --git a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh index 56f8c37e31..b0f531a779 100644 --- a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh +++ b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh @@ -31,6 +31,7 @@ #include #include +#include #include namespace Dumux @@ -59,7 +60,7 @@ class CCMpfaFVElementGeometry using ThisType = CCMpfaFVElementGeometry; using GridView = typename GG::GridView; using Element = typename GridView::template Codim<0>::Entity; - using GridIndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; static constexpr int dim = GridView::dimension; @@ -175,7 +176,7 @@ class CCMpfaFVElementGeometry using ThisType = CCMpfaFVElementGeometry; using GridView = typename GG::GridView; using Element = typename GridView::template Codim<0>::Entity; - using GridIndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using MpfaHelper = typename GG::MpfaHelper; static const int dim = GridView::dimension; diff --git a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh index 8c73955c03..c97e5e9f8c 100644 --- a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -78,7 +79,7 @@ class CCMpfaFVGridGeometry using Element = typename GV::template Codim<0>::Entity; using Vertex = typename GV::template Codim::Entity; using Intersection = typename GV::Intersection; - using GridIndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using CoordScalar = typename GV::ctype; using ReferenceElements = typename Dune::ReferenceElements; @@ -448,7 +449,7 @@ class CCMpfaFVGridGeometry using Element = typename GV::template Codim<0>::Entity; using Vertex = typename GV::template Codim::Entity; using Intersection = typename GV::Intersection; - using GridIndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using CoordScalar = typename GV::ctype; using ReferenceElements = typename Dune::ReferenceElements; diff --git a/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh b/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh index 3f7020bc6a..bed60502bc 100644 --- a/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh +++ b/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh @@ -52,7 +52,7 @@ public: using PrimaryInteractionVolume = PI; using SecondaryInteractionVolume = SI; - using GridIndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; + using GridIndexType = typename NI::GridIndexType; using DualGridIndexSet = CCMpfaDualGridIndexSet< NI >; /*! diff --git a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh index 61e2538f14..30a0827046 100644 --- a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh +++ b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh @@ -26,11 +26,14 @@ #include #include + #include #include #include #include +#include + namespace Dumux { /*! @@ -48,8 +51,8 @@ struct CCMpfaDefaultScvfGeometryTraits static const int dimWorld = Grid::dimensionworld; using Scalar = typename Grid::ctype; - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using OutsideGridIndexStorage = typename std::conditional_t< (dim, Dune::ReservedVector >; diff --git a/dumux/discretization/cellcentered/subcontrolvolume.hh b/dumux/discretization/cellcentered/subcontrolvolume.hh index 7bb3627b28..08a94a881f 100644 --- a/dumux/discretization/cellcentered/subcontrolvolume.hh +++ b/dumux/discretization/cellcentered/subcontrolvolume.hh @@ -25,8 +25,10 @@ #define DUMUX_DISCRETIZATION_CC_SUBCONTROLVOLUME_HH #include -#include + #include +#include +#include namespace Dumux { @@ -40,8 +42,8 @@ template struct CCDefaultScvGeometryTraits { using Geometry = typename GridView::template Codim<0>::Geometry; - using GridIndexType = typename GridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Scalar = typename GridView::ctype; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; diff --git a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh index 3ccaf0ef02..4fd800e17c 100644 --- a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -59,7 +60,7 @@ class CCTpfaFVElementGeometry { using ThisType = CCTpfaFVElementGeometry; using GridView = typename GG::GridView; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using Element = typename GridView::template Codim<0>::Entity; public: @@ -80,21 +81,21 @@ public: //! Get an elment sub control volume with a global scv index //! We separate element and neighbor scvs to speed up mapping - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(GridIndexType scvIdx) const { return fvGridGeometry().scv(scvIdx); } //! Get an element sub control volume face with a global scvf index //! We separate element and neighbor scvfs to speed up mapping - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const { return fvGridGeometry().scvf(scvfIdx); } //! Get the scvf on the same face but from the other side //! Note that e.g. the normals might be different in the case of surface grids - const SubControlVolumeFace& flipScvf(IndexType scvfIdx, unsigned int outsideScvIdx = 0) const + const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvIdx = 0) const { return fvGridGeometry().flipScvf(scvfIdx, outsideScvIdx); } @@ -104,10 +105,10 @@ public: //! This is a free function found by means of ADL //! To iterate over all sub control volumes of this FVElementGeometry use //! for (auto&& scv : scvs(fvGeometry)) - friend inline Dune::IteratorRange< ScvIterator, ThisType> > + friend inline Dune::IteratorRange< ScvIterator, ThisType> > scvs(const CCTpfaFVElementGeometry& fvGeometry) { - using ScvIterator = Dumux::ScvIterator, ThisType>; + using ScvIterator = Dumux::ScvIterator, ThisType>; return Dune::IteratorRange(ScvIterator(fvGeometry.scvIndices_.begin(), fvGeometry), ScvIterator(fvGeometry.scvIndices_.end(), fvGeometry)); } @@ -117,12 +118,12 @@ public: //! This is a free function found by means of ADL //! To iterate over all sub control volume faces of this FVElementGeometry use //! for (auto&& scvf : scvfs(fvGeometry)) - friend inline Dune::IteratorRange< ScvfIterator, ThisType> > + friend inline Dune::IteratorRange< ScvfIterator, ThisType> > scvfs(const CCTpfaFVElementGeometry& fvGeometry) { const auto& g = fvGeometry.fvGridGeometry(); const auto scvIdx = fvGeometry.scvIndices_[0]; - using ScvfIterator = Dumux::ScvfIterator, ThisType>; + using ScvfIterator = Dumux::ScvfIterator, ThisType>; return Dune::IteratorRange(ScvfIterator(g.scvfIndicesOfScv(scvIdx).begin(), fvGeometry), ScvfIterator(g.scvfIndicesOfScv(scvIdx).end(), fvGeometry)); } @@ -163,7 +164,7 @@ public: private: const Element* elementPtr_; - std::array scvIndices_; + std::array scvIndices_; const FVGridGeometry* fvGridGeometryPtr_; }; @@ -177,7 +178,8 @@ class CCTpfaFVElementGeometry { using ThisType = CCTpfaFVElementGeometry; using GridView = typename GG::GridView; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GridView::template Codim<0>::Entity; static const int dim = GridView::dimension; @@ -201,7 +203,7 @@ public: //! Get an elment sub control volume with a global scv index //! We separate element and neighbor scvs to speed up mapping - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(GridIndexType scvIdx) const { if (scvIdx == scvIndices_[0]) return scvs_[0]; @@ -211,7 +213,7 @@ public: //! Get an element sub control volume face with a global scvf index //! We separate element and neighbor scvfs to speed up mapping - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const { auto it = std::find(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx); if (it != scvfIndices_.end()) @@ -222,7 +224,7 @@ public: //! Get the scvf on the same face but from the other side //! Note that e.g. the normals might be different in the case of surface grids - const SubControlVolumeFace& flipScvf(IndexType scvfIdx, unsigned int outsideScvIdx = 0) const + const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvIdx = 0) const { auto it = std::find(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx); if (it != scvfIndices_.end()) @@ -283,7 +285,7 @@ public: neighborScvfIndices_.reserve(element.subEntities(1)); neighborScvfs_.reserve(element.subEntities(1)); - std::vector handledNeighbors; + std::vector handledNeighbors; handledNeighbors.reserve(element.subEntities(1)); for (const auto& intersection : intersections(fvGridGeometry().gridView(), element)) @@ -361,7 +363,7 @@ public: private: - IndexType findFlippedScvfIndex_(IndexType insideScvIdx, IndexType globalOutsideScvIdx) + GridIndexType findFlippedScvfIndex_(GridIndexType insideScvIdx, GridIndexType globalOutsideScvIdx) { for (unsigned int localNeighborScvfIdx = 0; localNeighborScvfIdx < neighborScvfs_.size(); ++localNeighborScvfIdx) { @@ -440,7 +442,7 @@ private: } //! create the necessary scvs and scvfs of the neighbor elements to the bound elements - void makeNeighborGeometries(const Element& element, const IndexType eIdx) + void makeNeighborGeometries(const Element& element, const GridIndexType eIdx) { using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage; @@ -527,8 +529,8 @@ private: } } - const IndexType findLocalIndex(const IndexType idx, - const std::vector& indices) const + const LocalIndexType findLocalIndex(const GridIndexType idx, + const std::vector& indices) const { auto it = std::find(indices.begin(), indices.end(), idx); assert(it != indices.end() && "Could not find the scv/scvf! Make sure to properly bind this class!"); @@ -556,19 +558,19 @@ private: const FVGridGeometry* fvGridGeometryPtr_; //!< the grid fvgeometry // local storage after binding an element - std::array scvIndices_; + std::array scvIndices_; std::array scvs_; - std::vector scvfIndices_; + std::vector scvfIndices_; std::vector scvfs_; - std::vector> flippedScvfIndices_; + std::vector> flippedScvfIndices_; - std::vector neighborScvIndices_; + std::vector neighborScvIndices_; std::vector neighborScvs_; - std::vector neighborScvfIndices_; + std::vector neighborScvfIndices_; std::vector neighborScvfs_; - std::vector> flippedNeighborScvfIndices_; + std::vector> flippedNeighborScvfIndices_; bool hasBoundaryScvf_ = false; }; diff --git a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh index 1f9ddfa93a..fc58c93455 100644 --- a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh @@ -28,7 +28,9 @@ #include +#include #include + #include #include #include @@ -89,7 +91,7 @@ class CCTpfaFVGridGeometry using ThisType = CCTpfaFVGridGeometry; using ParentType = BaseFVGridGeometry; using ConnectivityMap = typename Traits::template ConnectivityMap; - using GridIndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using Element = typename GV::template Codim<0>::Entity; static const int dim = GV::dimension; @@ -366,7 +368,7 @@ class CCTpfaFVGridGeometry using ParentType = BaseFVGridGeometry; using ConnectivityMap = typename Traits::template ConnectivityMap; - using GridIndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; using Element = typename GV::template Codim<0>::Entity; static const int dim = GV::dimension; @@ -512,7 +514,7 @@ public: else if (intersection.boundary()) { scvfsIndexSet.push_back(numScvf_++); - neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({numScvs_ + numBoundaryScvf_++})); + neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({numScvs_ + GridIndexType(numBoundaryScvf_++)})); } } diff --git a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh index dbaca8db89..feee503674 100644 --- a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh +++ b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh @@ -32,6 +32,7 @@ #include #include +#include #include namespace Dumux { @@ -51,8 +52,8 @@ struct CCTpfaDefaultScvfGeometryTraits static constexpr int dimWorld = Grid::dimensionworld; using Scalar = typename Grid::ctype; - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using GridIndexStorage = typename std::conditional_t< (dim, Dune::ReservedVector >; diff --git a/dumux/discretization/fluxstencil.hh b/dumux/discretization/fluxstencil.hh index c601e6f1cc..030c7fc8d8 100644 --- a/dumux/discretization/fluxstencil.hh +++ b/dumux/discretization/fluxstencil.hh @@ -27,6 +27,7 @@ #include #include +#include #include namespace Dumux @@ -56,11 +57,11 @@ class FluxStencil using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; public: //! Each cell I couples to a cell J always only via one face - using ScvfStencilIForJ = Dune::ReservedVector; + using ScvfStencilIForJ = Dune::ReservedVector; //! The flux stencil type using Stencil = typename SubControlVolumeFace::Traits::GridIndexStorage; @@ -96,14 +97,14 @@ class FluxStencil using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; // Use the stencil type of the primary interaction volume using NodalIndexSet = typename FVGridGeometry::GridIVIndexSets::DualGridIndexSet::NodalIndexSet; public: //! We don't know yet how many faces couple to a neighboring element - using ScvfStencilIForJ = std::vector; + using ScvfStencilIForJ = std::vector; //! The flux stencil type using Stencil = typename NodalIndexSet::NodalGridStencilType; diff --git a/dumux/discretization/staggered/freeflow/connectivitymap.hh b/dumux/discretization/staggered/freeflow/connectivitymap.hh index f8d9605aae..7dd82723ad 100644 --- a/dumux/discretization/staggered/freeflow/connectivitymap.hh +++ b/dumux/discretization/staggered/freeflow/connectivitymap.hh @@ -25,6 +25,7 @@ #define DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH #include +#include namespace Dumux { @@ -41,17 +42,17 @@ class StaggeredFreeFlowConnectivityMap using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; using Element = typename GridView::template Codim<0>::Entity; - using IndexType = std::size_t; + using GridIndexType = typename IndexTraits::GridIndex; using CellCenterIdxType = typename FVGridGeometry::DofTypeIndices::CellCenterIdx; using FaceIdxType = typename FVGridGeometry::DofTypeIndices::FaceIdx; - using CellCenterToCellCenterMap = std::vector>; - using CellCenterToFaceMap = std::vector>; - using FaceToCellCenterMap = std::vector>; - using FaceToFaceMap = std::vector>; + using CellCenterToCellCenterMap = std::vector>; + using CellCenterToFaceMap = std::vector>; + using FaceToCellCenterMap = std::vector>; + using FaceToFaceMap = std::vector>; - using Stencil = std::vector; + using Stencil = std::vector; public: @@ -92,25 +93,25 @@ public: } //! Returns the stencil of a cell center dof w.r.t. other cell center dofs - const std::vector& operator() (CellCenterIdxType, CellCenterIdxType, const IndexType globalI) const + const std::vector& operator() (CellCenterIdxType, CellCenterIdxType, const GridIndexType globalI) const { return cellCenterToCellCenterMap_[globalI]; } //! Returns the stencil of a cell center dof w.r.t. face dofs - const std::vector& operator() (CellCenterIdxType, FaceIdxType, const IndexType globalI) const + const std::vector& operator() (CellCenterIdxType, FaceIdxType, const GridIndexType globalI) const { return cellCenterToFaceMap_[globalI]; } //! Returns the stencil of a face dof w.r.t. cell center dofs - const std::vector& operator() (FaceIdxType, CellCenterIdxType, const IndexType globalI) const + const std::vector& operator() (FaceIdxType, CellCenterIdxType, const GridIndexType globalI) const { return faceToCellCenterMap_[globalI]; } //! Returns the stencil of a face dof w.r.t. other face dofs - const std::vector& operator() (FaceIdxType, FaceIdxType, const IndexType globalI) const + const std::vector& operator() (FaceIdxType, FaceIdxType, const GridIndexType globalI) const { return faceToFaceMap_[globalI]; } diff --git a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh index 1444aaf5d5..d2e4662508 100644 --- a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh +++ b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -48,7 +49,8 @@ class FreeFlowStaggeredSubControlVolumeFace using ThisType = FreeFlowStaggeredSubControlVolumeFace; using ParentType = SubControlVolumeFaceBase; using Geometry = typename T::Geometry; - using GridIndexType = typename T::GridIndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Scalar = typename T::Scalar; static const int dim = Geometry::mydimension; @@ -192,7 +194,7 @@ public: } //! The local index of this sub control volume face - GridIndexType localFaceIdx() const + LocalIndexType localFaceIdx() const { return localFaceIdx_; } @@ -262,7 +264,7 @@ private: int dofIdxOpposingFace_; Scalar selfToOppositeDistance_; std::array, numPairs> pairData_; - int localFaceIdx_; + LocalIndexType localFaceIdx_; unsigned int dirIdx_; int outerNormalSign_; bool isGhostFace_; diff --git a/dumux/discretization/staggered/fvelementgeometry.hh b/dumux/discretization/staggered/fvelementgeometry.hh index e34dea10ff..72a807ebd7 100644 --- a/dumux/discretization/staggered/fvelementgeometry.hh +++ b/dumux/discretization/staggered/fvelementgeometry.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FV_ELEMENT_GEOMETRY_HH #define DUMUX_DISCRETIZATION_STAGGERED_FV_ELEMENT_GEOMETRY_HH +#include #include namespace Dumux { @@ -52,7 +53,9 @@ template class StaggeredFVElementGeometry : public CCTpfaFVElementGeometry { using ParentType = CCTpfaFVElementGeometry; - using IndexType = typename GG::GridView::IndexSet::IndexType; + using GridView = typename GG::GridView; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; public: //! export type of subcontrol volume face using SubControlVolumeFace = typename GG::SubControlVolumeFace; @@ -67,7 +70,7 @@ public: //! Get a sub control volume face with an element index and a local scvf index using ParentType::scvf; - const SubControlVolumeFace& scvf(IndexType eIdx, IndexType localScvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType eIdx, LocalIndexType localScvfIdx) const { return this->fvGridGeometry().scvf(eIdx, localScvfIdx); } @@ -86,7 +89,8 @@ class StaggeredFVElementGeometry { using ThisType = StaggeredFVElementGeometry; using GridView = typename GG::GridView; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GridView::template Codim<0>::Entity; public: //! export type of subcontrol volume @@ -107,14 +111,14 @@ public: : fvGridGeometryPtr_(&fvGridGeometry) {} //! Get a sub control volume face with an element index and a local scvf index - const SubControlVolumeFace& scvf(IndexType eIdx, IndexType localScvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType eIdx, LocalIndexType localScvfIdx) const { return scvf(this->fvGridGeometry().localToGlobalScvfIndex(eIdx, localScvfIdx)); } //! Get an elment sub control volume with a global scv index //! We separate element and neighbor scvs to speed up mapping - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(GridIndexType scvIdx) const { if (scvIdx == scvIndices_[0]) return scvs_[0]; @@ -124,7 +128,7 @@ public: //! Get an element sub control volume face with a global scvf index //! We separate element and neighbor scvfs to speed up mapping - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const { auto it = std::find(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx); if (it != scvfIndices_.end()) @@ -175,7 +179,7 @@ public: neighborScvfIndices_.reserve(element.subEntities(1)); neighborScvfs_.reserve(element.subEntities(1)); - std::vector handledNeighbors; + std::vector handledNeighbors; handledNeighbors.reserve(element.subEntities(1)); for (const auto& intersection : intersections(fvGridGeometry().gridView(), element)) { @@ -234,7 +238,7 @@ private: if (intersection.neighbor() || intersection.boundary()) { geometryHelper.updateLocalFace(fvGridGeometry().intersectionMapper(), intersection); - std::vector scvIndices{eIdx, scvfNeighborVolVarIndex}; + std::vector scvIndices{eIdx, scvfNeighborVolVarIndex}; scvfs_.emplace_back(intersection, intersection.geometry(), scvFaceIndices[scvfCounter], @@ -250,7 +254,7 @@ private: } //! create the necessary scvs and scvfs of the neighbor elements to the bound elements - void makeNeighborGeometries_(const Element& element, const IndexType eIdx) + void makeNeighborGeometries_(const Element& element, const GridIndexType eIdx) { // using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage; @@ -274,7 +278,7 @@ private: // only create subcontrol faces where the outside element is the bound element if (intersection.outside() == *elementPtr_) { - std::vector scvIndices{eIdx, scvfNeighborVolVarIndex}; + std::vector scvIndices{eIdx, scvfNeighborVolVarIndex}; neighborScvfs_.emplace_back(intersection, intersection.geometry(), scvFaceIndices[scvfCounter], @@ -290,8 +294,8 @@ private: } } - const IndexType findLocalIndex_(const IndexType idx, - const std::vector& indices) const + const LocalIndexType findLocalIndex_(const GridIndexType idx, + const std::vector& indices) const { auto it = std::find(indices.begin(), indices.end(), idx); assert(it != indices.end() && "Could not find the scv/scvf! Make sure to properly bind this class!"); @@ -316,16 +320,16 @@ private: const FVGridGeometry* fvGridGeometryPtr_; //!< the grid fvgeometry // local storage after binding an element - std::array scvIndices_; + std::array scvIndices_; std::array scvs_; - std::vector scvfIndices_; + std::vector scvfIndices_; std::vector scvfs_; - std::vector neighborScvIndices_; + std::vector neighborScvIndices_; std::vector neighborScvs_; - std::vector neighborScvfIndices_; + std::vector neighborScvfIndices_; std::vector neighborScvfs_; bool hasBoundaryScvf_ = false; diff --git a/dumux/discretization/staggered/fvgridgeometry.hh b/dumux/discretization/staggered/fvgridgeometry.hh index 8535d30fd5..6473ff374c 100644 --- a/dumux/discretization/staggered/fvgridgeometry.hh +++ b/dumux/discretization/staggered/fvgridgeometry.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY #define DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY +#include #include #include #include @@ -181,7 +182,8 @@ class StaggeredFVGridGeometry { using ThisType = StaggeredFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GV::template Codim<0>::Entity; using IntersectionMapper = typename Traits::IntersectionMapper; @@ -271,8 +273,8 @@ public: intersectionMapper_.update(); // determine size of containers - IndexType numScvs = this->gridView().size(0); - IndexType numScvf = 0; + std::size_t numScvs = this->gridView().size(0); + std::size_t numScvf = 0; for (const auto& element : elements(this->gridView())) numScvf += element.subEntities(1); @@ -284,7 +286,7 @@ public: hasBoundaryScvf_.resize(numScvs, false); // Build the scvs and scv faces - IndexType scvfIdx = 0; + GridIndexType scvfIdx = 0; numBoundaryScvf_ = 0; for (const auto& element : elements(this->gridView())) { @@ -297,7 +299,7 @@ public: scvs_[eIdx] = SubControlVolume(element.geometry(), eIdx); // the element-wise index sets for finite volume geometry - std::vector scvfsIndexSet; + std::vector scvfsIndexSet; scvfsIndexSet.reserve(numLocalFaces); GeometryHelper geometryHelper(element, this->gridView()); @@ -314,7 +316,7 @@ public: scvfs_.emplace_back(intersection, intersection.geometry(), scvfIdx, - std::vector({eIdx, nIdx}), + std::vector({eIdx, nIdx}), geometryHelper); localToGlobalScvfIndices_[eIdx][localFaceIndex] = scvfIdx; scvfsIndexSet.push_back(scvfIdx++); @@ -325,7 +327,7 @@ public: scvfs_.emplace_back(intersection, intersection.geometry(), scvfIdx, - std::vector({eIdx, this->gridView().size(0) + numBoundaryScvf_++}), + std::vector({eIdx, this->gridView().size(0) + numBoundaryScvf_++}), geometryHelper); localToGlobalScvfIndices_[eIdx][localFaceIndex] = scvfIdx; scvfsIndexSet.push_back(scvfIdx++); @@ -343,29 +345,29 @@ public: } //! Get a sub control volume with a global scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(GridIndexType scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a global scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const { return scvfs_[scvfIdx]; } //! Get the sub control volume face indices of an scv by global index - const std::vector& scvfIndicesOfScv(IndexType scvIdx) const + const std::vector& scvfIndicesOfScv(GridIndexType scvIdx) const { return scvfIndicesOfScv_[scvIdx]; } - IndexType localToGlobalScvfIndex(IndexType eIdx, IndexType localScvfIdx) const + GridIndexType localToGlobalScvfIndex(GridIndexType eIdx, LocalIndexType localScvfIdx) const { return localToGlobalScvfIndices_[eIdx][localScvfIdx]; } - const SubControlVolumeFace& scvf(IndexType eIdx ,IndexType localScvfIdx) const + const SubControlVolumeFace& scvf(GridIndexType eIdx, LocalIndexType localScvfIdx) const { return scvf(localToGlobalScvfIndex(eIdx, localScvfIdx)); } @@ -402,7 +404,7 @@ public: } //! Returns whether one of the geometry's scvfs lies on a boundary - bool hasBoundaryScvf(IndexType eIdx) const + bool hasBoundaryScvf(GridIndexType eIdx) const { return hasBoundaryScvf_[eIdx]; } private: @@ -413,9 +415,9 @@ private: std::vector scvs_; std::vector scvfs_; - std::vector> scvfIndicesOfScv_; - std::vector> localToGlobalScvfIndices_; - IndexType numBoundaryScvf_; + std::vector> scvfIndicesOfScv_; + std::vector> localToGlobalScvfIndices_; + GridIndexType numBoundaryScvf_; std::vector hasBoundaryScvf_; }; @@ -431,7 +433,8 @@ class StaggeredFVGridGeometry { using ThisType = StaggeredFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Element = typename GV::template Codim<0>::Entity; using IntersectionMapper = typename Traits::IntersectionMapper; @@ -500,11 +503,11 @@ public: // the element-wise index sets for finite volume geometry auto numLocalFaces = intersectionMapper_.numFaces(element); - std::vector scvfsIndexSet; + std::vector scvfsIndexSet; scvfsIndexSet.reserve(numLocalFaces); localToGlobalScvfIndices_[eIdx].resize(numLocalFaces); - std::vector neighborVolVarIndexSet; + std::vector neighborVolVarIndexSet; neighborVolVarIndexSet.reserve(numLocalFaces); for (const auto& intersection : intersections(this->gridView(), element)) @@ -565,10 +568,10 @@ public: std::size_t numFaceDofs() const { return this->gridView().size(1); } - const std::vector& scvfIndicesOfScv(IndexType scvIdx) const + const std::vector& scvfIndicesOfScv(GridIndexType scvIdx) const { return scvfIndicesOfScv_[scvIdx]; } - IndexType localToGlobalScvfIndex(IndexType eIdx, IndexType localScvfIdx) const + GridIndexType localToGlobalScvfIndex(GridIndexType eIdx, LocalIndexType localScvfIdx) const { return localToGlobalScvfIndices_[eIdx][localScvfIdx]; } @@ -611,24 +614,24 @@ public: } //! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx - const std::vector& neighborVolVarIndices(IndexType scvIdx) const + const std::vector& neighborVolVarIndices(GridIndexType scvIdx) const { return neighborVolVarIndices_[scvIdx]; } private: //! Information on the global number of geometries - IndexType numScvs_; - IndexType numScvf_; - IndexType numBoundaryScvf_; - std::vector> localToGlobalScvfIndices_; - std::vector> neighborVolVarIndices_; + std::size_t numScvs_; + std::size_t numScvf_; + std::size_t numBoundaryScvf_; + std::vector> localToGlobalScvfIndices_; + std::vector> neighborVolVarIndices_; // mappers ConnectivityMap connectivityMap_; IntersectionMapper intersectionMapper_; //! vectors that store the global data - std::vector> scvfIndicesOfScv_; + std::vector> scvfIndicesOfScv_; }; } // end namespace diff --git a/dumux/discretization/staggered/subcontrolvolumeface.hh b/dumux/discretization/staggered/subcontrolvolumeface.hh index aab84338e8..12451821d3 100644 --- a/dumux/discretization/staggered/subcontrolvolumeface.hh +++ b/dumux/discretization/staggered/subcontrolvolumeface.hh @@ -28,8 +28,9 @@ #include #include -#include #include +#include +#include #include @@ -97,8 +98,8 @@ template struct StaggeredDefaultScvfGeometryTraits { using Geometry = typename GridView::template Codim<1>::Geometry; - using GridIndexType = typename GridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; + using GridIndexType = typename IndexTraits::GridIndex; + using LocalIndexType = typename IndexTraits::LocalIndex; using Scalar = typename GridView::ctype; using GlobalPosition = Dune::FieldVector; }; @@ -117,6 +118,7 @@ class StaggeredSubControlVolumeFace using ParentType = SubControlVolumeFaceBase; using Geometry = typename T::Geometry; using GridIndexType = typename T::GridIndexType; + using LocalIndexType = typename T::LocalIndexType; using Scalar = typename T::Scalar; static const int dim = Geometry::mydimension; @@ -231,7 +233,7 @@ public: } //! The local index of this sub control volume face - GridIndexType localFaceIdx() const + LocalIndexType localFaceIdx() const { return localFaceIdx_; } @@ -246,8 +248,8 @@ private: std::vector scvIndices_; bool boundary_; - int dofIdx_; - int localFaceIdx_; + GridIndexType dofIdx_; + LocalIndexType localFaceIdx_; }; } // end namespace Dumux diff --git a/dumux/multidomain/staggeredcouplingmanager.hh b/dumux/multidomain/staggeredcouplingmanager.hh index acea2704d0..eccbaf845f 100644 --- a/dumux/multidomain/staggeredcouplingmanager.hh +++ b/dumux/multidomain/staggeredcouplingmanager.hh @@ -27,6 +27,7 @@ #include #include +#include #include namespace Dumux { @@ -53,8 +54,9 @@ class StaggeredCouplingManagerBase: public CouplingManager using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GridView<0>::template Codim<0>::Entity; - using CouplingStencils = std::unordered_map >; - using CouplingStencil = CouplingStencils::mapped_type; + using GridIndexType = typename IndexTraits< GridView<0> >::GridIndex; + using CouplingStencils = std::unordered_map >; + using CouplingStencil = typename CouplingStencils::mapped_type; public: -- GitLab From f76a96433bffa982e6fbd7a6214daa50a4a12d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 11:32:42 +0100 Subject: [PATCH 10/12] [tpfa][fvgridgeom] avoid compiler warning of narrowing conversion --- dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh index fc58c93455..24942d23a7 100644 --- a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh @@ -254,7 +254,7 @@ public: scvfs_.emplace_back(intersection, intersection.geometry(), scvfIdx, - ScvfGridIndexStorage({eIdx, this->gridView().size(0) + numBoundaryScvf_++}), + ScvfGridIndexStorage({eIdx, static_cast(this->gridView().size(0) + numBoundaryScvf_++)}), true); scvfsIndexSet.push_back(scvfIdx++); @@ -514,7 +514,7 @@ public: else if (intersection.boundary()) { scvfsIndexSet.push_back(numScvf_++); - neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({numScvs_ + GridIndexType(numBoundaryScvf_++)})); + neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({static_cast(numScvs_ + numBoundaryScvf_++)})); } } -- GitLab From c67c8ac593d6ce6f74ce74dc3dc919fe7cd60c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= Date: Tue, 27 Nov 2018 11:34:13 +0100 Subject: [PATCH 11/12] [box][fvelemgeom] reuse element index instead of obtaining twice --- dumux/discretization/box/fvelementgeometry.hh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh index 9ecea90d7b..ef8cd290cd 100644 --- a/dumux/discretization/box/fvelementgeometry.hh +++ b/dumux/discretization/box/fvelementgeometry.hh @@ -276,7 +276,6 @@ private: void makeElementGeometries(const Element& element) { - auto eIdx = fvGridGeometry().elementMapper().index(element); hasBoundaryScvf_ = false; // get the element geometry @@ -296,7 +295,7 @@ private: // add scv to the local container scvs_[scvLocalIdx] = SubControlVolume(geometryHelper, scvLocalIdx, - eIdx, + eIdx_, dofIdxGlobal); } -- GitLab From ce64df61921c538e262e955624c52ac7c209ce92 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Sun, 9 Dec 2018 15:55:29 +0100 Subject: [PATCH 12/12] [cleanup] Replace all IndexType aliases --- dumux/common/intersectionmapper.hh | 10 +++++----- .../poroelastic/couplingmanager.hh | 16 ++++++++-------- .../boxdfm/fluxvariablescache.hh | 6 +++--- .../boxdfm/fvelementgeometry.hh | 18 +++++++++--------- .../porousmediumflow/boxdfm/fvgridgeometry.hh | 12 ++++++------ .../porousmediumflow/boxdfm/vtkoutputmodule.hh | 16 ++++++++-------- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/dumux/common/intersectionmapper.hh b/dumux/common/intersectionmapper.hh index a2067d2cae..6c32d6c4e0 100644 --- a/dumux/common/intersectionmapper.hh +++ b/dumux/common/intersectionmapper.hh @@ -41,7 +41,7 @@ template class ConformingGridIntersectionMapper { using Element = typename GridView::template Codim<0>::Entity; - using IndexType = unsigned int; + using GridIndexType = typename GridView::IndexSet::IndexType; static constexpr int codimIntersection = 1; public: @@ -68,7 +68,7 @@ public: return element.subEntities(1); } - IndexType globalIntersectionIndex(const Element& element, const IndexType localFaceIdx) const + GridIndexType globalIntersectionIndex(const Element& element, const std::size_t localFaceIdx) const { return gridView_.indexSet().subIndex(element, localFaceIdx, codimIntersection); } @@ -87,7 +87,7 @@ class NonConformingGridIntersectionMapper { using Element = typename GridView::template Codim<0>::Entity; using Intersection = typename GridView::Intersection; - using IndexType = unsigned int; + using GridIndexType = typename GridView::IndexSet::IndexType; public: NonConformingGridIntersectionMapper(const GridView& gridview) @@ -104,7 +104,7 @@ public: return numIntersections_; } - IndexType globalIntersectionIndex(const Element& element, const IndexType localFaceIdx) const + GridIndexType globalIntersectionIndex(const Element& element, const std::size_t localFaceIdx) const { return (intersectionMapGlobal_[index(element)].find(localFaceIdx))->second; //use find() for const function! } @@ -165,7 +165,7 @@ public: } private: - IndexType index(const Element& element) const + GridIndexType index(const Element& element) const { return gridView_.indexSet().index(element); } diff --git a/dumux/geomechanics/poroelastic/couplingmanager.hh b/dumux/geomechanics/poroelastic/couplingmanager.hh index 580c30231a..29cfddedda 100644 --- a/dumux/geomechanics/poroelastic/couplingmanager.hh +++ b/dumux/geomechanics/poroelastic/couplingmanager.hh @@ -73,7 +73,7 @@ class PoroMechanicsCouplingManager : public virtual CouplingManager< MDTraits > template using FVGridGeometry = typename GridVariables::GridGeometry; template using FVElementGeometry = typename FVGridGeometry::LocalView; template using GridView = typename FVGridGeometry::GridView; - template using IndexType = typename GridView::IndexSet::IndexType; + template using GridIndexType = typename GridView::IndexSet::IndexType; template using Element = typename GridView::template Codim<0>::Entity; template using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -96,8 +96,8 @@ class PoroMechanicsCouplingManager : public virtual CouplingManager< MDTraits > //! Types used for coupling stencils template using CouplingIndexType = typename std::conditional< id == PMFlowId, - IndexType, - IndexType >::type; + GridIndexType, + GridIndexType >::type; /*! * \brief Porous medium flow domain data required for the residual calculation of an @@ -208,7 +208,7 @@ public: void updateCouplingContext(Dune::index_constant poroMechDomainId, const PoroMechLocalAssembler& poroMechLocalAssembler, Dune::index_constant pmFlowDomainId, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -231,7 +231,7 @@ public: void updateCouplingContext(Dune::index_constant poroMechDomainIdI, const PoroMechLocalAssembler& poroMechLocalAssembler, Dune::index_constant poroMechDomainIdJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -252,7 +252,7 @@ public: void updateCouplingContext(Dune::index_constant pmFlowDomainId, const PMFlowLocalAssembler& pmFlowLocalAssembler, Dune::index_constant domainIdJ, - IndexType dofIdxGlobalJ, + GridIndexType dofIdxGlobalJ, const PrimaryVariables& priVarsJ, unsigned int pvIdxJ) { @@ -312,7 +312,7 @@ public: evalCouplingResidual(Dune::index_constant pmFlowDomainId, const PMFlowLocalAssembler& pmFlowLocalAssembler, Dune::index_constant poroMechDomainId, - IndexType dofIdxGlobalJ) + GridIndexType dofIdxGlobalJ) { auto res = pmFlowLocalAssembler.localResidual().evalFluxAndSource(pmFlowLocalAssembler.element(), pmFlowLocalAssembler.fvGeometry(), @@ -341,7 +341,7 @@ public: evalCouplingResidual(Dune::index_constant poroMechDomainId, const PoroMechLocalAssembler& pmFlowLocalAssembler, Dune::index_constant pmFlowDomainId, - IndexType dofIdxGlobalJ) + GridIndexType dofIdxGlobalJ) { return pmFlowLocalAssembler.localResidual().evalFluxAndSource(pmFlowLocalAssembler.element(), pmFlowLocalAssembler.fvGeometry(), diff --git a/dumux/porousmediumflow/boxdfm/fluxvariablescache.hh b/dumux/porousmediumflow/boxdfm/fluxvariablescache.hh index 3b49c4dffe..6e447becc4 100644 --- a/dumux/porousmediumflow/boxdfm/fluxvariablescache.hh +++ b/dumux/porousmediumflow/boxdfm/fluxvariablescache.hh @@ -50,9 +50,9 @@ class BoxDfmFluxVariablesCache using ElementVolumeVariables = typename GetPropType::LocalView; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GridView::template Codim<0>::Entity; - using IndexType = typename GridView::IndexSet::IndexType; - using Stencil = std::vector; - using TransmissibilityVector = std::vector; + using GridIndexType = typename GridView::IndexSet::IndexType; + using Stencil = std::vector; + using TransmissibilityVector = std::vector; using CoordScalar = typename GridView::ctype; static const int dim = GridView::dimension; diff --git a/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh b/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh index adf03caf59..a513c682aa 100644 --- a/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh +++ b/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh @@ -53,7 +53,7 @@ class BoxDfmFVElementGeometry using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; @@ -74,11 +74,11 @@ public: : fvGridGeometryPtr_(&fvGridGeometry) {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(std::size_t scvIdx) const { return fvGridGeometry().scvs(eIdx_)[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(std::size_t scvfIdx) const { return fvGridGeometry().scvfs(eIdx_)[scvfIdx]; } //! iterator range for sub control volumes. Iterates over @@ -143,7 +143,7 @@ public: private: const Element* elementPtr_; const FVGridGeometry* fvGridGeometryPtr_; - IndexType eIdx_; + GridIndexType eIdx_; }; //! specialization in case the FVElementGeometries are not stored @@ -154,7 +154,7 @@ class BoxDfmFVElementGeometry static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; - using IndexType = typename GridView::IndexSet::IndexType; + using GridIndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename GridView::ctype; @@ -181,11 +181,11 @@ public: : fvGridGeometryPtr_(&fvGridGeometry) {} //! Get a sub control volume with a local scv index - const SubControlVolume& scv(IndexType scvIdx) const + const SubControlVolume& scv(std::size_t scvIdx) const { return scvs_[scvIdx]; } //! Get a sub control volume face with a local scvf index - const SubControlVolumeFace& scvf(IndexType scvfIdx) const + const SubControlVolumeFace& scvf(std::size_t scvfIdx) const { return scvfs_[scvfIdx]; } //! iterator range for sub control volumes. Iterates over @@ -315,7 +315,7 @@ private: const auto numCorners = isGeometry.corners(); const auto idxInInside = intersection.indexInInside(); - std::vector isVertexIndices(numCorners); + std::vector isVertexIndices(numCorners); for (unsigned int vIdxLocal = 0; vIdxLocal < numCorners; ++vIdxLocal) isVertexIndices[vIdxLocal] = fvGridGeometry().vertexMapper().subIndex(element, referenceElement.subEntity(idxInInside, 1, vIdxLocal, dim), @@ -410,7 +410,7 @@ private: //! The bound element const Element* elementPtr_; - IndexType eIdx_; + GridIndexType eIdx_; //! The global geometry this is a restriction of const FVGridGeometry* fvGridGeometryPtr_; diff --git a/dumux/porousmediumflow/boxdfm/fvgridgeometry.hh b/dumux/porousmediumflow/boxdfm/fvgridgeometry.hh index 5d2184a513..c9c66bdfb2 100644 --- a/dumux/porousmediumflow/boxdfm/fvgridgeometry.hh +++ b/dumux/porousmediumflow/boxdfm/fvgridgeometry.hh @@ -92,7 +92,7 @@ class BoxDfmFVGridGeometry { using ThisType = BoxDfmFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename GV::IndexSet::IndexType; using Element = typename GV::template Codim<0>::Entity; using CoordScalar = typename GV::ctype; @@ -234,7 +234,7 @@ public: const auto numCorners = isGeometry.corners(); const auto idxInInside = intersection.indexInInside(); - std::vector isVertexIndices(numCorners); + std::vector isVertexIndices(numCorners); for (unsigned int vIdxLocal = 0; vIdxLocal < numCorners; ++vIdxLocal) isVertexIndices[vIdxLocal] = this->vertexMapper().subIndex(element, referenceElement.subEntity(idxInInside, 1, vIdxLocal, dim), @@ -349,9 +349,9 @@ public: //! The finite element cache for creating local FE bases const FeCache& feCache() const { return feCache_; } //! Get the local scvs for an element - const std::vector& scvs(IndexType eIdx) const { return scvs_[eIdx]; } + const std::vector& scvs(GridIndexType eIdx) const { return scvs_[eIdx]; } //! Get the local scvfs for an element - const std::vector& scvfs(IndexType eIdx) const { return scvfs_[eIdx]; } + const std::vector& scvfs(GridIndexType eIdx) const { return scvfs_[eIdx]; } //! If a vertex / d.o.f. is on the boundary bool dofOnBoundary(unsigned int dofIdx) const { return boundaryDofIndices_[dofIdx]; } //! If a vertex / d.o.f. is on a fracture @@ -396,7 +396,7 @@ class BoxDfmFVGridGeometry { using ThisType = BoxDfmFVGridGeometry; using ParentType = BaseFVGridGeometry; - using IndexType = typename GV::IndexSet::IndexType; + using GridIndexType = typename GV::IndexSet::IndexType; static const int dim = GV::dimension; static const int dimWorld = GV::dimensionworld; @@ -484,7 +484,7 @@ public: const auto numCorners = isGeometry.corners(); const auto idxInInside = intersection.indexInInside(); - std::vector isVertexIndices(numCorners); + std::vector isVertexIndices(numCorners); for (unsigned int vIdxLocal = 0; vIdxLocal < numCorners; ++vIdxLocal) isVertexIndices[vIdxLocal] = this->vertexMapper().subIndex(element, referenceElement.subEntity(idxInInside, 1, vIdxLocal, dim), diff --git a/dumux/porousmediumflow/boxdfm/vtkoutputmodule.hh b/dumux/porousmediumflow/boxdfm/vtkoutputmodule.hh index 87638790bb..0e6a8530b2 100644 --- a/dumux/porousmediumflow/boxdfm/vtkoutputmodule.hh +++ b/dumux/porousmediumflow/boxdfm/vtkoutputmodule.hh @@ -69,7 +69,7 @@ class BoxDfmVtkOutputModule : public VtkOutputModule::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using ReferenceElements = typename Dune::ReferenceElements; @@ -503,7 +503,7 @@ private: // insert fracture elements std::size_t fractureElementCount = 0; fractureElementMap_.resize(gridView.size(0)); - std::set< std::pair > handledFacets; + std::set< std::pair > handledFacets; for (const auto& element : elements(gridView)) { const auto eIdxGlobal = fvGridGeometry.elementMapper().index(element); @@ -516,7 +516,7 @@ private: const auto numCorners = isGeometry.corners(); const auto indexInInside = is.indexInInside(); - std::vector isVertexIndices(numCorners); + std::vector isVertexIndices(numCorners); for (unsigned int i = 0; i < numCorners; ++i) isVertexIndices[i] = fvGridGeometry.vertexMapper().subIndex(element, referenceElement.subEntity(indexInInside, 1, i, dim), @@ -572,13 +572,13 @@ private: fractureElementMapper_ = std::make_unique(fractureGridView, Dune::mcmgElementLayout()); // obtain map fracture insertion indices -> fracture grid indices - std::vector insToVertexIdx(fractureGridView.size(FractureGridView::dimension)); - std::vector insToElemIdx(fractureGridView.size(0)); + std::vector insToVertexIdx(fractureGridView.size(FractureGridView::dimension)); + std::vector insToElemIdx(fractureGridView.size(0)); for (const auto& v : vertices(fractureGridView)) insToVertexIdx[ gridFactory.insertionIndex(v) ] = fractureVertexMapper_->index(v); for (const auto& e : elements(fractureGridView)) insToElemIdx[ gridFactory.insertionIndex(e) ] = fractureElementMapper_->index(e); // update vertex index map - for (IndexType dofIdx = 0; dofIdx < gridView.size(GridView::dimension); ++dofIdx) + for (GridIndexType dofIdx = 0; dofIdx < gridView.size(GridView::dimension); ++dofIdx) if (fvGridGeometry.dofOnFracture(dofIdx)) vertexToFractureVertexIdx_[dofIdx] = insToVertexIdx[ vertexToFractureVertexIdx_[dofIdx] ]; @@ -601,10 +601,10 @@ private: std::unique_ptr< Dune::VTKSequenceWriter > fractureSequenceWriter_; // maps to a bulk grid vertex the vertex index within the fracture grid - std::vector vertexToFractureVertexIdx_; + std::vector vertexToFractureVertexIdx_; // maps to the local facet indices of an element the corresponding fracture element indices - std::vector< std::vector> > fractureElementMap_; + std::vector< std::vector> > fractureElementMap_; }; } // end namespace Dumux -- GitLab