|
|
|
Cloud.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Cloud 00027 00028 Description 00029 00030 SourceFiles 00031 Cloud.C 00032 CloudIO.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef Cloud_H 00037 #define Cloud_H 00038 00039 #include "cloud.H" 00040 #include "pointMesh.H" 00041 #include "IDLList.H" 00042 #include "IOField.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 template<class particleType> 00050 class Cloud; 00051 00052 template<class particleType> 00053 Ostream& operator<< 00054 ( 00055 Ostream&, 00056 const Cloud<particleType>& 00057 ); 00058 00059 00060 /*---------------------------------------------------------------------------*\ 00061 Class Cloud Declaration 00062 \*---------------------------------------------------------------------------*/ 00063 00064 template<class particleType> 00065 class Cloud 00066 : 00067 public cloud, 00068 public IDLList<particleType> 00069 { 00070 // Private data 00071 00072 const polyMesh& polyMesh_; 00073 00074 const faceList& allFaces_; 00075 const vectorField& points_; 00076 const cellList& cellFaces_; 00077 const vectorField& allFaceCentres_; 00078 const unallocLabelList& owner_; 00079 const unallocLabelList& neighbour_; 00080 00081 00082 public: 00083 00084 template<class particleT> 00085 friend class particle; 00086 00087 typedef typename IDLList<particleType>::iterator iterator; 00088 typedef typename IDLList<particleType>::const_iterator const_iterator; 00089 00090 00091 // Constructors 00092 00093 //- Construct from mesh and a list of particles 00094 Cloud 00095 ( 00096 const polyMesh& mesh, 00097 const IDLList<particleType>& particles 00098 ); 00099 00100 //- Construct from mesh by reading from file 00101 Cloud 00102 ( 00103 const polyMesh& mesh 00104 ); 00105 00106 00107 // Member Functions 00108 00109 // Access 00110 00111 //- Return the polyMesh reference 00112 const polyMesh& pMesh() const 00113 { 00114 return polyMesh_; 00115 } 00116 00117 //- Is this global face an internal face? 00118 bool internalFace(const label facei) const 00119 { 00120 return polyMesh_.isInternalFace(facei); 00121 } 00122 00123 //- Is this global face a boundary face? 00124 bool boundaryFace(const label facei) const 00125 { 00126 return !internalFace(facei); 00127 } 00128 00129 //- Which patch is this global face on 00130 label facePatch(const label facei) const 00131 { 00132 return polyMesh_.boundaryMesh().whichPatch(facei); 00133 } 00134 00135 //- Which face of this patch is this global face 00136 label patchFace(const label patchi, const label facei) const 00137 { 00138 return polyMesh_.boundaryMesh()[patchi].whichFace(facei); 00139 } 00140 00141 00142 // Edit 00143 00144 //- Transfer particle to cloud 00145 void addParticle(particleType* pPtr); 00146 00147 //- Remove particle from cloud and delete 00148 void deleteParticle(particleType&); 00149 00150 //- Move the particles 00151 // passing the TrackingData to the track function 00152 template<class TrackingData> 00153 void move(TrackingData& td); 00154 00155 //- Remap the cells of particles corresponding to the 00156 // mesh topology change 00157 virtual void autoMap(const mapPolyMesh&); 00158 00159 00160 // Read 00161 00162 //- Read and return a lagrangian data field 00163 IOobject fieldIOobject(const word& fieldName) const; 00164 00165 //- Read and return a lagrangian data field 00166 template<class Type> 00167 tmp<IOField<Type> > readField(const word& fieldName) const; 00168 00169 //- Read the field data for the cloud of particles 00170 void readFields(); 00171 00172 00173 // Write 00174 00175 virtual bool writeData(Ostream&) const; 00176 00177 //- Write the field data for the cloud of particles 00178 virtual void writeFields() const; 00179 00180 //- Write using given format, version and compression. 00181 // Only writes the cloud file if the Cloud isn't empty 00182 virtual bool writeObject 00183 ( 00184 IOstream::streamFormat fmt, 00185 IOstream::versionNumber ver, 00186 IOstream::compressionType cmp 00187 ) const; 00188 00189 00190 // Ostream Operator 00191 00192 friend Ostream& operator<< <particleType> 00193 ( 00194 Ostream&, 00195 const Cloud<particleType>& 00196 ); 00197 }; 00198 00199 00200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00201 00202 } // End namespace Foam 00203 00204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00205 00206 #ifdef NoRepository 00207 # include "Cloud.C" 00208 #endif 00209 00210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00211 00212 #endif 00213 00214 // ************************************************************************* // |