|
|
|
readerDatabase.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-2009 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 Foam::readerDatabase 00027 00028 Description 00029 Singleton caching Foam database and mesh and various. Used in Fv reader 00030 to keep track of data inbetween callbacks. 00031 00032 SourceFiles 00033 readerDatabase.C 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef readerDatabase_H 00038 #define readerDatabase_H 00039 00040 #include "wordList.H" 00041 #include "Time.H" 00042 #include "polyMesh.H" 00043 #include "label.H" 00044 00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00046 00047 namespace Foam 00048 { 00049 00050 // Forward declaration of classes 00051 class fvMesh; 00052 class fvMeshSubset; 00053 class Time; 00054 class fileName; 00055 class instant; 00056 00057 /*---------------------------------------------------------------------------*\ 00058 Class readerDatabase Declaration 00059 \*---------------------------------------------------------------------------*/ 00060 00061 class readerDatabase 00062 { 00063 // Private data 00064 00065 //- Names for protected Fieldview keywords. Gets set at construction 00066 // time. 00067 // Note: Should be static but this gives problem with construction 00068 // order since *this is static as well. 00069 HashTable<word> fieldviewNames_; 00070 00071 // Private data 00072 00073 //- Cached database 00074 Time* runTimePtr_; 00075 00076 //- Cached mesh, guaranteed uptodate with runTime. 00077 fvMeshSubset* meshPtr_; 00078 00079 //- Empty string or name of current set. 00080 word setName_; 00081 00082 //- Cell labels of polyHedra. Uptodate with meshPtr. 00083 labelList polys_; 00084 00085 //- All volScalarFields in all time directories 00086 wordList volScalarNames_; 00087 00088 //- All volVectorFields ,, 00089 wordList volVectorNames_; 00090 00091 00092 // Private Member Functions 00093 00094 //- Gets cell numbers of all polyHedra 00095 void getPolyHedra(); 00096 00097 //- Disallow default bitwise copy construct 00098 readerDatabase(const readerDatabase&); 00099 00100 //- Disallow default bitwise assignment 00101 void operator=(const readerDatabase&); 00102 00103 00104 public: 00105 00106 // Static 00107 00108 //- Debug flag. Note: uses envvar instead of controlDict since 00109 // *this is static as well. Might be initialized before controlDict 00110 // read. 00111 const static bool debug_; 00112 00113 00114 // Constructors 00115 00116 //- Construct null 00117 readerDatabase(); 00118 00119 00120 // Destructor 00121 00122 ~readerDatabase(); 00123 00124 00125 // Member Functions 00126 00127 // Access 00128 00129 const Time& runTime() const; 00130 00131 const fvMesh& mesh() const; 00132 00133 const labelList& polys() const; 00134 00135 const wordList& volScalarNames() const; 00136 00137 const wordList& volVectorNames() const; 00138 00139 //- Get fieldview compatible name. 00140 const word& getFvName(const word& foamName) const; 00141 00142 // Edit 00143 00144 //- Create database (if nessecary). 00145 // Returns true if new Time created, false if old one reused. 00146 // Optional fvMeshSubset using setName. 00147 bool setRunTime 00148 ( 00149 const fileName& rootDir, 00150 const fileName& caseName, 00151 const word& setName 00152 ); 00153 00154 //- Forcibly load mesh. 00155 void loadMesh(); 00156 00157 //- Set time (use this instead of database::setTime), updates 00158 // mesh as well and returns mesh update status 00159 polyMesh::readUpdateState setTime(const instant&, const label); 00160 00161 //- Set volScalarNames, volVectorNames. 00162 void setFieldNames(const wordList&, const wordList&); 00163 }; 00164 00165 00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00167 00168 } // End namespace Foam 00169 00170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00171 00172 #endif 00173 00174 // ************************************************************************* // |