Loading...
Searching...
No Matches
pointMesh.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2013 OpenFOAM Foundation
9 Copyright (C) 2021-2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::pointMesh
29
30Description
31 Mesh representing a set of points created from polyMesh.
32
33\*---------------------------------------------------------------------------*/
34
35#ifndef Foam_pointMesh_H
36#define Foam_pointMesh_H
37
38#include "GeoMesh.H"
39#include "MeshObject.H"
40#include "polyMesh.H"
41#include "pointBoundaryMesh.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class pointMesh Declaration
50\*---------------------------------------------------------------------------*/
51
52class pointMesh
53:
54 public MeshObject<polyMesh, UpdateableMeshObject, pointMesh>,
55 public GeoMesh<polyMesh>
56{
57 // Private Typedefs
58
59 typedef MeshObject
60 <
63 pointMesh
64 > MeshObject_type;
65
66
67 // Permanent Data
68
69 //- Boundary mesh
70 pointBoundaryMesh boundary_;
71
72
73 // Private Member Functions
74
75 //- Map all fields
76 void mapFields(const mapPolyMesh& mpm);
77
78 //- No copy construct
79 pointMesh(const pointMesh&) = delete;
80
81 //- No copy assignment
82 void operator=(const pointMesh&) = delete;
83
84
85public:
86
87 // Public Typedefs
88
89 //- The mesh type
90 typedef pointMesh Mesh;
91
92 //- The boundary type associated with the mesh
94
95
96 // Declare name of the class and its debug switch
97 ClassName("pointMesh");
99 //- Return the mesh sub-directory name (usually "pointMesh")
100 static word meshSubDir;
101
103 // Constructors
104
105 //- Construct from polyMesh
106 explicit pointMesh(const polyMesh& pMesh);
108 //- Construct from polyMesh and IOobject (used when reading boundary)
109 explicit pointMesh(const polyMesh& pMesh, const IOobject& io);
110
111 //- Construct from polyMesh and readOpt. Takes instance, time etc
112 //- from polyMesh. Used when reading boundary.
113 explicit pointMesh
114 (
115 const polyMesh& pMesh,
117 );
118
119
120 //- Destructor
121 ~pointMesh() = default;
122
123
124 // Static Functions
125
126 //- The geometric (internal) size - number of mesh points.
127 // Method name expected by GeoMesh interface
128 static label size(const Mesh& mesh)
129 {
130 return mesh.GeoMesh<polyMesh>::mesh_.nPoints();
131 }
132
133 //- The geometric boundary size - not implemented.
134 // Method name expected by GeoMesh interface
135 static label boundary_size(const Mesh& mesh)
137 return 0;
138 }
139
140
141 // Member Functions
142
143 //- The geometric (internal) size - number of points.
144 // Method name expected by GeoMesh interface
145 label size() const
147 return size(*this);
148 }
149
150 //- Return reference to boundary mesh
151 const pointBoundaryMesh& boundary() const noexcept
152 {
153 return boundary_;
154 }
155
156 //- Is demand-driven parallel info available?
157 bool hasGlobalData() const noexcept
158 {
159 return GeoMesh<polyMesh>::mesh_.hasGlobalData();
160 }
161
162 //- Return parallel info (demand-driven)
163 const globalMeshData& globalData() const
164 {
165 return GeoMesh<polyMesh>::mesh_.globalData();
166 }
167
168 //- Return database. For now is its polyMesh.
169 const objectRegistry& thisDb() const
170 {
171 return GeoMesh<polyMesh>::mesh_.thisDb();
172 }
173
174 //- Return Time from polyMesh.
175 const Time& time() const
176 {
178 }
179
180 //- Set the instance for mesh files
181 void setInstance
182 (
183 const fileName& instance,
185 );
186
187
188 // Volume Mesh
189
190 //- Return boundary mesh for underlying volume mesh
191 const polyBoundaryMesh& boundaryMesh() const
192 {
193 return GeoMesh<polyMesh>::mesh_.boundaryMesh();
194 }
195
196
197 // Mesh Motion
198
199 //- Move points
200 bool movePoints();
202 //- Update the mesh corresponding to given map
203 void updateMesh(const mapPolyMesh& mpm);
204
205
206 // Member Operators
207
208 bool operator!=(const pointMesh& pm) const
210 return &pm != this;
211 }
212
213 bool operator==(const pointMesh& pm) const
214 {
215 return &pm == this;
216 }
217
218
219 // Write
220
221 //- Write
222 virtual bool writeObject
223 (
224 IOstreamOption streamOpt,
225 const bool writeOnProc = true
226 ) const;
227};
228
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232} // End namespace Foam
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
237
238// ************************************************************************* //
const MESH & mesh_
Reference to Mesh.
Definition GeoMesh.H:54
GeoMesh(const polyMesh &mesh)
Definition GeoMesh.H:70
readOption
Enumeration defining read preferences.
writeOption
Enumeration defining write preferences.
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const fileName & instance() const noexcept
Read access to instance path component.
Definition IOobjectI.H:289
A simple container for options an IOstream can normally have.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A class for handling file names.
Definition fileName.H:75
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Registry of regIOobjects.
A pointBoundaryMesh is a pointPatch list with registered IO, a reference to the associated pointMesh,...
Mesh representing a set of points created from polyMesh.
Definition pointMesh.H:49
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
Definition pointMesh.C:129
bool movePoints()
Move points.
Definition pointMesh.C:147
static label size(const Mesh &mesh)
The geometric (internal) size - number of mesh points.
Definition pointMesh.H:146
~pointMesh()=default
Destructor.
bool hasGlobalData() const noexcept
Is demand-driven parallel info available?
Definition pointMesh.H:185
static label boundary_size(const Mesh &mesh)
The geometric boundary size - not implemented.
Definition pointMesh.H:156
const Time & time() const
Return Time from polyMesh.
Definition pointMesh.H:209
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc=true) const
Write.
Definition pointMesh.C:176
ClassName("pointMesh")
pointBoundaryMesh BoundaryMesh
The boundary type associated with the mesh.
Definition pointMesh.H:98
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh for underlying volume mesh.
Definition pointMesh.H:229
const pointBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Definition pointMesh.H:177
const objectRegistry & thisDb() const
Return database. For now is its polyMesh.
Definition pointMesh.H:201
void updateMesh(const mapPolyMesh &mpm)
Update the mesh corresponding to given map.
Definition pointMesh.C:161
label size() const
The geometric (internal) size - number of points.
Definition pointMesh.H:169
const globalMeshData & globalData() const
Return parallel info (demand-driven).
Definition pointMesh.H:193
static word meshSubDir
Return the mesh sub-directory name (usually "pointMesh").
Definition pointMesh.H:107
bool operator==(const pointMesh &pm) const
Definition pointMesh.H:255
bool operator!=(const pointMesh &pm) const
Definition pointMesh.H:250
pointMesh Mesh
The mesh type.
Definition pointMesh.H:93
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for handling words, derived from Foam::string.
Definition word.H:66
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
dynamicFvMesh & mesh
const auto & io
Namespace for OpenFOAM.
const direction noexcept
Definition scalarImpl.H:265