Added: Number of values to print per line in the result point output

This commit is contained in:
Knut Morten Okstad 2018-04-10 08:52:19 +02:00
parent 9db398f095
commit a8afaae019
2 changed files with 21 additions and 13 deletions

View File

@ -191,6 +191,9 @@ public:
//! \brief Returns an evaluated principal direction vector field for plotting. //! \brief Returns an evaluated principal direction vector field for plotting.
virtual bool getPrincipalDir(Matrix&, size_t, size_t) const { return false; } virtual bool getPrincipalDir(Matrix&, size_t, size_t) const { return false; }
//! \brief Returns max number of 2ndary solution components to print per line.
virtual size_t getNo2ndSolPerLine() const { return 999; }
// Various service methods // Various service methods
// ======================= // =======================

View File

@ -595,8 +595,8 @@ int SIMoutput::writeGlvS1 (const Vector& psol, int iStep, int& nBlock,
if (mySol->getScalarSol()) if (mySol->getScalarSol())
{ {
const RealFunc* psSol; const RealFunc* psSol;
size_t r = pSol.dim() + 1; size_t k = 0, r = pSol.dim();
for (size_t k = 0; (psSol = mySol->getScalarSol(k)) && r <= field.rows(); k++, r++) while ((psSol = mySol->getScalarSol(k++)) && r++ < field.rows())
{ {
cit = grid->begin_XYZ(); cit = grid->begin_XYZ();
const RealFunc& sSol = *psSol; const RealFunc& sSol = *psSol;
@ -855,9 +855,9 @@ bool SIMoutput::writeGlvP (const Vector& ssol, int iStep, int& nBlock,
Vector lovec; Vector lovec;
std::vector<IntVec> sID(myProblem->getNoFields(2)); std::vector<IntVec> sID(myProblem->getNoFields(2));
size_t i, j; Vector::const_iterator ssolIt = ssol.begin();
size_t i, j, nComp = myProblem->getNoFields(2);
int geomID = myGeomID; int geomID = myGeomID;
size_t projOfs = 0;
for (i = 0; i < myModel.size(); i++) for (i = 0; i < myModel.size(); i++)
{ {
if (myModel[i]->empty()) continue; // skip empty patches if (myModel[i]->empty()) continue; // skip empty patches
@ -865,16 +865,18 @@ bool SIMoutput::writeGlvP (const Vector& ssol, int iStep, int& nBlock,
if (msgLevel > 1) if (msgLevel > 1)
IFEM::cout <<"Writing projected solution for patch "<< i+1 << std::endl; IFEM::cout <<"Writing projected solution for patch "<< i+1 << std::endl;
if (this->fieldProjections()) { if (this->fieldProjections())
size_t ndof = myModel[i]->getNoProjectionNodes() * myProblem->getNoFields(2); {
lovec.resize(ndof); size_t nval = nComp*myModel[i]->getNoProjectionNodes();
std::copy(ssol.begin()+projOfs, ssol.begin()+projOfs+ndof, lovec.begin()); lovec.resize(nval);
projOfs += ndof; std::copy(ssolIt,ssolIt+nval,lovec.begin());
} else ssolIt += nval;
}
else
this->extractPatchSolution(ssol,lovec,i,sID.size(),1); this->extractPatchSolution(ssol,lovec,i,sID.size(),1);
// Evaluate the solution variables at the visualization points // Evaluate the solution variables at the visualization points
if (!myModel[i]->evalProjSolution(field,lovec,opt.nViz,myProblem->getNoFields(2))) if (!myModel[i]->evalProjSolution(field,lovec,opt.nViz,nComp))
return false; return false;
// Write out to VTF-file as scalar fields // Write out to VTF-file as scalar fields
@ -1432,10 +1434,13 @@ bool SIMoutput::dumpResults (const Vector& psol, double time,
if (opt.discretization >= ASM::Spline) if (opt.discretization >= ASM::Spline)
{ {
if (formatted && sol2.rows() > 0) int isol = 1;
os <<"\n\t\tsol2 =";
for (k = 1; k <= sol2.rows(); k++) for (k = 1; k <= sol2.rows(); k++)
{
if (formatted && k%myProblem->getNo2ndSolPerLine() == 1)
os <<"\n\t\tsol"<< ++isol <<" =";
os << std::setw(flWidth) << utl::trunc(sol2(k,j+1)); os << std::setw(flWidth) << utl::trunc(sol2(k,j+1));
}
if (ssolScl || ssolVec || ssolStr) if (ssolScl || ssolVec || ssolStr)
os <<"\n\t\texact2"; os <<"\n\t\texact2";