solverTemplate.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::solverTemplate
28 
29 Description
30  Class to store solver template specifications
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef solverTemplate_H
35 #define solverTemplate_H
36 
37 #include "boolList.H"
38 #include "wordList.H"
39 #include "dimensionSet.H"
40 #include "IOobject.H"
41 #include "Enum.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class Time;
49 
50 /*---------------------------------------------------------------------------*\
51  Class solverTemplate Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class solverTemplate
55 {
56 public:
57 
58  // Public enumerations
59 
60  //- Solver type
61  enum solverType
62  {
66  stUnknown
67  };
68 
69  //- Solver type names
71 
72 
73 private:
74 
75  // Private data
76 
77  //- Solver type
78  solverType solverType_;
79 
80  //- Multi-region flag
81  bool multiRegion_;
82 
83 
84  // Per-region info
85 
86  //- Region types
87  wordList regionTypes_;
88 
89  //- Region names
90  wordList regionNames_;
91 
92  //- Field names
93  List<wordList> fieldNames_;
94 
95  //- Field types
96  List<wordList> fieldTypes_;
97 
98  //- Field dimensions
99  List<PtrList<dimensionSet>> fieldDimensions_;
100 
101 
102  // Public member functions
103 
104  //- Read a word from a dictionary (offers some protection...)
105  word readFromDict
106  (
107  IOobject& dictHeader,
108  const word& entryName
109  ) const;
110 
111  //- Read fluid region templates
112  dictionary readFluidFieldTemplates
113  (
114  const word& regionName,
115  const fileName& baseDir,
116  const dictionary& solverDict,
117  const Time& runTime
118  ) const;
119 
120  //- Read solid region templates
121  dictionary readSolidFieldTemplates
122  (
123  const word& regionName,
124  const dictionary& solverDict
125  ) const;
126 
127  //- Set the properties for region with index regionI
128  void setRegionProperties
129  (
130  const dictionary& dict,
131  const word& regionType,
132  const word& regionName,
133  const label regionI
134  );
135 
136 
137 public:
138 
139  //- Constructor
141  (
142  const fileName& baseDir,
143  const Time& runTime,
144  const word& regionName
145  );
146 
147 
148  // Public member functions
149 
150  //- Solver type name
151  word type() const;
152 
153  //- Return the multi-region flag
154  bool multiRegion() const;
155 
156  //- Return the number of regions
157  label nRegion() const;
158 
159 
160  // Per-region info
161 
162  //- Return the region type
163  const word& regionType(const label regionI) const;
164 
165  //- Return the region name
166  const word& regionName(const label regionI) const;
167 
168  //- Return the field names
169  const wordList& fieldNames(const label regionI) const;
170 
171  //- Return the field types
172  const wordList& fieldTypes(const label regionI) const;
173 
174  //- Return the field dimensions
176  (
177  const label regionI
178  ) const;
179 };
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::Enum< solverType >
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
boolList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::solverTemplate::fieldNames
const wordList & fieldNames(const label regionI) const
Return the field names.
Foam::solverTemplate::solverType
solverType
Solver type.
Definition: solverTemplate.H:60
Foam::solverTemplate::stCompressible
Definition: solverTemplate.H:62
Foam::solverTemplate::stBuoyant
Definition: solverTemplate.H:64
Foam::solverTemplate
Class to store solver template specifications.
Definition: solverTemplate.H:53
Foam::solverTemplate::solverTypeNames_
static const Enum< solverType > solverTypeNames_
Solver type names.
Definition: solverTemplate.H:69
Foam::solverTemplate::fieldDimensions
const PtrList< dimensionSet > & fieldDimensions(const label regionI) const
Return the field dimensions.
Foam::solverTemplate::stUnknown
Definition: solverTemplate.H:65
Foam::solverTemplate::regionName
const word & regionName(const label regionI) const
Return the region name.
wordList.H
Foam::solverTemplate::solverTemplate
solverTemplate(const fileName &baseDir, const Time &runTime, const word &regionName)
Constructor.
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
Foam::solverTemplate::stIncompressible
Definition: solverTemplate.H:63
dimensionSet.H
dict
dictionary dict
Definition: searchingEngine.H:14
IOobject.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::solverTemplate::fieldTypes
const wordList & fieldTypes(const label regionI) const
Return the field types.
Foam::solverTemplate::nRegion
label nRegion() const
Return the number of regions.
Foam::List< word >
Foam::solverTemplate::type
word type() const
Solver type name.
Foam::solverTemplate::multiRegion
bool multiRegion() const
Return the multi-region flag.
Foam::solverTemplate::regionType
const word & regionType(const label regionI) const
Return the region type.
Enum.H