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),
158 initCloud(checkClass);
164 template<
class ParticleType>
167 const word& fieldName,
183 template<
class ParticleType>
184 template<
class DataType>
194 <<
"Size of " << data.
name()
195 <<
" field " << data.
size()
196 <<
" does not match the number of particles " << c.
size()
202 template<
class ParticleType>
203 template<
class DataType>
213 <<
"Size of " << data.
name()
214 <<
" field " << data.
size()
215 <<
" does not match the number of particles " << c.
size()
221 template<
class ParticleType>
224 ParticleType::writeFields(*
this);
228 template<
class ParticleType>
237 writeCloudUniformProperties();
240 return cloud::writeObject(fmt, ver, cmp, this->size());
246 template<
class ParticleType>
247 Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
252 os.
check(
"Ostream& operator<<(Ostream&, const Cloud<ParticleType>&)");
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool valid) const
Write using given format, version and compression.
#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.
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.
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.