#include "particleProbePostprocessComponent.hpp" #include "Time.hpp" namespace pFlow { template inline regionField porbeExecute ( const word& regFieldName, const span& field, const regionPoints& regPoints ) { regionField processedField(regFieldName, regPoints, T{}); auto partIndices = regPoints.indices(0); uint n = 0; for(auto index:partIndices) { if(index != -1) { processedField[n] = field[index]; } n++; } return processedField; } template inline bool writeField ( iOstream& os, timeValue t, const regionField& field, const regionPoints& regPoints, const T& invalidVal = T{} ) { auto indices = regPoints.indices(0); const uint32 s= field.size(); os<< t <) { os< ) { os<(dict, fieldsDB) ), fieldName_ ( dict.getVal("field") ), name_(dict.name()) {} bool pFlow::particleProbePostprocessComponent::execute ( const timeInfo &ti, bool forceExecute ) { if( !forceExecute && !timeControl().eventTime(ti)) { executed_ = false; return true; } REPORT(1)<<"Executing postprocess component (" < ( std::visit( [&](auto&& f) -> processedRegFieldType { return porbeExecute( pFieldName, f, regionPointsPtr_()); }, field) ); executed_ = true; return true; } bool pFlow::particleProbePostprocessComponent::write(const fileSystem& parDir)const { if(! executed_ ) return true; const auto ti = database().time().TimeInfo(); if( !osPtr_) { // file is not open yet fileSystem path = parDir + (name_+".Start_"+ti.timeName()); osPtr_ = makeUnique(path); regionPointsPtr_().write(osPtr_()); } std::visit ([&](auto&& arg)->bool { return writeField(osPtr_(), ti.t(), arg, regionPointsPtr_()); }, processedField_() ); return true; }