fvCellSet.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-2021 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::fvCellSet
26 
27 Description
28  Cell-set fvConstraint abstract base class. Provides a base set of controls
29  regarding the location where the fvConstraint is applied.
30 
31 Usage
32  Example usage:
33  \verbatim
34  constraint1
35  {
36  type <constraintType>
37 
38  // Apply everywhere
39  selectionMode all;
40 
41  // // Apply within a given cell set
42  // selectionMode cellSet;
43  // cellSet c0;
44 
45  // // Apply in cells containing a list of points
46  // selectionMode points;
47  // points
48  // (
49  // (2.25 0.5 0)
50  // (2.75 0.5 0)
51  // );
52 
53  ...
54  }
55  \endverbatim
56 
57 SourceFiles
58  fvCellSet.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef fvCellSet_H
63 #define fvCellSet_H
64 
65 #include "cellSet.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 class fvMesh;
73 
74 /*---------------------------------------------------------------------------*\
75  Class fvCellSet Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class fvCellSet
79 {
80 public:
81 
82  // Public data
83 
84  //- Enumeration for selection mode types
85  enum class selectionModeType
86  {
87  points,
88  cellSet,
89  cellZone,
90  all
91  };
92 
93  //- Word list of selection mode type names
96 
97 
98 private:
99 
100  // Private data
101 
102  const fvMesh& mesh_;
103 
104  //- Cell selection mode
105  selectionModeType selectionMode_;
106 
107  //- Name of cell set for "cellSet" and "cellZone" selectionMode
108  word cellSetName_;
109 
110  //- List of points for "points" selectionMode
111  List<point> points_;
112 
113  //- Set of cells to apply source to
114  mutable labelList cells_;
115 
116  //- Sum of cell volumes
117  mutable scalar V_;
118 
119 
120  // Private functions
121 
122  //- Read the coefficients from the given dictionary
123  void readCoeffs(const dictionary& dict);
124 
125  //- Set the cell set based on the user input selection mode
126  void setCellSet();
127 
128 
129 public:
130 
131  // Constructors
132 
133  //- Construct from components
134  fvCellSet
135  (
136  const dictionary& dict,
137  const fvMesh& mesh
138  );
139 
140 
141  //- Destructor
142  ~fvCellSet();
143 
144 
145  // Member Functions
146 
147  // Access
148 
149  //- Return const access to the cell selection mode
150  inline const selectionModeType& selectionMode() const;
151 
152  //- Return const access to the name of cell set for "cellSet"
153  // selectionMode
154  inline const word& cellSetName() const;
155 
156  //- Return const access to the total cell volume
157  inline scalar V() const;
158 
159  //- Return const access to the cell set
160  inline const labelList& cells() const;
161 
162 
163  // Mesh changes
164 
165  //- Update for mesh changes
166  void updateMesh(const mapPolyMesh&);
167 
168 
169  // IO
170 
171  //- Read coefficients dictionary
172  bool read(const dictionary& dict);
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #include "fvCellSetI.H"
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
dictionary dict
~fvCellSet()
Destructor.
Definition: fvCellSet.C:157
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
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
bool read(const dictionary &dict)
Read coefficients dictionary.
Definition: fvCellSet.C:169
void updateMesh(const mapPolyMesh &)
Update for mesh changes.
Definition: fvCellSet.C:163
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
scalar V() const
Return const access to the total cell volume.
Definition: fvCellSetI.H:41
const word & cellSetName() const
Return const access to the name of cell set for "cellSet".
Definition: fvCellSetI.H:35
const selectionModeType & selectionMode() const
Return const access to the cell selection mode.
Definition: fvCellSetI.H:29
const labelList & cells() const
Return const access to the cell set.
Definition: fvCellSetI.H:47
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
selectionModeType
Enumeration for selection mode types.
Definition: fvCellSet.H:84
static const NamedEnum< selectionModeType, 4 > selectionModeTypeNames_
Word list of selection mode type names.
Definition: fvCellSet.H:94
fvCellSet(const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: fvCellSet.C:141
Namespace for OpenFOAM.