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-2023 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::fvCellSet
26 
27 Description
28  General run-time selected cell set selection class for fvMesh
29 
30  Currently supports cell selection from:
31  - a set of points
32  - a cellSet
33  - a cellZone
34  - all of the cells.
35 
36 Usage
37  Examples:
38  \verbatim
39  // Select all cells
40  select all;
41 
42  // Select the cells within the given cellSet
43  select cellSet; // Optional
44  cellSet rotor;
45 
46  // Select the cells within the given cellZone
47  select cellZone; // Optional
48  cellZone rotor;
49 
50  // Select the cells containing a list of points
51  select points; // Optional
52  points
53  (
54  (2.25 0.5 0)
55  (2.75 0.5 0)
56  );
57  \endverbatim
58 
59 See also
60  Foam::polyCellSet
61 
62 SourceFiles
63  fvCellSet.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef fvCellSet_H
68 #define fvCellSet_H
69 
70 #include "polyCellSet.H"
71 #include "writeFile.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 
78 class fvMesh;
79 class polyMeshMap;
80 class polyDistributionMap;
81 
82 /*---------------------------------------------------------------------------*\
83  Class fvCellSet Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 class fvCellSet
87 :
88  public polyCellSet
89 {
90  // Private data
91 
92  //- Reference to the mesh
93  const fvMesh& mesh_;
94 
95  //- Sum of cell volumes
96  mutable scalar V_;
97 
98 
99  // Private functions
100 
101  //- Set the sum of scalar volumes
102  void setV();
103 
104 
105 protected:
106 
107  // Protected Member Functions
108 
109  //- Output file header information
110  void writeFileHeader
111  (
112  const functionObjects::writeFile& wf,
113  Ostream& file
114  );
115 
116 
117 public:
118 
119  // Constructors
120 
121  //- Construct from mesh. Will select all.
122  fvCellSet(const fvMesh& mesh);
123 
124  //- Construct from mesh and dictionary
125  fvCellSet(const fvMesh& mesh, const dictionary& dict);
126 
127 
128  //- Destructor
129  ~fvCellSet();
130 
131 
132  // Member Functions
133 
134  // Access
135 
136  //- Return const access to the total cell volume
137  inline scalar V() const;
138 
139 
140  // Mesh changes
141 
142  //- Update for mesh motion
143  void movePoints();
144 
145  //- Update topology using the given map
146  void topoChange(const polyTopoChangeMap&);
147 
148  //- Update from another mesh using the given map
149  void mapMesh(const polyMeshMap&);
150 
151  //- Redistribute or update using the given distribution map
152  void distribute(const polyDistributionMap&);
153 
154 
155  // IO
156 
157  //- Read coefficients dictionary
158  bool read(const dictionary& dict);
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #include "fvCellSetI.H"
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
functionObject base class for writing single files
Definition: writeFile.H:56
General run-time selected cell set selection class for fvMesh.
Definition: fvCellSet.H:88
scalar V() const
Return const access to the total cell volume.
Definition: fvCellSetI.H:28
~fvCellSet()
Destructor.
Definition: fvCellSet.C:89
void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: fvCellSet.C:102
void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: fvCellSet.C:116
void movePoints()
Update for mesh motion.
Definition: fvCellSet.C:95
bool read(const dictionary &dict)
Read coefficients dictionary.
Definition: fvCellSet.C:123
fvCellSet(const fvMesh &mesh)
Construct from mesh. Will select all.
Definition: fvCellSet.C:69
void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: fvCellSet.C:109
void writeFileHeader(const functionObjects::writeFile &wf, Ostream &file)
Output file header information.
Definition: fvCellSet.C:55
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
General run-time selected cell set selection class for polyMesh.
Definition: polyCellSet.H:82
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Namespace for OpenFOAM.
dictionary dict