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