diff --git a/dumux/discretization/cellcentered/subcontrolvolume.hh b/dumux/discretization/cellcentered/subcontrolvolume.hh index 6a7c2e3e76706827d69bf1f4c1d003eb8f537b22..01957c3483b1884000bb205be5fea3d17717e33a 100644 --- a/dumux/discretization/cellcentered/subcontrolvolume.hh +++ b/dumux/discretization/cellcentered/subcontrolvolume.hh @@ -47,7 +47,7 @@ public: // the contructor in the cc case CCSubControlVolume(Geometry&& geometry, IndexType elementIndex) - : ParentType(), geometry_(std::move(geometry)), elementIndex_(elementIndex) {} + : ParentType(), geometry_(std::forward<Geometry>(geometry)), elementIndex_(elementIndex) {} //! The copy constrcutor CCSubControlVolume(const CCSubControlVolume& other) = default; @@ -95,6 +95,7 @@ public: // e.g. for integration const Geometry& geometry() const { + assert((geometry_)); return geometry_.value(); } diff --git a/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh b/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh index 1bc826d074084495155bdb3dd3a640486f3e2823..8a6c442dc82e6ed0399d00016705e62a1dd564b5 100644 --- a/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh +++ b/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh @@ -117,6 +117,8 @@ public: const FVElementGeometry& fvGeometry, const SolutionVector& sol) { + clear(); + const auto& problem = globalVolVars().problem_(); const auto globalI = problem.elementMapper().index(element); const auto& assemblyMapI = problem.model().localJacobian().assemblyMap()[globalI]; @@ -201,6 +203,8 @@ public: const FVElementGeometry& fvGeometry, const SolutionVector& sol) { + clear(); + auto eIdx = globalVolVars().problem_().elementMapper().index(element); volumeVariables_.resize(1); volVarIndices_.resize(1); @@ -230,6 +234,12 @@ public: const GlobalVolumeVariables& globalVolVars() const { return *globalVolVarsPtr_; } + //! Clear all local storage + void clear() + { + volVarIndices_.clear(); + volumeVariables_.clear(); + } private: const GlobalVolumeVariables* globalVolVarsPtr_; diff --git a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh index 7d2981bfe771c7c58c808fb24d1e136b0dceeb74..26a361cabd169fb16410b4de1498a277f3bc8d02 100644 --- a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh @@ -499,17 +499,20 @@ private: } + //! Clear all local data void clear() { scvIndices_.clear(); scvfIndices_.clear(); scvs_.clear(); scvfs_.clear(); + flippedScvfIndices_.clear(); neighborScvIndices_.clear(); neighborScvfIndices_.clear(); neighborScvs_.clear(); neighborScvfs_.clear(); + flippedNeighborScvfIndices_.clear(); } // the bound element diff --git a/dumux/discretization/cellcentered/tpfa/globalfvgeometry.hh b/dumux/discretization/cellcentered/tpfa/globalfvgeometry.hh index 7e48089aeae5ee7c4cfebaaa1de2392d33640e23..4175c9c97790e77164e83fb88d254444158cbb22 100644 --- a/dumux/discretization/cellcentered/tpfa/globalfvgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/globalfvgeometry.hh @@ -107,6 +107,7 @@ public: scvs_.clear(); scvfs_.clear(); scvfIndicesOfScv_.clear(); + flipScvfIndices_.clear(); elementMap_.clear(); // determine size of containers @@ -351,7 +352,11 @@ public: void update(const Problem& problem) { problemPtr_ = &problem; + + // clear local data elementMap_.clear(); + scvfIndicesOfScv_.clear(); + neighborVolVarIndices_.clear(); // reserve memory or resize the containers numScvs_ = gridView_.size(0); diff --git a/dumux/implicit/cellcentered/assemblymap.hh b/dumux/implicit/cellcentered/assemblymap.hh index eaf1ee205d8ffba74960161ea98ad8f6cdfdc363..606a61d8a7b0f421cdc909d5814c2e65dbc56154 100644 --- a/dumux/implicit/cellcentered/assemblymap.hh +++ b/dumux/implicit/cellcentered/assemblymap.hh @@ -71,6 +71,7 @@ public: */ void init(const Problem& problem) { + map_.clear(); map_.resize(problem.gridView().size(0)); for (const auto& element : elements(problem.gridView())) { @@ -102,7 +103,9 @@ public: if (it != dataJForI.end()) it->second.scvfsJ.push_back(scvf.index()); else - dataJForI.emplace_back(std::make_pair(globalI, DataJ({globalJ, std::vector<IndexType>({scvf.index()})}))); + dataJForI.emplace_back(std::make_pair(globalI, DataJ({globalJ, + std::vector<IndexType>({scvf.index()}), + std::vector<IndexType>()}))); } }