33 template<
class ParticleType>
39 template<
class ParticleType>
42 typeIOobject<timeIOdictionary> dictObj
46 "uniform"/cloud::prefix/
name(),
48 IOobject::MUST_READ_IF_MODIFIED,
53 if (dictObj.headerOk())
55 const timeIOdictionary 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 timeIOdictionary 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 patchNbrProc_(patchNbrProc(pMesh)),
153 patchNbrProcPatch_(patchNbrProcPatch(pMesh)),
154 patchNonConformalCyclicPatches_(patchNonConformalCyclicPatches(pMesh)),
155 globalPositionsPtr_()
159 polyMesh_.tetBasePtIs();
160 polyMesh_.oldCellCentres();
162 initCloud(checkClass);
168 template<
class ParticleType>
171 const word& fieldName,
187 template<
class ParticleType>
188 template<
class DataType>
198 <<
"Size of " << data.
name()
199 <<
" field " << data.
size()
200 <<
" does not match the number of particles " << c.
size()
206 template<
class ParticleType>
207 template<
class DataType>
217 <<
"Size of " << data.
name()
218 <<
" field " << data.
size()
219 <<
" does not match the number of particles " << c.
size()
225 template<
class ParticleType>
228 ParticleType::writeFields(*
this);
232 template<
class ParticleType>
241 writeCloudUniformProperties();
244 return cloud::writeObject(fmt, ver, cmp, this->size());
250 template<
class ParticleType>
251 Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
256 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.