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:
void solveLocalSystem(const GetTensorFunction& getTensor)
{ 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
const GlobalIndexSet& volVarsStencil() const
{ DUNE_THROW(Dune::NotImplemented, "Actual interaction volume implementation does not provide a volVarsStencil() method."); }
......@@ -69,7 +65,7 @@ public:
{ 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
GlobalIndexSet globalScvfs() const
const GlobalIndexSet& globalScvfs() const
{ 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)
......
......@@ -142,7 +142,8 @@ public:
: problemRef_(problem),
fvGeometryRef_(fvGeometry),
elemVolVarsRef_(elemVolVars),
onBoundary_(seed.onBoundary())
onBoundary_(seed.onBoundary()),
globalScvfIndices_(seed.globalScvfIndices())
{
// create local sub control entities from the seed
createLocalEntities_(seed);
......@@ -151,29 +152,22 @@ public:
const auto numLocalScvs = localScvs_.size();
const auto numLocalScvfs = localScvfs_.size();
const auto maxNumVolVars = numLocalScvs + numLocalScvfs;
stencil_.reserve(numLocalScvs);
volVarsStencil_ = seed.globalScvIndices(); // boundary vol vars are placed at the end
volVarsStencil_.reserve(maxNumVolVars);
volVarsPositions_.reserve(maxNumVolVars);
dirichletFaceIndexSet_.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_)
{
const auto globalScvIdx = localScv.globalIndex();
stencil_.push_back(globalScvIdx);
volVarsStencil_.push_back(globalScvIdx);
volVarsPositions_.push_back(localScv.center());
}
// eventually add dirichlet vol var indices and set up local index sets of flux and dirichlet faces
LocalIndexType localScvfIdx = 0;
for (const auto& localScvf : localScvfs_)
{
auto faceType = localScvf.faceType();
// eventually add vol var index and corresponding position
if (faceType == MpfaFaceTypes::dirichlet)
if (localScvf.faceType() == MpfaFaceTypes::dirichlet)
{
volVarsStencil_.push_back(localScvf.outsideGlobalScvIndex());
volVarsPositions_.push_back(localScvf.ip());
......@@ -183,12 +177,6 @@ public:
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
neumannFluxes_ = DynamicVector(fluxFaceIndexSet_.size(), 0.0);
}
......@@ -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
{
auto scvfGlobalIdx = scvf.index();
......@@ -309,15 +282,15 @@ public:
bool onBoundary() const
{ return onBoundary_; }
const GlobalIndexSet& stencil() const
{ return stencil_; }
const GlobalIndexSet& volVarsStencil() const
{ return volVarsStencil_; }
const PositionVector& volVarsPositions() const
{ return volVarsPositions_; }
const GlobalIndexSet& globalScvfs() const
{ return globalScvfIndices_; }
private:
const LocalScvfType& localScvf_(const LocalIndexType localScvfIdx) const
......@@ -558,7 +531,6 @@ private:
std::vector<LocalScvfType> localScvfs_;
GlobalIndexSet globalScvfIndices_;
GlobalIndexSet stencil_;
GlobalIndexSet volVarsStencil_;
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