bug fix for issue #241, precision in output file

This commit is contained in:
Hamidreza
2025-07-29 00:54:49 +03:30
parent c340040b40
commit 42315d2221
6 changed files with 51 additions and 3 deletions

View File

@ -161,7 +161,15 @@ bool PostprocessOperationAverage::write(const fileSystem &parDir) const
fileSystem path = parDir+(
processedFieldName()+"_prime2" + ".Start_" + ti.timeName());
os2Ptr_ = makeUnique<oFstream>(path);
if(regPoints().scientific())
{
// set output format to scientific notation
os2Ptr_().stdStream()<<std::scientific;
}
os2Ptr_().precision(regPoints().precision());
regPoints().write(os2Ptr_());
}

View File

@ -107,6 +107,14 @@ bool postprocessOperation::write(const fileSystem &parDir) const
processedFieldName() + ".Start_" + ti.timeName());
osPtr_ = makeUnique<oFstream>(path);
if(regPoints().scientific())
{
// set output format to scientific notation
osPtr_().stdStream()<<std::scientific;
}
osPtr_().precision(regPoints().precision());
regPoints().write(osPtr_());
}

View File

@ -157,6 +157,14 @@ bool pFlow::postprocessData::PostprocessComponent<RegionType, ProcessMethodType>
auto osPtr = makeUnique<oFstream>(file);
// set output format to scientific notation
if(regPoints().scientific())
{
osPtr->stdStream() << std::scientific;
}
osPtr().precision(regPoints().precision());
regPoints().write(osPtr());
for(auto& operation:operatios_)

View File

@ -157,6 +157,12 @@ bool pFlow::postprocessData::particleProbePostprocessComponent::write(const file
// file is not open yet
fileSystem path = parDir + (name_+".Start_"+ti.timeName());
osPtr_ = makeUnique<oFstream>(path);
if(regionPointsPtr_().scientific())
{
osPtr_().stdStream() << std::scientific;
}
osPtr_().precision(regionPointsPtr_().precision());
regionPointsPtr_().write(osPtr_());
}

View File

@ -12,7 +12,10 @@ regionPoints::regionPoints
)
:
fieldsDataBase_(fieldsDataBase)
{}
{
precision_ = dict.getValOrSet<int>("precision", 6);
scientific_ = dict.getValOrSet<Logical>("scientific", Logical(true));
}
const Time& regionPoints::time() const
{

View File

@ -52,7 +52,13 @@ class regionPoints
using PointsTypeHost = typename pointStructure::PointsTypeHost;
/// Reference to the fields database containing simulation data
fieldsDataBase& fieldsDataBase_;
fieldsDataBase& fieldsDataBase_;
/// default precision for output
int precision_ = 6;
/// if scientific notation is used for output
Logical scientific_;
public:
@ -74,7 +80,16 @@ public:
/// Returns non-const reference to the fields database
fieldsDataBase& database();
int precision() const
{
return precision_;
}
bool scientific()const
{
return scientific_();
}
/// @brief size of elements
virtual
uint32 size()const = 0;