32 template<
class ParticleType>
38 template<
class ParticleType>
45 "uniform"/cloud::prefix/
name(),
47 IOobject::MUST_READ_IF_MODIFIED,
52 if (dictObj.headerOk())
54 const IOdictionary uniformPropsDict(dictObj);
56 const word procName(
"processor" +
Foam::name(Pstream::myProcNo()));
57 if (uniformPropsDict.found(procName))
59 uniformPropsDict.subDict(procName).lookup(
"particleCount")
60 >> ParticleType::particleCount_;
65 ParticleType::particleCount_ = 0;
70 template<
class ParticleType>
73 IOdictionary uniformPropsDict
79 "uniform"/cloud::prefix/
name(),
88 np[Pstream::myProcNo()] = ParticleType::particleCount_;
90 Pstream::listCombineGather(np, maxEqOp<label>());
91 Pstream::listCombineScatter(np);
96 uniformPropsDict.add(procName, dictionary());
97 uniformPropsDict.subDict(procName).add(
"particleCount", np[i]);
100 uniformPropsDict.writeObject
103 IOstream::currentVersion,
104 time().writeCompression()
109 template<
class ParticleType>
112 readCloudUniformProperties();
114 IOPosition<Cloud<ParticleType>> ioP(*
this);
118 ioP.readData(*
this, checkClass);
130 Pout<<
"Cannot read particle positions file:" <<
nl 131 <<
" " << ioP.objectPath() <<
nl 132 <<
"Assuming the initial cloud contains 0 particles." <<
endl;
139 polyMesh_.tetBasePtIs();
141 forAllIter(
typename Cloud<ParticleType>, *
this, pIter)
143 ParticleType&
p = pIter();
152 template<
class ParticleType>
156 const bool checkClass
167 initCloud(checkClass);
171 template<
class ParticleType>
175 const word& cloudName,
176 const bool checkClass
179 cloud(pMesh, cloudName),
187 initCloud(checkClass);
193 template<
class ParticleType>
196 const word& fieldName,
212 template<
class ParticleType>
213 template<
class DataType>
223 <<
"Size of " << data.
name()
224 <<
" field " << data.
size()
225 <<
" does not match the number of particles " << c.
size()
231 template<
class ParticleType>
232 template<
class DataType>
242 <<
"Size of " << data.
name()
243 <<
" field " << data.
size()
244 <<
" does not match the number of particles " << c.
size()
250 template<
class ParticleType>
255 template<
class ParticleType>
260 ParticleType::writeFields(*
this);
265 template<
class ParticleType>
273 writeCloudUniformProperties();
278 return cloud::writeObject(fmt, ver, cmp);
289 template<
class ParticleType>
290 Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
295 os.
check(
"Ostream& operator<<(Ostream&, const Cloud<ParticleType>&)");
#define forAll(list, i)
Loop across all elements in list.
void checkFieldIOobject(const Cloud< ParticleType > &c, const IOField< DataType > &data) const
Check lagrangian data field.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void checkFieldFieldIOobject(const Cloud< ParticleType > &c, const CompactIOField< Field< DataType >, DataType > &data) const
Check lagrangian data fieldfield.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
readOption
Enumeration defining the read options.
static word cloudPropertiesName
Name of cloud properties dictionary.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write using given format, version and compression.
Cloud(const polyMesh &mesh, const IDLList< ParticleType > &particles)
Construct from mesh and a list of particles.
Pre-declare SubField and related Field type.
A class for handling words, derived from string.
A cloud is a collection of lagrangian particles.
streamFormat
Enumeration for the format of data in the stream.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
Base cloud calls templated on particle type.
compressionType
Enumeration for the format of data in the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
prefixOSstream Pout(cout,"Pout")
virtual void writeFields() const
Write the field data for the cloud of particles Dummy at.
word name(const complex &)
Return a string representation of a complex.
virtual void readFields()
Read the field data for the cloud of particles. Dummy at.
A Field of objects of type <T> with automated input and output using a compact storage. Behaves like IOField except when binary output in case it writes a CompactListList.
Mesh consisting of general polyhedral cells.
IOobject fieldIOobject(const word &fieldName, const IOobject::readOption r) const
Helper to construct IOobject for field and current time.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A primitive field of type <T> with automated input and output.
const word & name() const
Return name.