Added: Output of dual solution quantities to VTF
This commit is contained in:
parent
aeae2faad1
commit
33344bc94a
@ -224,6 +224,10 @@ bool AdaptiveSIM::writeGlv (const char* infile, int iStep)
|
||||
if (!model.writeGlvS(solution.front(),iStep,nBlock))
|
||||
return false;
|
||||
|
||||
if (solution.size() > 1)
|
||||
if (!model.writeGlvS1(solution[1],iStep,nBlock,0.0,"Dual solution",90,-1))
|
||||
return false;
|
||||
|
||||
// Write projected solution fields
|
||||
SIMoptions::ProjectionMap::const_iterator pit = opt.project.begin();
|
||||
for (size_t i = 0; i < projs.size(); i++, ++pit)
|
||||
@ -234,6 +238,13 @@ bool AdaptiveSIM::writeGlv (const char* infile, int iStep)
|
||||
if (!model.writeGlvN(eNorm,iStep,nBlock,prefix))
|
||||
return false;
|
||||
|
||||
if (!fNorm.empty())
|
||||
{
|
||||
std::vector<std::string> prefix = { "Dual projected" };
|
||||
if (!model.writeGlvN(fNorm,iStep,nBlock,prefix,300,"Dual"))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write state information
|
||||
return model.writeGlvStep(iStep,iStep,1);
|
||||
}
|
||||
|
@ -1116,7 +1116,8 @@ bool SIMoutput::writeGlvM (const Mode& mode, bool freq, int& nBlock)
|
||||
|
||||
|
||||
bool SIMoutput::writeGlvN (const Matrix& norms, int iStep, int& nBlock,
|
||||
const std::vector<std::string>& prefix, int idBlock)
|
||||
const std::vector<std::string>& prefix,
|
||||
int idBlock, const char* dualPrefix)
|
||||
{
|
||||
if (adm.dd.isPartitioned() && adm.getProcId() != 0)
|
||||
return true;
|
||||
@ -1127,6 +1128,15 @@ bool SIMoutput::writeGlvN (const Matrix& norms, int iStep, int& nBlock,
|
||||
|
||||
NormBase* norm = myProblem->getNormIntegrand(mySol);
|
||||
|
||||
// Lambda function telling whether a norm quantity should be saved or not
|
||||
auto&& writeNorm = [norm,dualPrefix](size_t iGroup, size_t iNorm)
|
||||
{
|
||||
if (iNorm == 1 || iGroup > 1 || !dualPrefix)
|
||||
return norm->hasElementContributions(iGroup,iNorm);
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
Matrix field;
|
||||
std::vector<IntVec> sID(norms.rows());
|
||||
|
||||
@ -1157,7 +1167,7 @@ bool SIMoutput::writeGlvN (const Matrix& norms, int iStep, int& nBlock,
|
||||
if (l > norm->getNoFields(j))
|
||||
l = 1, ++j;
|
||||
|
||||
if (norm->hasElementContributions(j,l++))
|
||||
if (writeNorm(j,l++))
|
||||
if (!myVtf->writeEres(field.getRow(1+m),++nBlock,geomID))
|
||||
return false;
|
||||
else
|
||||
@ -1172,10 +1182,12 @@ bool SIMoutput::writeGlvN (const Matrix& norms, int iStep, int& nBlock,
|
||||
if (l > norm->getNoFields(j))
|
||||
l = 1, ++j;
|
||||
|
||||
if (!norm->hasElementContributions(j,l))
|
||||
if (!writeNorm(j,l))
|
||||
continue;
|
||||
|
||||
if (!prefix.empty() && j > 1)
|
||||
if (j == 1 && dualPrefix)
|
||||
normName = norm->getName(j,l,dualPrefix);
|
||||
else if (j > 1 && j-2 < prefix.size())
|
||||
normName = norm->getName(j,l,prefix[j-2].c_str());
|
||||
else
|
||||
normName = norm->getName(j,l);
|
||||
|
@ -188,9 +188,10 @@ public:
|
||||
//! \param nBlock Running result block counter
|
||||
//! \param[in] prefix Prefices for projected solutions
|
||||
//! \param[in] idBlock Starting value of result block numbering
|
||||
//! \param[in] dualPrefix Prefix for dual solution norms
|
||||
bool writeGlvN(const Matrix& norms, int iStep, int& nBlock,
|
||||
const std::vector<std::string>& prefix = {},
|
||||
int idBlock = 200);
|
||||
int idBlock = 200, const char* dualPrefix = nullptr);
|
||||
|
||||
//! \brief Writes a scalar function to the VTF-file.
|
||||
//! \param[in] f The function to output
|
||||
|
Loading…
Reference in New Issue
Block a user