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-2022 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 class polyMeshMap;
74 class polyDistributionMap;
75 
76 /*---------------------------------------------------------------------------*\
77  Class fvCellSet Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class fvCellSet
81 {
82 public:
83 
84  // Public data
85 
86  //- Enumeration for selection mode types
87  enum class selectionModeType
88  {
89  points,
90  cellSet,
91  cellZone,
92  all
93  };
94 
95  //- Word list of selection mode type names
98 
99 
100 private:
101 
102  // Private data
103 
104  const fvMesh& mesh_;
105 
106  //- Cell selection mode
107  selectionModeType selectionMode_;
108 
109  //- Name of cell set for "cellSet" and "cellZone" selectionMode
110  word cellSetName_;
111 
112  //- List of points for "points" selectionMode
113  List<point> points_;
114 
115  //- Set of cells to apply source to
116  mutable labelList cells_;
117 
118  //- Sum of cell volumes
119  mutable scalar V_;
120 
121 
122  // Private functions
123 
124  //- Read the coefficients from the given dictionary
125  void readCoeffs(const dictionary& dict);
126 
127  //- Set the cells
128  void setCells();
129 
130  //- Set the sum of scalar volumes
131  void setV();
132 
133 
134 public:
135 
136  // Constructors
137 
138  //- Construct from components
139  fvCellSet
140  (
141  const dictionary& dict,
142  const fvMesh& mesh
143  );
144 
145 
146  //- Destructor
147  ~fvCellSet();
148 
149 
150  // Member Functions
151 
152  // Access
153 
154  //- Return const access to the cell selection mode
155  inline const selectionModeType& selectionMode() const;
156 
157  //- Return const access to the name of cell set for "cellSet"
158  // selectionMode
159  inline const word& cellSetName() const;
160 
161  //- Return const access to the total cell volume
162  inline scalar V() const;
163 
164  //- Return const access to the cell set
165  inline const labelList& cells() const;
166 
167 
168  // Mesh changes
169 
170  //- Update for mesh motion
171  void movePoints();
172 
173  //- Update topology using the given map
174  void topoChange(const polyTopoChangeMap&);
175 
176  //- Update from another mesh using the given map
177  void mapMesh(const polyMeshMap&);
178 
179  //- Redistribute or update using the given distribution map
180  void distribute(const polyDistributionMap&);
181 
182 
183  // IO
184 
185  //- Read coefficients dictionary
186  bool read(const dictionary& dict);
187 };
188 
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 } // End namespace Foam
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #include "fvCellSetI.H"
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #endif
201 
202 // ************************************************************************* //
dictionary dict
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: fvCellSet.C:187
~fvCellSet()
Destructor.
Definition: fvCellSet.C:164
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:201
void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: fvCellSet.C:180
fvMesh & mesh
void movePoints()
Update for mesh motion.
Definition: fvCellSet.C:170
void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: fvCellSet.C:194
A class for handling words, derived from string.
Definition: word.H:59
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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:95
selectionModeType
Enumeration for selection mode types.
Definition: fvCellSet.H:86
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
static const NamedEnum< selectionModeType, 4 > selectionModeTypeNames_
Word list of selection mode type names.
Definition: fvCellSet.H:96
fvCellSet(const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: fvCellSet.C:148
Namespace for OpenFOAM.