All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
volRegion.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::volRegion
26 
27 Description
28  Volume (cell) region selection class.
29 
30  Examples of function object specification:
31  \verbatim
32  volRegion0
33  {
34  .
35  .
36  regionType cellZone;
37  name c0;
38  .
39  .
40  }
41 
42  volRegionAll
43  {
44  .
45  .
46  regionType all;
47  .
48  .
49  }
50  \endverbatim
51 
52 Usage
53  \table
54  Property | Description | Required | Default value
55  regionType | cellZone or all | no | all
56  name | Name of cellZone if required | no |
57  \endtable
58 
59 See also
60  Foam::functionObject
61 
62 SourceFiles
63  volRegion.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef functionObjects_volRegion_H
68 #define functionObjects_volRegion_H
69 
70 #include "writeFile.H"
71 #include "NamedEnum.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 
78 // Forward declaration of classes
79 class fvMesh;
80 
81 namespace functionObjects
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class volRegion Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 class volRegion
89 {
90  // Private member data
91 
92  const fvMesh& mesh_;
93 
94  // Cache integral properties of the region for writeFileHeader
95  label nCells_;
96  scalar V_;
97 
98 
99 public:
100 
101  // Public data types
103  //- Region type enumeration
104  enum regionTypes
105  {
106  vrtCellZone,
107  vrtAll
108  };
109 
110  //- Region type names
112 
113 
114 protected:
115 
116  // Protected data
117 
118  //- Region type
121  //- Region name (patch, zone, etc.)
123 
124  //- Region ID (patch ID, zone ID, etc.)
126 
127 
128  // Protected Member Functions
129 
130  //- Output file header information
131  void writeFileHeader(const writeFile& wf, Ostream& file);
132 
134 public:
135 
136  //- Run-time type information
137  TypeName("volRegion");
138 
140  // Constructors
141 
142  //- Construct from fvMesh and dictionary
143  volRegion
144  (
145  const fvMesh& mesh,
146  const dictionary& dict
147  );
148 
149 
150  //- Destructor
151  virtual ~volRegion();
152 
153 
154  // Public Member Functions
155 
156  //- Read from dictionary
157  bool read(const dictionary&);
158 
159  //- Return the region type
160  inline const regionTypes& regionType() const;
161 
162  //- Return the local list of cell IDs
163  const labelList& cellIDs() const;
164 
165  //- Return the number of cells in the region
166  label nCells() const;
167 
168  //- Return total volume of the region
169  scalar V() const;
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace functionObjects
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #include "volRegionI.H"
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
dictionary dict
static const NamedEnum< regionTypes, 2 > regionTypeNames_
Region type names.
Definition: volRegion.H:125
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const regionTypes & regionType() const
Return the region type.
Definition: volRegionI.H:29
word regionName_
Region name (patch, zone, etc.)
Definition: volRegion.H:136
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
label regionID_
Region ID (patch ID, zone ID, etc.)
Definition: volRegion.H:139
bool read(const dictionary &)
Read from dictionary.
Definition: volRegion.C:105
label nCells() const
Return the number of cells in the region.
Definition: volRegion.C:168
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
scalar V() const
Return total volume of the region.
Definition: volRegion.C:181
volRegion(const fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
Definition: volRegion.C:74
TypeName("volRegion")
Run-time type information.
void writeFileHeader(const writeFile &wf, Ostream &file)
Output file header information.
Definition: volRegion.C:58
const labelList & cellIDs() const
Return the local list of cell IDs.
Definition: volRegion.C:155
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual ~volRegion()
Destructor.
Definition: volRegion.C:98
regionTypes regionType_
Region type.
Definition: volRegion.H:133
functionObject base class for writing single files
Definition: writeFile.H:55
regionTypes
Region type enumeration.
Definition: volRegion.H:118
Namespace for OpenFOAM.