Go to the documentation of this file.
34 template<
class ParcelType>
39 template<
class ParcelType>
48 template<
class ParcelType>
65 if (is.
format() == IOstream::ASCII)
75 readRawScalar(is, &mass0_);
81 is.
read(
reinterpret_cast<char*
>(&mass0_), sizeofFields);
93 template<
class ParcelType>
94 template<
class CloudType>
101 template<
class ParcelType>
102 template<
class CloudType,
class CompositionType>
106 const CompositionType& compModel
109 bool valid =
c.size();
115 c.fieldIOobject(
"mass0", IOobject::MUST_READ),
118 c.checkFieldIOobject(
c, mass0);
129 const wordList& phaseTypes = compModel.phaseTypes();
130 const label nPhases = phaseTypes.size();
132 if (compModel.nPhase() == 1)
134 stateLabels = compModel.stateLabels()[0];
141 p.Y_.setSize(nPhases, 0.0);
151 "Y" + phaseTypes[j] + stateLabels[j],
168 template<
class ParcelType>
169 template<
class CloudType>
176 template<
class ParcelType>
177 template<
class CloudType,
class CompositionType>
181 const CompositionType& compModel
186 const label np =
c.size();
201 const wordList& phaseTypes = compModel.phaseTypes();
202 wordList stateLabels(phaseTypes.size(),
"");
203 if (compModel.nPhase() == 1)
205 stateLabels = compModel.stateLabels()[0];
214 "Y" + phaseTypes[j] + stateLabels[j],
234 template<
class ParcelType>
243 ParcelType::writeProperties(
os, filters, delim, namesOnly);
246 #define writeProp(Name, Value) \
247 ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
256 template<
class ParcelType>
257 template<
class CloudType>
264 ParcelType::readObjects(
c, obr);
268 template<
class ParcelType>
269 template<
class CloudType>
276 ParcelType::writeObjects(
c, obr);
280 template<
class ParcelType>
281 template<
class CloudType,
class CompositionType>
285 const CompositionType& compModel,
289 ParcelType::readObjects(
c, obr);
291 if (!
c.size())
return;
294 auto& mass0 = cloud::lookupIOField<scalar>(
"mass0", obr);
305 const wordList& phaseTypes = compModel.phaseTypes();
306 wordList stateLabels(phaseTypes.size(),
"");
307 if (compModel.nPhase() == 1)
309 stateLabels = compModel.stateLabels()[0];
314 const word fieldName =
"Y" + phaseTypes[j] + stateLabels[j];
315 auto&
Y = cloud::lookupIOField<scalar>(fieldName, obr);
328 template<
class ParcelType>
329 template<
class CloudType,
class CompositionType>
333 const CompositionType& compModel,
337 ParcelType::writeObjects(
c, obr);
339 const label np =
c.size();
343 auto& mass0 = cloud::createIOField<scalar>(
"mass0", np, obr);
354 const wordList& phaseTypes = compModel.phaseTypes();
355 wordList stateLabels(phaseTypes.size(),
"");
356 if (compModel.nPhase() == 1)
358 stateLabels = compModel.stateLabels()[0];
363 const word fieldName =
"Y" + phaseTypes[j] + stateLabels[j];
364 auto&
Y = cloud::createIOField<scalar>(fieldName, np, obr);
380 template<
class ParcelType>
387 if (
os.format() == IOstream::ASCII)
389 os << static_cast<const ParcelType&>(
p)
390 << token::SPACE <<
p.mass0()
391 << token::SPACE <<
p.Y();
395 os << static_cast<const ParcelType&>(
p);
398 reinterpret_cast<const char*
>(&
p.mass0_),
399 ReactingParcel<ParcelType>::sizeofFields
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
A class for handling words, derived from Foam::string.
A primitive field of type <T> with automated input and output.
static void readFields(CloudType &c, const CompositionType &compModel)
Read - composition supplied.
streamFormat format() const noexcept
Get the current stream format.
#define writeProp(Name, Value)
A class for handling character strings derived from std::string.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
Registry of regIOobjects.
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const noexcept
virtual bool endRawRead()=0
End of low-level raw binary read.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Templated base class for dsmc cloud.
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const noexcept
virtual bool check(const char *operation) const
Check IOstream status for given operation.
ReactingParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
OBJstream os(runTime.globalPath()/outputName)
PtrList< volScalarField > & Y
static void writeFields(const CloudType &c, const CompositionType &compModel)
Write - composition supplied.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
virtual bool beginRawRead()=0
Start of low-level raw binary read.
A List of wordRe with additional matching capabilities.
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly=false) const
Write individual parcel properties to stream.
void transfer(List< T > &list)
Transfer contents of the argument List into this.
const dimensionedScalar c
Speed of light in a vacuum.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Reacting parcel class with one/two-way coupling with the continuous phase.
static const std::size_t sizeofFields
Size in bytes of the fields.
void writeFields(const fvMesh &mesh, const wordHashSet &selectedFields, const bool writeFaceFields)
virtual Istream & read(token &)=0
Return next token from stream.