mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
Utility postProcess is modified to be used in Version 1.0
- counting dictionary is added to postProcess - Code need to be modified to cleaned (fields in the repository should be removed onces postProcess is passed the next time step)
This commit is contained in:
@ -21,6 +21,7 @@ Licence:
|
||||
#include "postprocess.hpp"
|
||||
#include "timeFolder.hpp"
|
||||
#include "pointStructure.hpp"
|
||||
#include "countFields.hpp"
|
||||
#include "vocabs.hpp"
|
||||
#include "vtkFile.hpp"
|
||||
|
||||
@ -29,22 +30,26 @@ pFlow::postprocess::postprocess(systemControl& control)
|
||||
control_(control),
|
||||
dict_(postprocessFile__, control_.settings().path()+postprocessFile__)
|
||||
{
|
||||
REPORT(1)<<"Reading numberBased dictionary ..."<<endREPORT;
|
||||
REPORT(1)<<"Reading numberBased dictionary ..."<<END_REPORT;
|
||||
auto nbDict = dict_.subDictOrCreate("numberBased");
|
||||
|
||||
numberBasedDictNames_ = dict_.subDictOrCreate("numberBased").dictionaryKeywords();
|
||||
if(!numberBasedDictNames_.empty())
|
||||
{
|
||||
REPORT(1)<< "numberBased dictionary contains " << yellowText(numberBasedDictNames_)<<endREPORT<<endl;
|
||||
REPORT(1)<< "numberBased dictionary contains " << Yellow_Text(numberBasedDictNames_)<<END_REPORT<<endl;
|
||||
}
|
||||
|
||||
|
||||
weightBasedDictNames_ = dict_.subDictOrCreate("weightBased").dictionaryKeywords();
|
||||
if(!weightBasedDictNames_.empty())
|
||||
{
|
||||
REPORT(1)<< "numberBased dictionary contains " << yellowText(weightBasedDictNames_)<<endREPORT<<endl;
|
||||
REPORT(1)<< "numberBased dictionary contains " << Yellow_Text(weightBasedDictNames_)<<END_REPORT<<endl;
|
||||
}
|
||||
|
||||
countDictNames_ = dict_.subDictOrCreate("counting").dictionaryKeywords();
|
||||
if(!countDictNames_.empty())
|
||||
{
|
||||
REPORT(1)<< "counting dictionary contains " << Yellow_Text(countDictNames_)<<END_REPORT<<endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -55,43 +60,32 @@ bool pFlow::postprocess::processTimeFolder(real time, const word& tName, const f
|
||||
|
||||
time_ = time;
|
||||
|
||||
REPORT(0)<<"Working on time folder "<< cyanText(time)<<endREPORT;
|
||||
timeFolderReposiory_ =
|
||||
makeUnique<repository>
|
||||
(
|
||||
"timeFolder-"+tName,
|
||||
localFolder,
|
||||
&control_
|
||||
);
|
||||
REPORT(0)<<"Working on time folder "<< Cyan_Text(time)<<END_REPORT;
|
||||
|
||||
REPORT(1)<<"Reading pointStructure"<<endREPORT;
|
||||
timeFolderReposiory().emplaceObject<pointStructure>(
|
||||
objectFile
|
||||
(
|
||||
pFlow::pointStructureFile__,
|
||||
"",
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_NEVER
|
||||
));
|
||||
control_.time().setTime(time);
|
||||
|
||||
REPORT(1)<<"Reading pointStructure"<<END_REPORT;
|
||||
pointStructure pStruct(control_);
|
||||
|
||||
// first delete the object to remove fields from repository
|
||||
pointToCell_.reset(nullptr);
|
||||
|
||||
REPORT(1)<<"Creating mesh and point to cell mapper"<<endREPORT;
|
||||
REPORT(1)<<"Creating mesh and point to cell mapper"<<END_REPORT;
|
||||
pointToCell_ = makeUnique<pointRectCell>(
|
||||
dict_.subDict("rectMesh"),
|
||||
timeFolderReposiory().lookupObject<pointStructure>(pointStructureFile__),
|
||||
timeFolderReposiory());
|
||||
pStruct,
|
||||
control_.time());
|
||||
|
||||
// first numberbased dict
|
||||
|
||||
processedFields_.clear();
|
||||
for(word& dictName:numberBasedDictNames_)
|
||||
{
|
||||
|
||||
|
||||
auto fieldDict = dict_.subDict("numberBased").subDict(dictName);
|
||||
auto ppFieldPtr = processField::create(
|
||||
fieldDict,
|
||||
pointToCell_(),
|
||||
timeFolderReposiory());
|
||||
control_.time());
|
||||
|
||||
if(!ppFieldPtr->process())
|
||||
{
|
||||
@ -99,11 +93,28 @@ bool pFlow::postprocess::processTimeFolder(real time, const word& tName, const f
|
||||
}
|
||||
|
||||
processedFields_.push_back( ppFieldPtr.release() );
|
||||
|
||||
output<<endl;
|
||||
|
||||
}
|
||||
|
||||
countedVariableNamesList_.clear();
|
||||
countedVairablesLists_.clear();
|
||||
|
||||
for(const auto& countDictName:countDictNames_)
|
||||
{
|
||||
REPORT(1)<<"Processing "<< Yellow_Text("counting."<<countDictName)<<END_REPORT;
|
||||
const dictionary& countDict = dict_.subDict("counting").subDict(countDictName);
|
||||
|
||||
countFields cFields(countDict);
|
||||
|
||||
cFields.process(timeFolderReposiory());
|
||||
|
||||
countedVariableNamesList_.push_back(
|
||||
cFields.variableNames());
|
||||
|
||||
countedVairablesLists_.push_back(cFields.countedValues());
|
||||
|
||||
}
|
||||
output<<"\n";
|
||||
|
||||
|
||||
return true;
|
||||
@ -125,7 +136,7 @@ bool pFlow::postprocess::writeToVTK(fileSystem destPath, word bName)const
|
||||
|
||||
if(!vtk) return false;
|
||||
|
||||
REPORT(1)<<"Writing processed fields to vtk file..."<<endREPORT;
|
||||
REPORT(1)<<"Writing processed fields to vtk file..."<<END_REPORT;
|
||||
// mesh
|
||||
pointToCell_->mesh().writeToVtk(vtk());
|
||||
|
||||
|
Reference in New Issue
Block a user