Skip to content

Commit

Permalink
add: manually change precision of pointdata
Browse files Browse the repository at this point in the history
  • Loading branch information
timovanopstal committed Feb 14, 2017
1 parent be90f3c commit aa56dcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/SIM/SIMoutput.C
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ bool SIMoutput::parseOutputTag (const TiXmlElement* elem)
if (strcasecmp(elem->Value(),"resultpoints"))
return this->SIMinput::parseOutputTag(elem);

int precision;
if (utl::getAttribute(elem,"precision",precision))
this->setResultPrecision(precision);

std::string fname;
if (utl::getAttribute(elem,"file",fname))
this->setPointResultFile(fname,elem->FirstChildElement("dump_coordinates"));
Expand Down Expand Up @@ -1383,7 +1387,7 @@ bool SIMoutput::savePoints (const Vector& psol, double time, int step) const
std::ofstream fs(myPoints[i].first.c_str(),
step == 1 ? std::ios::out : std::ios::app);
utl::LogStream logs(fs);
if (!this->dumpResults(psol,time,logs,myPoints[i].second,false,3))
if (!this->dumpResults(psol,time,logs,myPoints[i].second,false,myResPrec))
return false;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/SIM/SIMoutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SIMoutput : public SIMinput
{
protected:
//! \brief The constructor just forwards to the base class constructor.
SIMoutput(IntegrandBase* itg) : SIMinput(itg), myGeomID(0), myVtf(nullptr) {}
SIMoutput(IntegrandBase* itg) : SIMinput(itg), myGeomID(0), myResPrec(3), myVtf(nullptr) {}

public:
//! \brief The destructor frees the dynamically allocated VTF object.
Expand Down Expand Up @@ -206,6 +206,9 @@ class SIMoutput : public SIMinput
//! \brief Defines the VTF-file for subsequent results output.
void setVTF(VTF* vtf) { myVtf = vtf; }

//! \brief Initializes the geometry block counter.
void setResultPrecision(int precision) { myResPrec = precision; }

//! \brief Initializes the geometry block counter.
void setStartGeo(int gID) { myGeomID = gID; }

Expand Down Expand Up @@ -298,6 +301,7 @@ class SIMoutput : public SIMinput
typedef std::pair<std::string,ResPointVec> ResPtPair; //!< Result point group

std::vector<ResPtPair> myPoints; //!< User-defined result sampling points
int myResPrec; //!< User-defined precision for result sampling

int myGeomID; //!< VTF geometry block ID for the first patch
VTF* myVtf; //!< VTF-file for result visualization
Expand Down

0 comments on commit aa56dcb

Please sign in to comment.