NeoN
A framework for CFD software
Loading...
Searching...
No Matches
unstructuredMesh.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2023 - 2026 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
13
14namespace NeoN
15{
16
31{
32public:
33
59 );
60
85 );
86
92 const vectorVector& points() const { return points_; }
93 vectorVector& points() { return points_; }
94
100 const scalarVector& cellVolumes() const { return cellVolumes_; }
101 scalarVector& cellVolumes() { return cellVolumes_; }
102
108 const vectorVector& cellCenters() const { return cellCenters_; }
109 vectorVector& cellCenters() { return cellCenters_; }
110
116 const vectorVector& faceCenters() const { return faceCenters_; }
117 vectorVector& faceCenters() { return faceCenters_; }
118
124 const vectorVector& faceNormals() const { return faceNormals_; }
125 vectorVector& faceNormals() { return faceNormals_; }
126
132 const scalarVector& faceAreas() const { return faceAreas_; }
133 scalarVector& faceAreas() { return faceAreas_; }
134
140 const labelVector& faceOwners() const { return faceOwners_; }
141 labelVector& faceOwners() { return faceOwners_; }
142
148 const labelVector& faceNeighbors() const { return faceNeighbors_; }
149 labelVector& faceNeighbors() { return faceNeighbors_; }
150
156 sizeType nCells() const { return nCells_; }
157
163 sizeType nInternalFaces() const { return nInternalFaces_; }
164
170 sizeType nBoundaryFaces() const { return boundaryMesh_.nBoundaryFaces(); }
171
178 {
180 }
181
187 sizeType nBoundaries() const { return boundaryMesh_.nBoundaries(); }
188
194 sizeType nProcBoundaryFaces() const { return boundaryMesh_.nProcBoundaryFaces(); }
195
201 localIdx globalOffset() const { return globalOffset_; }
202
208 const BoundaryMesh& boundaryMesh() const { return boundaryMesh_; }
209 BoundaryMesh& boundaryMesh() { return boundaryMesh_; }
210
216 Dictionary& stencilDB() const { return stencilDataBase_; }
217
223 const Executor& exec() const { return exec_; }
224
225private:
226
232 const Executor exec_;
233
237 vectorVector points_;
238
242 scalarVector cellVolumes_;
243
247 vectorVector cellCenters_;
248
255 vectorVector faceNormals_;
256
260 vectorVector faceCenters_;
261
265 scalarVector faceAreas_;
266
270 labelVector faceOwners_;
271
275 labelVector faceNeighbors_;
276
280 sizeType nCells_;
281
285 sizeType nInternalFaces_;
286
293 BoundaryMesh boundaryMesh_;
294
295 //
296 localIdx globalOffset_;
297
303 mutable Dictionary stencilDataBase_;
304};
305
315
321UnstructuredMesh create1DUniformMesh(const Executor exec, const localIdx nCells, scalar lx = 1.0);
322
330 const Executor exec, localIdx nx, localIdx ny, scalar lx = 1.0, scalar ly = 1.0
331);
332
340 const Executor exec,
341 localIdx nx,
342 localIdx ny,
343 localIdx nz,
344 scalar lx = 1.0,
345 scalar ly = 1.0,
346 scalar lz = 1.0
347);
348
349
350#ifdef NF_WITH_MPI_SUPPORT
357UnstructuredMesh create1DUniformMeshPart(const Executor exec, const localIdx nCells);
358
372UnstructuredMesh create2DUniformMeshPart(
373 const Executor exec, const localIdx nCells, const localIdx totalRanks, const localIdx rank
374);
375
388UnstructuredMesh create2DUniformMeshPartX(
389 const Executor exec, const localIdx nCells, const localIdx totalRanks, const localIdx rank
390);
391#endif
392
393} // namespace NeoN
Represents boundaries of an unstructured mesh.
A class representing a dictionary that stores key-value pairs.
Represents an unstructured mesh in NeoN.
const labelVector & faceOwners() const
Get the list of labels of face owner cells.
Dictionary & stencilDB() const
Get the stencil data base.
const scalarVector & cellVolumes() const
Get the field of cell volumes in the mesh.
UnstructuredMesh(vectorVector points, scalarVector cellVolumes, vectorVector cellCenters, vectorVector faceNormals, vectorVector faceCenters, scalarVector faceAreas, labelVector faceOwners, labelVector faceNeighbors, BoundaryMesh boundaryMesh)
Constructor for the UnstructuredMesh class.
UnstructuredMesh(Executor exec, vectorVector points, scalarVector cellVolumes, vectorVector cellCenters, vectorVector faceNormals, vectorVector faceCenters, scalarVector faceAreas, labelVector faceOwners, labelVector faceNeighbors, BoundaryMesh boundaryMesh)
Constructor for the UnstructuredMesh class.
const vectorVector & faceNormals() const
Get the field of face normal vectors.
const labelVector & faceNeighbors() const
Get the list of labels of face neighbor cells.
sizeType nProcBoundaryFaces() const
Get the number of processor-boundary faces (inter-rank faces).
const vectorVector & faceCenters() const
Get the field of face centers.
sizeType nBoundaries() const
Get the number of boundaries patches in the mesh.
const scalarVector & faceAreas() const
Get the field of face areas.
const vectorVector & cellCenters() const
Get the field of cell centers in the mesh.
const Executor & exec() const
Get the executor.
sizeType nBoundaryFaces() const
Get the number of boundary faces in the mesh.
localIdx globalOffset() const
the offset local cellIds for the global mesh.
sizeType nCells() const
Get the number of cells in the mesh.
sizeType nTotalFaces() const
Get the total number of faces including boundary and processor faces in the mesh.
BoundaryMesh & boundaryMesh()
const BoundaryMesh & boundaryMesh() const
Get the boundary mesh.
const vectorVector & points() const
Get the field of mesh points.
sizeType nInternalFaces() const
Get the number of internal faces in the mesh.
Integer types used throughout NeoN.
Definition array.hpp:18
UnstructuredMesh create1DUniformMesh(const Executor exec, const localIdx nCells, scalar lx=1.0)
A factory function for a 1D uniform mesh.
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:21
UnstructuredMesh createSingleCellMesh(const Executor exec)
creates a mesh containing only a single cell @warn currently this is only a 2D mesh
float scalar
Definition scalar.hpp:17
std::size_t sizeType
Definition label.hpp:56
NeoN::Vector< Vec3 > vectorVector
UnstructuredMesh create2DUniformMesh(const Executor exec, localIdx nx, localIdx ny, scalar lx=1.0, scalar ly=1.0)
A factory function for a 2D uniform mesh (single-layer hex slab).
UnstructuredMesh create3DUniformMesh(const Executor exec, localIdx nx, localIdx ny, localIdx nz, scalar lx=1.0, scalar ly=1.0, scalar lz=1.0)
A factory function for a uniform 3D hex mesh.
NeoN::Vector< scalar > scalarVector
int32_t localIdx
Definition label.hpp:50
NeoN::Vector< label > labelVector