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
7#include "Kokkos_Sort.hpp"
8
13
14namespace NeoN
15{
16
31{
32public:
33
59 );
60
85 );
86
92 const vectorVector& points() const;
94
100 const scalarVector& cellVolumes() const;
102
108 const vectorVector& cellCenters() const;
110
116 const vectorVector& faceCenters() const;
118
124 const vectorVector& faceNormals() const;
126
132 const scalarVector& faceAreas() const;
134
140 const labelVector& faceOwners() const;
142
150
157
164
171
178
185
192
199
206
208
215
221 const Executor& exec() const;
222
223private:
224
230 const Executor exec_;
231
235 vectorVector points_;
236
240 scalarVector cellVolumes_;
241
245 vectorVector cellCenters_;
246
253 vectorVector faceNormals_;
254
258 vectorVector faceCenters_;
259
263 scalarVector faceAreas_;
264
268 labelVector faceOwners_;
269
273 labelVector faceNeighbors_;
274
278 localIdx nCells_;
279
283 localIdx nInternalFaces_;
284
291 BoundaryMesh boundaryMesh_;
292
293 //
294 localIdx globalOffset_;
295
301 mutable Dictionary stencilDataBase_;
302};
303
313
319UnstructuredMesh create1DUniformMesh(const Executor exec, const localIdx nCells, scalar lx = 1.0);
320
328 const Executor exec, localIdx nx, localIdx ny, scalar lx = 1.0, scalar ly = 1.0
329);
330
338 const Executor exec,
339 localIdx nx,
340 localIdx ny,
341 localIdx nz,
342 scalar lx = 1.0,
343 scalar ly = 1.0,
344 scalar lz = 1.0
345);
346
347
348#ifdef NF_WITH_MPI_SUPPORT
355UnstructuredMesh create1DUniformMeshPart(const Executor exec, const localIdx nCells);
356
370UnstructuredMesh create2DUniformMeshPart(
371 const Executor exec, const localIdx nCells, const localIdx totalRanks, const localIdx rank
372);
373
386UnstructuredMesh create2DUniformMeshPartX(
387 const Executor exec, const localIdx nCells, const localIdx totalRanks, const localIdx rank
388);
389#endif
390
391} // namespace NeoN
Represents boundaries of an unstructured mesh.
A class representing a dictionary that stores key-value pairs.
Represents an unstructured mesh in NeoN.
localIdx nProcBoundaryFaces() const
Get the number of processor-boundary faces (inter-rank faces).
const labelVector & faceOwners() const
Get the list of labels of face owner cells.
Dictionary & stencilDB() const
Get the stencil data base.
localIdx nCells() const
Get the number of cells in the mesh.
vectorVector & cellCenters()
const scalarVector & cellVolumes() const
Get the field of cell volumes in the mesh.
localIdx nBoundaryFaces() const
Get the number of boundary faces 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.
localIdx nBoundaries() const
Get the number of boundaries patches in the mesh.
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.
localIdx nInternalFaces() const
Get the number of internal faces in the mesh.
const vectorVector & faceNormals() const
Get the field of face normal vectors.
vectorVector & faceNormals()
labelVector & faceNeighbors()
const labelVector & faceNeighbors() const
Get the list of labels of face neighbor cells.
const vectorVector & faceCenters() const
Get the field of face centers.
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.
localIdx globalOffset() const
the offset local cellIds for the global mesh.
scalarVector & cellVolumes()
vectorVector & points()
vectorVector & faceCenters()
BoundaryMesh & boundaryMesh()
scalarVector & faceAreas()
labelVector & faceOwners()
const BoundaryMesh & boundaryMesh() const
Get the boundary mesh.
localIdx nTotalFaces() const
Get the total number of faces including boundary and processor faces in the mesh.
const vectorVector & points() const
Get the field of mesh points.
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.
int32_t localIdx
Definition label.hpp:50
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:20
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
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.