1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
30 #include "IOPosition.H"
32 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
34 template<class ParticleType>
35 void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
37 IOPosition<ParticleType> ioP(*this);
41 ioP.readData(*this, checkClass);
51 WarningIn("Cloud<ParticleType>::initCloud(const bool checkClass)")
52 << "Cannot read particle positions file " << nl
53 << " " << ioP.path() << nl
54 << " assuming the initial cloud contains 0 particles." << endl;
59 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
61 template<class ParticleType>
62 Foam::Cloud<ParticleType>::Cloud
64 const polyMesh& pMesh,
72 initCloud(checkClass);
76 template<class ParticleType>
77 Foam::Cloud<ParticleType>::Cloud
79 const polyMesh& pMesh,
80 const word& cloudName,
84 cloud(pMesh, cloudName),
88 initCloud(checkClass);
92 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 template<class ParticleType>
95 Foam::IOobject Foam::Cloud<ParticleType>::fieldIOobject
97 const word& fieldName,
98 const IOobject::readOption r
113 template<class ParticleType>
114 template<class DataType>
115 void Foam::Cloud<ParticleType>::checkFieldIOobject
117 const Cloud<ParticleType>& c,
118 const IOField<DataType>& data
121 if (data.size() != c.size())
125 "void Cloud<ParticleType>::checkFieldIOobject"
126 "(const Cloud<ParticleType>&, const IOField<DataType>&) const"
127 ) << "Size of " << data.name()
128 << " field " << data.size()
129 << " does not match the number of particles " << c.size()
130 << abort(FatalError);
135 template<class ParticleType>
136 void Foam::Cloud<ParticleType>::readFields()
140 template<class ParticleType>
141 void Foam::Cloud<ParticleType>::writeFields() const
145 template<class ParticleType>
146 bool Foam::Cloud<ParticleType>::writeObject
148 IOstream::streamFormat fmt,
149 IOstream::versionNumber ver,
150 IOstream::compressionType cmp
156 return cloud::writeObject(fmt, ver, cmp);
165 // * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
167 template<class ParticleType>
168 Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
172 // Check state of Ostream
173 os.check("Ostream& operator<<(Ostream&, const Cloud<ParticleType>&)");
179 // ************************************************************************* //