Go to the documentation of this file.
36 const std::size_t Foam::particle::sizeofPosition
38 offsetof(particle, facei_) - offsetof(particle, coordinates_)
41 const std::size_t Foam::particle::sizeofFields
43 sizeof(particle) - offsetof(particle, coordinates_)
64 origProc_(Pstream::myProcNo()),
69 if (is.
format() == IOstream::ASCII)
71 is >> coordinates_ >> celli_ >> tetFacei_ >> tetPti_;
74 is >> facei_ >> stepFraction_ >> origProc_ >> origId_;
83 readRawScalar(is, coordinates_.data(), barycentric::nComponents);
91 readRawScalar(is, &stepFraction_);
102 is.
read(
reinterpret_cast<char*
>(&coordinates_), sizeofFields);
106 is.
read(
reinterpret_cast<char*
>(&coordinates_), sizeofPosition);
114 if (is.
format() == IOstream::ASCII)
116 is >>
p.position >>
p.celli;
134 readRawScalar(is,
p.position.data(), vector::nComponents);
140 readRawScalar(is, &
p.stepFraction);
159 is.
read(
reinterpret_cast<char*
>(&
p.position),
s);
169 is.
read(
reinterpret_cast<char*
>(&
p.position),
s);
176 stepFraction_ =
p.stepFraction;
177 origProc_ =
p.origProc;
187 "Particle initialised with a location outside of the mesh."
205 #define writeProp(Name, Value) \
206 particle::writeProperty(os, Name, Value, namesOnly, delim, filters)
214 writeProp(
"stepFraction", stepFraction_);
233 os.
write(
reinterpret_cast<const char*
>(&coordinates_), sizeofPosition);
257 p.position = position();
260 os.
write(
reinterpret_cast<const char*
>(&
p.position),
s);
285 reinterpret_cast<const char*
>(&
p.coordinates_),
286 particle::sizeofFields
void writeCoordinates(Ostream &os) const
Write the particle barycentric coordinates and cell info.
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.
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;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
streamFormat format() const noexcept
Get the current stream format.
A class for handling character strings derived from std::string.
#define writeProp(Name, Value)
Mesh consisting of general polyhedral cells.
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly) const
Write individual particle properties to stream.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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)....
static string propertyList()
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const
virtual void writePosition(Ostream &os) const
Write the particle position and cell id.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
static string propertyList_
String representation of properties.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Old particle positions content for OpenFOAM-1706 and earlier.
virtual bool beginRawRead()=0
Start of low-level raw binary read.
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const
A List of wordRe with additional matching capabilities.
label readRawLabel(Istream &is)
Read raw label from binary stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
virtual Istream & read(token &)=0
Return next token from stream.