Commit 9601c992 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[mpfa][fluxvarcachefiller] avoid code duplication

parent 37e935ba
......@@ -189,45 +189,30 @@ private:
// First we upate data which are not dependent on the physical processes.
// We store pointers to the other flux var caches, so that we have to obtain
// this data only once and can use it again in the sub-cache fillers.
if (forceUpdateAll)
{
const auto numGlobalScvfs = iv.localFaceData().size();
std::vector<const SubControlVolumeFace*> ivScvfs(numGlobalScvfs);
std::vector<FluxVariablesCache*> ivFluxVarCaches(numGlobalScvfs);
const auto numGlobalScvfs = iv.localFaceData().size();
std::vector<const SubControlVolumeFace*> ivScvfs(numGlobalScvfs);
std::vector<FluxVariablesCache*> ivFluxVarCaches(numGlobalScvfs);
unsigned int i = 0;
for (const auto& d : iv.localFaceData())
{
// obtain the scvf
const auto& scvfJ = fvGeometry().scvf(d.globalScvfIndex());
ivScvfs[i] = &scvfJ;
ivFluxVarCaches[i] = &fluxVarsCacheContainer[scvfJ];
ivFluxVarCaches[i]->setIvIndexInContainer(ivIndexInContainer);
ivFluxVarCaches[i]->setUpdateStatus(true);
i++;
}
unsigned int i = 0;
for (const auto& d : iv.localFaceData())
{
// obtain the scvf
const auto& scvfJ = fvGeometry().scvf(d.globalScvfIndex());
ivScvfs[i] = &scvfJ;
ivFluxVarCaches[i] = &fluxVarsCacheContainer[scvfJ];
ivFluxVarCaches[i]->setIvIndexInContainer(ivIndexInContainer);
ivFluxVarCaches[i]->setUpdateStatus(true);
i++;
}
if (forceUpdateAll)
{
fillAdvection(fluxVarsCacheContainer, iv, handle, ivScvfs, ivFluxVarCaches);
fillDiffusion(fluxVarsCacheContainer, iv, handle, ivScvfs, ivFluxVarCaches);
fillHeatConduction(fluxVarsCacheContainer, iv, handle, ivScvfs, ivFluxVarCaches);
}
else
{
const auto numGlobalScvfs = iv.localFaceData().size();
std::vector<const SubControlVolumeFace*> ivScvfs(numGlobalScvfs);
std::vector<FluxVariablesCache*> ivFluxVarCaches(numGlobalScvfs);
unsigned int i = 0;
for (const auto& d : iv.localFaceData())
{
// the iv index has been set already
const auto& scvfJ = fvGeometry().scvf(d.globalScvfIndex());
ivScvfs[i] = &scvfJ;
ivFluxVarCaches[i] = &fluxVarsCacheContainer[scvfJ];
ivFluxVarCaches[i]->setUpdateStatus(true);
i++;
}
if (doAdvection && soldependentAdvection)
fillAdvection(fluxVarsCacheContainer, iv, handle, ivScvfs, ivFluxVarCaches);
if (doDiffusion && soldependentDiffusion)
......
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