initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / graphics / fieldview9Reader / readerDatabase.H
blob346896572a08d3d4c230ef027e9c08aa47f63d2d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 Class
26     Foam::readerDatabase
28 Description
29     Singleton caching Foam database and mesh and various. Used in Fv reader
30     to keep track of data inbetween callbacks.
32 SourceFiles
33     readerDatabase.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef readerDatabase_H
38 #define readerDatabase_H
40 #include "wordList.H"
41 #include "Time.H"
42 #include "polyMesh.H"
43 #include "label.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 // Forward declaration of classes
51 class fvMesh;
52 class fvMeshSubset;
53 class Time;
54 class fileName;
55 class instant;
57 /*---------------------------------------------------------------------------*\
58                            Class readerDatabase Declaration
59 \*---------------------------------------------------------------------------*/
61 class readerDatabase
63     // Private data
65         //- Names for protected Fieldview keywords. Gets set at construction
66         //  time.
67         //  Note: Should be static but this gives problem with construction
68         //  order since *this is static as well.
69         HashTable<word> fieldviewNames_;
71     // Private data
73         //- Cached database
74         Time* runTimePtr_;
76         //- Cached mesh, guaranteed uptodate with runTime.
77         fvMeshSubset* meshPtr_;
79         //- Empty string or name of current set.
80         word setName_;
82         //- Cell labels of polyHedra. Uptodate with meshPtr.
83         labelList polys_;
85         //- All volScalarFields in all time directories
86         wordList volScalarNames_;
88         //- All volVectorFields ,,
89         wordList volVectorNames_;
92     // Private Member Functions
94         //- Gets cell numbers of all polyHedra
95         void getPolyHedra();
97         //- Disallow default bitwise copy construct
98         readerDatabase(const readerDatabase&);
100         //- Disallow default bitwise assignment
101         void operator=(const readerDatabase&);
104 public:
106     // Static
108         //- Debug flag. Note: uses envvar instead of controlDict since
109         //  *this is static as well. Might be initialized before controlDict
110         //  read.
111         const static bool debug_;
114     // Constructors
116         //- Construct null
117         readerDatabase();
120     // Destructor
122         ~readerDatabase();
125     // Member Functions
127         // Access
129             const Time& runTime() const;
131             const fvMesh& mesh() const;
133             const labelList& polys() const;
135             const wordList& volScalarNames() const;
137             const wordList& volVectorNames() const;
139             //- Get fieldview compatible name.
140             const word& getFvName(const word& foamName) const;
142         // Edit
144             //- Create database (if nessecary).
145             //  Returns true if new Time created, false if old one reused.
146             //  Optional fvMeshSubset using setName.
147             bool setRunTime
148             (
149                 const fileName& rootDir,
150                 const fileName& caseName,
151                 const word& setName
152             );
154             //- Forcibly load mesh.
155             void loadMesh();
157             //- Set time (use this instead of database::setTime), updates
158             //  mesh as well and returns mesh update status
159             polyMesh::readUpdateState setTime(const instant&, const label);
161             //- Set volScalarNames, volVectorNames.
162             void setFieldNames(const wordList&, const wordList&);
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 } // End namespace Foam
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 #endif
174 // ************************************************************************* //