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 initCloud(checkClass);
162 template<
class ParticleType>
165 const word& fieldName,
181 template<
class ParticleType>
182 template<
class DataType>
192 <<
"Size of " << data.
name()
193 <<
" field " << data.
size()
194 <<
" does not match the number of particles " << c.
size()
200 template<
class ParticleType>
201 template<
class DataType>
211 <<
"Size of " << data.
name()
212 <<
" field " << data.
size()
213 <<
" does not match the number of particles " << c.
size()
219 template<
class ParticleType>
222 ParticleType::writeFields(*
this);
226 template<
class ParticleType>
235 writeCloudUniformProperties();
238 return cloud::writeObject(fmt, ver, cmp, this->size());
244 template<
class ParticleType>
245 Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
250 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.
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.