pointMesh.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-2026 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::pointMesh
26 
27 Description
28  Mesh representing a set of points created from polyMesh.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef pointMesh_H
33 #define pointMesh_H
34 
35 #include "DemandDrivenMeshObject.H"
36 #include "polyMesh.H"
37 #include "pointBoundaryMesh.H"
38 #include "pointFieldsFwd.H"
39 #include "SlicedDimensionedField.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class pointMesh Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class pointMesh
51 :
52  public DemandDrivenMeshObject<polyMesh, PermanentMeshObject, pointMesh>
53 {
54  // Private Data
55 
56  //- Reference to polyMesh
57  const polyMesh& mesh_;
58 
59  //- Boundary mesh
60  pointBoundaryMesh boundary_;
61 
62  //- Dimensioned points
64 
65 
66 protected:
67 
68  //- Declare friendship with the base mesh object so that it can use
69  // this class' protected constructors
70  friend class DemandDrivenMeshObject
71  <
72  polyMesh,
74  pointMesh
75  >;
76 
77 
78  // Protected Constructors
79 
80  //- Construct from polyMesh
81  explicit pointMesh(const polyMesh& pMesh);
82 
83 
84 public:
85 
86  // Public Typedefs
87 
88  //- Mesh type
89  typedef pointMesh Mesh;
90 
91  //- Boundary mesh type
93 
94  //- Zone type
95  typedef pointZone Zone;
96 
97  //- Patch field type
98  template<class Type>
100 
101  //- Field source type
102  template<class Type>
104 
105 
106  // Declare name of the class and its debug switch
107  ClassName("pointMesh");
108 
109 
110  // Static data
111 
112  //- Set of names of registered geometric fields
113  const static HashSet<word> geometryFields;
114 
115  //- Set of names of registered current-time geometric fields
116  const static HashSet<word> curGeometryFields;
117 
118 
119  // Constructors
120 
121  //- Disallow default bitwise copy construction
122  pointMesh(const pointMesh&) = delete;
123 
124 
125  //- Destructor
126  ~pointMesh();
127 
128 
129  // Member Functions
130 
131  //- Return reference to polyMesh
132  const polyMesh& poly() const
133  {
134  return mesh_;
135  }
136 
137  //- Return number of points
138  label size() const
139  {
140  return mesh_.nPoints();
141  }
142 
143  //- Return point locations
144  const DimensionedField<vector, pointMesh>& C() const;
145 
146  //- Return reference to boundary mesh
147  const pointBoundaryMesh& boundary() const
148  {
149  return boundary_;
150  }
151 
152  //- Return parallel info
153  const globalMeshData& globalData() const
154  {
155  return mesh_.globalData();
156  }
157 
158  //- Return database. For now is its polyMesh.
159  const objectRegistry& db() const
160  {
161  return mesh_.db();
162  }
163 
164  //- Reset pointMesh with respect to the updated polyMesh
165  // For run-time mesh replacement and mesh to mesh mapping
166  void reset();
167 
168  //- Lookup a dimensioned field for this geometry
169  template<class Type>
171 
172 
173  // Mesh callbacks
174 
175  //- Move points
176  virtual bool movePoints();
177 
178  //- Update the mesh corresponding to given map
179  virtual void topoChange(const polyTopoChangeMap&);
180 
181  //- Update from another mesh using the given map
182  virtual void mapMesh(const polyMeshMap&);
183 
184  //- Swap mesh
185  // For run-time mesh replacement and mesh to mesh mapping
186  virtual void swap(polyMesh&);
187 
188  //- Redistribute or update using the given distribution map
189  virtual void distribute(const polyDistributionMap&);
190 
191  //- Reordered/removed trailing patches. If validBoundary call is
192  // parallel synced and all add the same patch with same settings
193  virtual void reorderPatches
194  (
195  const labelUList& newToOld,
196  const bool validBoundary
197  );
198 
199  //- Inserted patch at patchi
200  virtual void addPatch(const label patchi);
201 
202  //- Clear all but permanent registered meshObjects
203  virtual void clear();
204 
205 
206  // Member Operators
207 
208  //- Return reference to polyMesh
209  const polyMesh& operator()() const
210  {
211  return mesh_;
212  }
213 
214  //- Disallow default bitwise assignment
215  void operator=(const pointMesh&) = delete;
216 
217  //- Equality comparison
218  bool operator==(const pointMesh& pm) const
219  {
220  return &pm == this;
221  }
222 
223  //- Inequality comparison
224  bool operator!=(const pointMesh& pm) const
225  {
226  return &pm != this;
227  }
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #ifdef NoRepository
238  #include "pointMeshTemplates.C"
239 #endif
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A HashTable with keys but without contents.
Definition: HashSet.H:62
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Registry of regIOobjects.
Foam::pointBoundaryMesh.
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:52
virtual bool movePoints()
Move points.
Definition: pointMesh.C:106
static const HashSet< word > curGeometryFields
Set of names of registered current-time geometric fields.
Definition: pointMesh.H:115
pointMesh(const polyMesh &pMesh)
Construct from polyMesh.
Definition: pointMesh.C:47
const objectRegistry & db() const
Return database. For now is its polyMesh.
Definition: pointMesh.H:158
pointZone Zone
Zone type.
Definition: pointMesh.H:94
tmp< DimensionedField< Type, pointMesh > > lookupField(const word &) const
Lookup a dimensioned field for this geometry.
const globalMeshData & globalData() const
Return parallel info.
Definition: pointMesh.H:152
virtual void topoChange(const polyTopoChangeMap &)
Update the mesh corresponding to given map.
Definition: pointMesh.C:123
ClassName("pointMesh")
pointBoundaryMesh BoundaryMesh
Boundary mesh type.
Definition: pointMesh.H:91
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: pointMesh.C:185
static const HashSet< word > geometryFields
Set of names of registered geometric fields.
Definition: pointMesh.H:112
virtual void swap(polyMesh &)
Swap mesh.
Definition: pointMesh.C:153
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: pointMesh.C:138
label size() const
Return number of points.
Definition: pointMesh.H:137
const DimensionedField< vector, pointMesh > & C() const
Return point locations.
Definition: pointMesh.C:81
~pointMesh()
Destructor.
Definition: pointMesh.C:67
virtual void addPatch(const label patchi)
Inserted patch at patchi.
Definition: pointMesh.C:231
virtual void clear()
Clear all but permanent registered meshObjects.
Definition: pointMesh.C:264
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: pointMesh.H:146
void reset()
Reset pointMesh with respect to the updated polyMesh.
Definition: pointMesh.C:280
virtual void reorderPatches(const labelUList &newToOld, const bool validBoundary)
Reordered/removed trailing patches. If validBoundary call is.
Definition: pointMesh.C:201
void operator=(const pointMesh &)=delete
Disallow default bitwise assignment.
bool operator==(const pointMesh &pm) const
Equality comparison.
Definition: pointMesh.H:217
bool operator!=(const pointMesh &pm) const
Inequality comparison.
Definition: pointMesh.H:223
pointMesh Mesh
Mesh type.
Definition: pointMesh.H:88
const polyMesh & operator()() const
Return reference to polyMesh.
Definition: pointMesh.H:208
const polyMesh & poly() const
Return reference to polyMesh.
Definition: pointMesh.H:131
Abstract base class for point-mesh patch fields.
Named list of point indices representing a sub-set of the mesh faces.
Definition: pointZone.H:60
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
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
const objectRegistry & db() const
Return the object registry.
Definition: polyMesh.H:453
const globalMeshData & globalData() const
Return parallel info.
Definition: polyMesh.C:1471
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
label nPoints() const
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
label patchi
Namespace for OpenFOAM.
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