Commit 31ccc3b9 authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

[mpfa][iavol] remove stencil method and store global scvf indices

The stencil method is not necessary in the interaction volumes.
Furthermore, we store the global scvf indices and return a const reference
instead of copying every time.
parent efdbf9a9
...@@ -56,10 +56,6 @@ public: ...@@ -56,10 +56,6 @@ public:
void solveLocalSystem(const GetTensorFunction& getTensor) void solveLocalSystem(const GetTensorFunction& getTensor)
{ DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a solveLocalSystem() method."); } { DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a solveLocalSystem() method."); }
//! returns the dof indices in the stencil of the interaction volume
const GlobalIndexSet& stencil() const
{ DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a stencil() method."); }
//! returns the indices of the volvars in the stencil of the interaction volume //! returns the indices of the volvars in the stencil of the interaction volume
const GlobalIndexSet& volVarsStencil() const const GlobalIndexSet& volVarsStencil() const
{ DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a volVarsStencil() method."); } { DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a volVarsStencil() method."); }
...@@ -69,7 +65,7 @@ public: ...@@ -69,7 +65,7 @@ public:
{ DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a volVarsPositions() method."); } { DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a volVarsPositions() method."); }
//! returns a list of global scvf indices that are connected to this interaction volume //! returns a list of global scvf indices that are connected to this interaction volume
GlobalIndexSet globalScvfs() const const GlobalIndexSet& globalScvfs() const
{ DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a globalScvfs() method."); } { DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a globalScvfs() method."); }
//! returns the local index of an scvf in the IV and a boolean whether or not it is on the negative side of the local scvf (flux has to be inverted) //! returns the local index of an scvf in the IV and a boolean whether or not it is on the negative side of the local scvf (flux has to be inverted)
......
...@@ -142,7 +142,8 @@ public: ...@@ -142,7 +142,8 @@ public:
: problemRef_(problem), : problemRef_(problem),
fvGeometryRef_(fvGeometry), fvGeometryRef_(fvGeometry),
elemVolVarsRef_(elemVolVars), elemVolVarsRef_(elemVolVars),
onBoundary_(seed.onBoundary()) onBoundary_(seed.onBoundary()),
globalScvfIndices_(seed.globalScvfIndices())
{ {
// create local sub control entities from the seed // create local sub control entities from the seed
createLocalEntities_(seed); createLocalEntities_(seed);
...@@ -151,29 +152,22 @@ public: ...@@ -151,29 +152,22 @@ public:
const auto numLocalScvs = localScvs_.size(); const auto numLocalScvs = localScvs_.size();
const auto numLocalScvfs = localScvfs_.size(); const auto numLocalScvfs = localScvfs_.size();
const auto maxNumVolVars = numLocalScvs + numLocalScvfs; const auto maxNumVolVars = numLocalScvs + numLocalScvfs;
stencil_.reserve(numLocalScvs); volVarsStencil_ = seed.globalScvIndices(); // boundary vol vars are placed at the end
volVarsStencil_.reserve(maxNumVolVars); volVarsStencil_.reserve(maxNumVolVars);
volVarsPositions_.reserve(maxNumVolVars); volVarsPositions_.reserve(maxNumVolVars);
dirichletFaceIndexSet_.reserve(numLocalScvfs); dirichletFaceIndexSet_.reserve(numLocalScvfs);
fluxFaceIndexSet_.reserve(numLocalScvfs); fluxFaceIndexSet_.reserve(numLocalScvfs);
// fill info on the dof stencil // the positions where the vol vars are defined at (required for the gravitational acceleration)
for (const auto& localScv : localScvs_) for (const auto& localScv : localScvs_)
{
const auto globalScvIdx = localScv.globalIndex();
stencil_.push_back(globalScvIdx);
volVarsStencil_.push_back(globalScvIdx);
volVarsPositions_.push_back(localScv.center()); volVarsPositions_.push_back(localScv.center());
}
// eventually add dirichlet vol var indices and set up local index sets of flux and dirichlet faces // eventually add dirichlet vol var indices and set up local index sets of flux and dirichlet faces
LocalIndexType localScvfIdx = 0; LocalIndexType localScvfIdx = 0;
for (const auto& localScvf : localScvfs_) for (const auto& localScvf : localScvfs_)
{ {
auto faceType = localScvf.faceType();
// eventually add vol var index and corresponding position // eventually add vol var index and corresponding position
if (faceType == MpfaFaceTypes::dirichlet) if (localScvf.faceType() == MpfaFaceTypes::dirichlet)
{ {
volVarsStencil_.push_back(localScvf.outsideGlobalScvIndex()); volVarsStencil_.push_back(localScvf.outsideGlobalScvIndex());
volVarsPositions_.push_back(localScvf.ip()); volVarsPositions_.push_back(localScvf.ip());
...@@ -183,12 +177,6 @@ public: ...@@ -183,12 +177,6 @@ public:
fluxFaceIndexSet_.push_back(localScvfIdx++); fluxFaceIndexSet_.push_back(localScvfIdx++);
} }
// shrink containers to actual size
volVarsStencil_.shrink_to_fit();
volVarsPositions_.shrink_to_fit();
dirichletFaceIndexSet_.shrink_to_fit();
fluxFaceIndexSet_.shrink_to_fit();
// initialize the neumann fluxes vector to zero // initialize the neumann fluxes vector to zero
neumannFluxes_ = DynamicVector(fluxFaceIndexSet_.size(), 0.0); neumannFluxes_ = DynamicVector(fluxFaceIndexSet_.size(), 0.0);
} }
...@@ -252,21 +240,6 @@ public: ...@@ -252,21 +240,6 @@ public:
} }
} }
GlobalIndexSet globalScvfs() const
{
GlobalIndexSet globalScvfs;
globalScvfs.reserve(localScvfs_.size());
for (const auto& localScvf : localScvfs_)
{
globalScvfs.push_back(localScvf.insideGlobalScvfIndex());
if (!localScvf.boundary())
globalScvfs.push_back(localScvf.outsideGlobalScvfIndex());
}
return globalScvfs;
}
LocalIndexPair getLocalIndexPair(const SubControlVolumeFace& scvf) const LocalIndexPair getLocalIndexPair(const SubControlVolumeFace& scvf) const
{ {
auto scvfGlobalIdx = scvf.index(); auto scvfGlobalIdx = scvf.index();
...@@ -309,15 +282,15 @@ public: ...@@ -309,15 +282,15 @@ public:
bool onBoundary() const bool onBoundary() const
{ return onBoundary_; } { return onBoundary_; }
const GlobalIndexSet& stencil() const
{ return stencil_; }
const GlobalIndexSet& volVarsStencil() const const GlobalIndexSet& volVarsStencil() const
{ return volVarsStencil_; } { return volVarsStencil_; }
const PositionVector& volVarsPositions() const const PositionVector& volVarsPositions() const
{ return volVarsPositions_; } { return volVarsPositions_; }
const GlobalIndexSet& globalScvfs() const
{ return globalScvfIndices_; }
private: private:
const LocalScvfType& localScvf_(const LocalIndexType localScvfIdx) const const LocalScvfType& localScvf_(const LocalIndexType localScvfIdx) const
...@@ -558,7 +531,6 @@ private: ...@@ -558,7 +531,6 @@ private:
std::vector<LocalScvfType> localScvfs_; std::vector<LocalScvfType> localScvfs_;
GlobalIndexSet globalScvfIndices_; GlobalIndexSet globalScvfIndices_;
GlobalIndexSet stencil_;
GlobalIndexSet volVarsStencil_; GlobalIndexSet volVarsStencil_;
PositionVector volVarsPositions_; PositionVector volVarsPositions_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment