cellSetOption.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) 2011-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::fv::cellSetOption
26 
27 Description
28  Cell-set options abstract base class. Provides a base set of controls,
29  e.g.:
30  \verbatim
31  type scalarExplicitSource // Source type
32  active on; // on/off switch
33 
34  timeStart 0.0; // Start time
35  duration 1000.0; // Duration
36  selectionMode cellSet; // cellSet, points, cellZone
37  .
38  .
39  .
40  \endverbatim
41 
42 Note
43  Source/sink options are to be added to the equation R.H.S.
44 
45 SourceFiles
46  cellSetOption.C
47  cellSetOptionIO.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef cellSetOption_H
52 #define cellSetOption_H
53 
54 #include "fvOption.H"
55 #include "cellSet.H"
56 #include "fvMesh.H"
57 #include "Time.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 namespace fv
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class cellSetOption Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class cellSetOption
71 :
72  public option
73 {
74 public:
75 
76  // Public data
77 
78  //- Enumeration for selection mode types
80  {
84  smAll
85  };
86 
87  //- Word list of selection mode type names
90 
91 
92 protected:
93 
94  // Protected data
95 
96  //- Time start
97  scalar timeStart_;
98 
99  //- Duration
100  scalar duration_;
101 
102  //- Cell selection mode
104 
105  //- Name of cell set for "cellSet" and "cellZone" selectionMode
107 
108  //- List of points for "points" selectionMode
110 
111  //- Set of cells to apply source to
113 
114  //- Sum of cell volumes
115  scalar V_;
116 
117 
118  // Protected functions
119 
120  //- Set the cellSet or points selection
121  void setSelection(const dictionary& dict);
122 
123  //- Set the cell set based on the user input selection mode
124  void setCellSet();
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("cellSetOption");
131 
132 
133  // Constructors
134 
135  //- Construct from components
137  (
138  const word& name,
139  const word& modelType,
140  const dictionary& dict,
141  const fvMesh& mesh
142  );
143 
144 
145  //- Destructor
146  virtual ~cellSetOption();
147 
148 
149  // Member Functions
150 
151  // Access
152 
153  //- Return const access to the time start
154  inline scalar timeStart() const;
155 
156  //- Return const access to the duration
157  inline scalar duration() const;
158 
159  //- Return true if within time limits
160  inline bool inTimeLimits(const scalar time) const;
161 
162  //- Return const access to the cell selection mode
163  inline const selectionModeType& selectionMode() const;
164 
165  //- Return const access to the name of cell set for "cellSet"
166  // selectionMode
167  inline const word& cellSetName() const;
168 
169  //- Return const access to the total cell volume
170  inline scalar V() const;
171 
172  //- Return const access to the cell set
173  inline const labelList& cells() const;
174 
175 
176  // Edit
177 
178  //- Return access to the time start
179  inline scalar& timeStart();
180 
181  //- Return access to the duration
182  inline scalar& duration();
183 
184 
185  // Checks
186 
187  //- Is the source active?
188  virtual bool isActive();
189 
190 
191  // IO
192 
193  //- Read source dictionary
194  virtual bool read(const dictionary& dict);
195 };
196 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 } // End namespace fv
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #include "cellSetOptionI.H"
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
selectionModeType selectionMode_
Cell selection mode.
scalar V_
Sum of cell volumes.
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
static const NamedEnum< selectionModeType, 4 > selectionModeTypeNames_
Word list of selection mode type names.
Definition: cellSetOption.H:88
const labelList & cells() const
Return const access to the cell set.
scalar timeStart() const
Return const access to the time start.
scalar duration_
Duration.
Definition: cellSetOption.H:99
virtual bool read(const dictionary &dict)
Read source dictionary.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
scalar V() const
Return const access to the total cell volume.
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual ~cellSetOption()
Destructor.
virtual bool isActive()
Is the source active?
selectionModeType
Enumeration for selection mode types.
Definition: cellSetOption.H:78
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
scalar duration() const
Return const access to the duration.
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
const word & cellSetName() const
Return const access to the name of cell set for "cellSet".
void setCellSet()
Set the cell set based on the user input selection mode.
Definition: cellSetOption.C:92
labelList cells_
Set of cells to apply source to.
void setSelection(const dictionary &dict)
Set the cellSet or points selection.
Definition: cellSetOption.C:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
List< point > points_
List of points for "points" selectionMode.
Cell-set options abstract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:69
TypeName("cellSetOption")
Runtime type information.
word cellSetName_
Name of cell set for "cellSet" and "cellZone" selectionMode.
bool inTimeLimits(const scalar time) const
Return true if within time limits.
scalar timeStart_
Time start.
Definition: cellSetOption.H:96
Namespace for OpenFOAM.
const selectionModeType & selectionMode() const
Return const access to the cell selection mode.
Finite volume options abstract base class. Provides a base set of controls, e.g.: ...
Definition: fvOption.H:66