56 for (label j = 0; j <
nBins_[i]; ++j)
67 for (label i = 0; i <
nBin_; ++i)
90 const word& fieldName = fieldNames_[fieldi];
92 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
94 const VolFieldType* fieldPtr = mesh_.findObject<VolFieldType>(fieldName);
101 if (writeToFile() && !writtenHeader_)
103 writeFileHeader<Type>(filePtrs_[fieldi]);
106 const VolFieldType&
fld = *fieldPtr;
119 if (decomposePatchValues_)
124 List<List<Type>> data(nField);
125 for (
auto& binList : data)
127 binList.resize(nBin_,
Zero);
130 for (
const label zonei : cellZoneIDs_)
132 const cellZone& cZone = mesh_.cellZones()[zonei];
134 for (
const label celli : cZone)
136 const label bini = cellToBin_[celli];
140 data[0][bini] +=
fld[celli];
145 for (
const label patchi : patchIDs_)
147 const polyPatch&
pp = mesh_.boundaryMesh()[patchi];
148 const vectorField np(mesh_.boundary()[patchi].nf());
152 const label localFacei =
153 pp.start() - mesh_.nInternalFaces() + facei;
154 const label bini = faceToBin_[localFacei];
158 const Type& v =
fld.boundaryField()[patchi][facei];
160 if (!decomposePatchValues(data, bini, v, np[facei]))
168 for (
auto& binList : data)
170 reduce(binList, sumOp<List<Type>>());
175 writeBinnedData(data, filePtrs_[fieldi]);
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
Output to file stream as an OSstream, normally using std::ofstream for the actual output...
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool decomposePatchValues_
Decompose patch values into normal and tangential components.
label nBin_
Total number of bins.
constexpr char tab
The tab '\t' character(0x09)
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
#define forAll(list, i)
Loop across all elements in list.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
autoPtr< coordinateSystem > coordSysPtr_
Local coordinate system of bins.
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
Write a (commented) header property and value pair.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define R(A, B, C, D, E, F, K, M)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Tensor of scalars, i.e. Tensor<scalar>.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.