36template<
class CloudType>
37void Foam::ParticlePostProcessing<CloudType>::writeFileHeader(Ostream&
os)
const
39 this->writeCommented(
os,
"Time");
40 os <<
' ' <<
"currentProc";
53template<
class CloudType>
68 collector_(this->coeffDict(), owner.
mesh()),
69 maxStoredParcels_(this->coeffDict().getScalar(
"maxStoredParcels")),
79 if (maxStoredParcels_ <= 0)
82 <<
"maxStoredParcels = " << maxStoredParcels_
83 <<
", cannot be equal to or less than zero"
87 const label sz = collector_.size();
93template<
class CloudType>
101 collector_(ppp.collector_),
102 maxStoredParcels_(ppp.maxStoredParcels_),
103 header_(ppp.header_),
104 fields_(ppp.fields_),
112template<
class CloudType>
117 const typename parcelType::trackingData&
td
120 if (!collector_.isPatch())
125 const label patchi =
pp.index();
126 const label localPatchi = collector_.IDs().find(patchi);
131 p.writeProperties(data, fields_,
" ",
true);
132 header_ = data.str();
135 if (localPatchi != -1 && data_[localPatchi].size() < maxStoredParcels_)
137 times_[localPatchi].append(this->owner().time().value());
141 p.writeProperties(data, fields_,
" ",
false);
143 data_[localPatchi].
append(data.str());
150template<
class CloudType>
154 const typename parcelType::trackingData&
td
157 if (collector_.isPatch())
169 p.writeProperties(data, fields_,
" ",
true);
170 header_ = data.str();
175 if (!BBs[i].contains(
p.position()))
181 const label zonei = IDs[i];
182 const label localFacei = fzm[zonei].find(
p.face());
184 if (localFacei != -1 && data_[localFacei].size() < maxStoredParcels_)
186 times_[i].append(this->owner().time().value());
190 p.writeProperties(data, fields_,
" ",
false);
192 data_[i].
append(data.str());
200template<
class CloudType>
218 [](
string&
x,
const string&
y)
220 if (
y.size() >
x.size())
243 if (this->writeToFile())
248 this->owner().time().value()
257 const label datai = indices[j];
259 os << globalTimes[datai] <<
tab
260 << globalData[datai].c_str()
266 times_[i].clearStorage();
267 data_[i].clearStorage();
Various functions to operate on Lists.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Templated cloud function object base class.
CloudFunctionObject(CloudType &owner)
Construct null from owner.
virtual fileName localPath() const
Output directory.
const CloudType & owner() const
Return const access to the owner cloud.
const fvMesh & mesh() const
Return reference to the mesh.
void append(const T &val)
Append an element at the end of the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
Foam::string str() const
Get the string. As Foam::string instead of std::string (may change in future).
Writes out various standard Lagrangian data elements of particles hitting on a given list of patches ...
ParticlePostProcessing(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void write()
Write post-processing info.
virtual bool postFace(const parcelType &p, const typename parcelType::trackingData &td)
Post-face hook.
virtual bool postPatch(const parcelType &p, const polyPatch &pp, const typename parcelType::trackingData &td)
Post-patch hook.
static void combineReduce(T &value, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) applying cop to inplace combine value from different processors.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
@ gatherList
gatherList [manual algorithm]
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
T & ref()
Return reference to the managed object without nullptr checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
virtual bool writeToFile() const
Flag to allow writing to file.
virtual autoPtr< OFstream > newFileAtTime(const word &name, scalar timeValue) const
Return autoPtr to a new file for a given time.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
A patch is a list of labels that address the faces in the global face list.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
const dictionary & dict() const
Return const access to the cloud dictionary.
const word & modelName() const
Return const access to the name of the sub-model.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
List< word > wordList
List of word.
DSMCCloud< dsmcParcel > CloudType
List< label > labelList
A List of labels.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< scalar > scalarList
List of scalar.
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).
#define forAll(list, i)
Loop across all elements in list.
Object access operator or list access operator (default is pass-through).