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>
224 "void Cloud<ParticleType>::checkFieldIOobject" 225 "(const Cloud<ParticleType>&, const IOField<DataType>&) const" 226 ) <<
"Size of " << data.
name()
227 <<
" field " << data.
size()
228 <<
" does not match the number of particles " << c.
size()
234 template<
class ParticleType>
235 template<
class DataType>
246 "void Cloud<ParticleType>::checkFieldFieldIOobject" 248 "const Cloud<ParticleType>&, " 249 "const CompactIOField<Field<DataType>, DataType>&" 251 ) <<
"Size of " << data.
name()
252 <<
" field " << data.
size()
253 <<
" does not match the number of particles " << c.
size()
259 template<
class ParticleType>
264 template<
class ParticleType>
269 ParticleType::writeFields(*
this);
274 template<
class ParticleType>
282 writeCloudUniformProperties();
287 return cloud::writeObject(fmt, ver, cmp);
298 template<
class ParticleType>
299 Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
304 os.
check(
"Ostream& operator<<(Ostream&, const Cloud<ParticleType>&)");
word name(const complex &)
Return a string representation of a complex.
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write using given format, version and compression.
#define forAllIter(Container, container, iter)
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.
A class for handling words, derived from string.
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.
virtual void writeFields() const
Write the field data for the cloud of particles Dummy at.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void readFields(const Mesh &mesh, const IOobjectList &objects, PtrList< GeoField > &fields)
streamFormat
Enumeration for the format of data in the stream.
readOption
Enumeration defining the read options.
A cloud is a collection of lagrangian particles.
Pre-declare SubField and related Field type.
errorManip< error > abort(error &err)
const word & name() const
Return name.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
compressionType
Enumeration for the format of data in the stream.
void checkFieldIOobject(const Cloud< ParticleType > &c, const IOField< DataType > &data) const
Check lagrangian data field.
Mesh consisting of general polyhedral cells.
virtual void readFields()
Read the field data for the cloud of particles. Dummy at.
void checkFieldFieldIOobject(const Cloud< ParticleType > &c, const CompactIOField< Field< DataType >, DataType > &data) const
Check lagrangian data fieldfield.
List< label > labelList
A List of labels.
static word cloudPropertiesName
Name of cloud properties dictionary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Base cloud calls templated on particle type.
Cloud(const polyMesh &mesh, const IDLList< ParticleType > &particles)
Construct from mesh and a list of particles.
IOobject fieldIOobject(const word &fieldName, const IOobject::readOption r) const
Helper to construct IOobject for field and current time.
prefixOSstream Pout(cout,"Pout")
A primitive field of type <T> with automated input and output.