33 template<
class ParticleType>
39 template<
class ParticleType>
46 "uniform"/cloud::prefix/
name(),
48 IOobject::MUST_READ_IF_MODIFIED,
53 if (dictObj.typeHeaderOk<IOdictionary>(
true))
55 const IOdictionary uniformPropsDict(dictObj);
57 const word procName(
"processor" +
Foam::name(Pstream::myProcNo()));
58 if (uniformPropsDict.found(procName))
60 uniformPropsDict.subDict(procName).lookup(
"particleCount")
61 >> ParticleType::particleCount_;
66 ParticleType::particleCount_ = 0;
71 template<
class ParticleType>
74 IOdictionary uniformPropsDict
80 "uniform"/cloud::prefix/
name(),
89 np[Pstream::myProcNo()] = ParticleType::particleCount_;
91 Pstream::listCombineGather(np, maxEqOp<label>());
92 Pstream::listCombineScatter(np);
97 uniformPropsDict.add(procName, dictionary());
98 uniformPropsDict.subDict(procName).add(
"particleCount", np[i]);
101 uniformPropsDict.writeObject
104 IOstream::currentVersion,
105 time().writeCompression(),
111 template<
class ParticleType>
114 readCloudUniformProperties();
116 IOPosition<Cloud<ParticleType>> ioP(*
this);
118 bool valid = ioP.headerOk();
119 Istream& is = ioP.readStream(checkClass ? typeName :
"", valid);
122 ioP.readData(is, *
this);
128 Pout<<
"Cannot read particle positions file:" <<
nl 129 <<
" " << ioP.objectPath() <<
nl 130 <<
"Assuming the initial cloud contains 0 particles." <<
endl;
136 polyMesh_.tetBasePtIs();
142 template<
class ParticleType>
146 const word& cloudName,
147 const bool checkClass
150 cloud(pMesh, cloudName),
152 globalPositionsPtr_()
156 polyMesh_.tetBasePtIs();
157 polyMesh_.oldCellCentres();
159 initCloud(checkClass);
165 template<
class ParticleType>
168 const word& fieldName,
184 template<
class ParticleType>
185 template<
class DataType>
195 <<
"Size of " << data.
name()
196 <<
" field " << data.
size()
197 <<
" does not match the number of particles " << c.
size()
203 template<
class ParticleType>
204 template<
class DataType>
214 <<
"Size of " << data.
name()
215 <<
" field " << data.
size()
216 <<
" does not match the number of particles " << c.
size()
222 template<
class ParticleType>
225 ParticleType::writeFields(*
this);
229 template<
class ParticleType>
238 writeCloudUniformProperties();
241 return cloud::writeObject(fmt, ver, cmp, this->size());
247 template<
class ParticleType>
248 Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
253 os.
check(
"Ostream& operator<<(Ostream&, const Cloud<ParticleType>&)");
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
void checkFieldFieldIOobject(const Cloud< ParticleType > &c, const CompactIOField< Field< DataType >, DataType > &data) const
Check lagrangian data fieldfield.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool write=true) const
Write using given format, version and compression.
Cloud(const polyMesh &mesh, const word &cloudName, const IDLList< ParticleType > &particles)
Construct from mesh and a list of particles.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
Return the number of particles in the cloud.
readOption
Enumeration defining the read options.
static word cloudPropertiesName
Name of cloud properties dictionary.
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...
word name(const complex &)
Return a string representation of a complex.
virtual void writeFields() const
Write the field data for the cloud of particles Dummy at.
prefixOSstream Pout(cout, "Pout")
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.
void checkFieldIOobject(const Cloud< ParticleType > &c, const IOField< DataType > &data) const
Check lagrangian data field.
Mesh consisting of general polyhedral cells.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
IOobject fieldIOobject(const word &fieldName, const IOobject::readOption r) const
Helper to construct IOobject for field and current time.
A primitive field of type <T> with automated input and output.