volRegion.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 | Copyright (C) 2016 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 Group
28  grpFieldFunctionObjects
29 
30 Description
31  Volume (cell) region selection class.
32 
33  Examples of function object specification:
34  \verbatim
35  volRegion0
36  {
37  .
38  .
39  regionType cellZone;
40  name c0;
41  .
42  .
43  }
44 
45  volRegionAll
46  {
47  .
48  .
49  regionType all;
50  .
51  .
52  }
53  \endverbatim
54 
55 Usage
56  \table
57  Property | Description | Required | Default value
58  regionType | cellZone or all | no | all
59  name | Name of cellZone if required | no |
60  \endtable
61 
62 See also
63  Foam::functionObject
64 
65 SourceFiles
66  volRegion.C
67 
68 \*---------------------------------------------------------------------------*/
69 
70 #ifndef functionObjects_volRegion_H
71 #define functionObjects_volRegion_H
72 
73 #include "writeFile.H"
74 #include "NamedEnum.H"
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 namespace Foam
79 {
80 
81 // Forward declaration of classes
82 class fvMesh;
83 
84 namespace functionObjects
85 {
86 
87 /*---------------------------------------------------------------------------*\
88  Class volRegion Declaration
89 \*---------------------------------------------------------------------------*/
90 
91 class volRegion
92 {
93  // Private member data
94 
95  const fvMesh& mesh_;
96 
97  // Cache integral properties of the region for writeFileHeader
98  label nCells_;
99  scalar V_;
100 
101 
102 public:
103 
104  // Public data types
106  //- Region type enumeration
107  enum regionTypes
108  {
109  vrtCellZone,
110  vrtAll
111  };
112 
113  //- Region type names
115 
116 
117 protected:
118 
119  // Protected data
120 
121  //- Region type
124  //- Region name (patch, zone, etc.)
126 
127  //- Region ID (patch ID, zone ID, etc.)
129 
130 
131  // Protected Member Functions
132 
133  //- Output file header information
134  void writeFileHeader(const writeFile& wf, Ostream& file);
135 
137 public:
138 
139  //- Run-time type information
140  TypeName("volRegion");
141 
143  // Constructors
144 
145  //- Construct from fvMesh and dictionary
146  volRegion
147  (
148  const fvMesh& mesh,
149  const dictionary& dict
150  );
151 
152 
153  //- Destructor
154  virtual ~volRegion();
155 
156 
157  // Public Member Functions
158 
159  //- Read from dictionary
160  bool read(const dictionary&);
161 
162  //- Return the region type
163  inline const regionTypes& regionType() const;
164 
165  //- Return the local list of cell IDs
166  const labelList& cellIDs() const;
167 
168  //- Return the number of cells in the region
169  label nCells() const;
170 
171  //- Return total volume of the region
172  scalar V() const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace functionObjects
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #include "volRegionI.H"
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
dictionary dict
static const NamedEnum< regionTypes, 2 > regionTypeNames_
Region type names.
Definition: volRegion.H:128
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:139
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
label regionID_
Region ID (patch ID, zone ID, etc.)
Definition: volRegion.H:142
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:53
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:136
functionObject base class for writing single files
Definition: writeFile.H:55
regionTypes
Region type enumeration.
Definition: volRegion.H:121
Namespace for OpenFOAM.