postprocessPhasicFlow is now updated with new postprocessData auxFunction. It now uses postprocessDataDict.

This commit is contained in:
Hamidreza
2025-04-21 00:13:54 +03:30
parent 40deb1f9c0
commit 9de1fa2dc7
41 changed files with 1000 additions and 2912 deletions

View File

@ -22,22 +22,18 @@ Licence:
#include "List.hpp"
#include "systemControl.hpp"
#include "postprocessData.hpp"
#include "fileDictionary.hpp"
#include "postprocessGlobals.hpp"
#include "postprocessComponent.hpp"
pFlow::postprocessData::postprocessData(const systemControl &control)
pFlow::postprocessData::postprocessData
(
const systemControl &control,
timeValue startTime
)
:
auxFunctions(control),
inSimulation_(startTime<0.0?true:false),
time_(control.time()),
fieldsDataBasePtr_
(
fieldsDataBase::create
(
const_cast<systemControl&>(control),
true
)
),
dict_
(
objectFile
@ -59,6 +55,15 @@ pFlow::postprocessData::postprocessData(const systemControl &control)
<<" This feature is disabled in the current run."<<END_WARNING;
return;
}
fieldsDataBasePtr_= fieldsDataBase::create
(
const_cast<systemControl&>(control),
dict_,
inSimulation_,
startTime
);
activeInSimulation_ = dict_.getValOrSet<Logical>(
"activeInSimulation",
@ -80,12 +85,6 @@ pFlow::postprocessData::postprocessData(const systemControl &control)
control.time().saveInterval(),
"execution");
}
shapeType_ = dict_.getValOrSet<word>
(
"shapeType",
word("sphere")
);
componentsDictsPtr_ = makeUnique<dictionaryList>(readDictList("components", dict_));
@ -105,10 +104,10 @@ bool pFlow::postprocessData::execute()
for(auto& component:postprocesses_)
{
if(!component->execute(ti))
if(!component->execute(ti, !inSimulation_) )
{
fatalErrorInFunction
<<"Error occured in executing postprocess component: "
<<"Error occurred in executing postprocess component: "
<<component->name()<<endl;
return false;
}
@ -125,6 +124,7 @@ bool pFlow::postprocessData::write() const
{
continue;
}
if(!component->write(postProcessGlobals::defaultDir__/component->name()))
{
fatalErrorInFunction
@ -135,3 +135,8 @@ bool pFlow::postprocessData::write() const
}
return true;
}
void pFlow::postprocessData::setOutputDirectory(const fileSystem &path) const
{
postProcessGlobals::defaultDir__ = path;
}

View File

@ -20,14 +20,14 @@ Licence:
#ifndef __postprocessData_hpp__
#define __postprocessData_hpp__
#include "auxFunctions.hpp"
#include "Logical.hpp"
#include "ListPtr.hpp"
#include "fileDictionary.hpp"
#include "baseTimeControl.hpp"
#include "dictionaryList.hpp"
#include "auxFunctions.hpp"
#include "fieldsDataBase.hpp"
#include "postprocessComponent.hpp"
#include "dictionaryList.hpp"
namespace pFlow
{
@ -36,6 +36,7 @@ class systemControl;
class Time;
class timeInfo;
/**
* @class postprocessData
* @brief An interface class for handling post-processing of simulation data.
@ -47,7 +48,11 @@ class postprocessData
:
public auxFunctions
{
/// Indicates if a post-processing is active during simulatoin
/// Indicates if this is post-processing during simulation or
/// post-simulation
bool inSimulation_;
/// Indicates if a post-processing is active during simulation
Logical activeInSimulation_{false};
/// a list of active post-process components
@ -62,9 +67,6 @@ class postprocessData
/// file dictionary that is constructed from the file (postProcessDataDict)
fileDictionary dict_;
/// name of the shape for use in the time of postprocess after simulation
word shapeType_;
/// list of dictionaries for postprocess components
uniquePtr<dictionaryList> componentsDictsPtr_ = nullptr;
@ -79,7 +81,7 @@ public:
/// this constructor is used when postprocesing is active
/// during simulation.
/// @param control const reference to systemControl
postprocessData(const systemControl& control);
postprocessData(const systemControl& control, timeValue startTime = -1.0);
~postprocessData()override = default;
@ -92,11 +94,19 @@ public:
bool execute() override;
bool write()const override;
fieldsDataBase& database()
{
return fieldsDataBasePtr_();
}
const fieldsDataBase& database()const
{
return fieldsDataBasePtr_();
}
void setOutputDirectory(const fileSystem& path)const;
};
} // namespace pFlow