NeoN
A framework for CFD software
Loading...
Searching...
No Matches
boundaryMesh.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 <vector>
8
11
12namespace NeoN
13{
14
33{
34public:
35
36 void validate() const;
37
57 const Executor& exec,
67 std::vector<localIdx> offset,
68 localIdx procBoundaryPatches,
69 std::vector<localIdx> neighbourRank
70 );
71
72
78 const labelVector& faceOwners() const;
79
80 // TODO either dont mix return types, ie dont use view and Vector
81 // for functions with same name
89
95 const vectorVector& faceCenters() const;
96
104
111
119
125 const vectorVector& faceNormals() const;
126
134
140 const scalarVector& faceAreas() const;
141
149
156
164
170 const vectorVector& delta() const;
171
179
185 const scalarVector& weights() const;
186
194
200 const scalarVector& deltaCoeffs() const;
201
209
216
222 // TODO consistent use of Vector on CPU
223 const std::vector<localIdx>& offset() const;
224
227
233 const std::vector<localIdx>& neighbourRank() const;
234
242 localIdx neighbourRankForRange(std::pair<localIdx, localIdx> range) const;
243
247 localIdx nBoundaries() const { return offset_.size() - 1; }
248
249
251
252 const std::vector<localIdx>& getRowSortPerm() const;
253
257 localIdx nBoundaryFaces() const { return faceOwners_.size() - nProcBoundaryFaces(); }
258
263
267 bool isDistributed() const { return nProcBoundaryFaces() > 0; }
268
269private:
270
274 const Executor exec_;
275
281 labelVector faceOwners_;
282
286 vectorVector faceCenters_;
287
291 vectorVector ownerCellCenters_;
292
296 vectorVector faceNormals_;
297
301 scalarVector faceAreas_;
302
306 vectorVector faceUnitNormals_;
307
314 vectorVector delta_;
315
321 scalarVector weights_;
322
328 scalarVector deltaCoeffs_;
329
335 // TODO consistent use of Vector on CPU
336 std::vector<localIdx> offset_;
337
343 localIdx procBoundaryPatches_;
344
348 std::vector<localIdx> neighbourRank_;
349
350 Vector<localIdx> rowOrderWriteIndex_;
351
352 std::vector<localIdx> rowSortPerm_;
353
354 void computeRowOrderWriteIndex();
355};
356
357} // namespace NeoN
Represents boundaries of an unstructured mesh.
const vectorVector & ownerCellCenters() const
Get the field of centers of owner cells of boundary faces.
View< const label > faceOwners(const localIdx i) const
Get a view of labels of owner cells for a specific boundary face.
View< const scalar > faceAreas(const localIdx i) const
Get a view of face areas for a specific boundary face.
void validate() const
View< const scalar > weights(const localIdx i) const
Get a view of weights for a specific boundary face.
const std::vector< localIdx > & offset() const
Get the offset of the boundary faces.
const vectorVector & faceUnitNormals() const
Get the field of face unit normal vectors.
const scalarVector & deltaCoeffs() const
Get the field of delta coefficients.
const std::vector< localIdx > & neighbourRank() const
Get the offset of the boundary faces.
View< const Vec3 > faceUnitNormals(const localIdx i) const
Get a view of face unit normal vectors for a specific boundary face.
View< const scalar > deltaCoeffs(const localIdx i) const
Get a view of delta coefficients for a specific boundary face.
localIdx nProcBoundaryPatches() const
number of proc boundary patches
localIdx neighbourRank(const localIdx i) const
Given a patchId the corresponding neighbour Rank gets returned.
View< const Vec3 > faceNormals(const localIdx i) const
Get a view of face areas normals for a specific boundary face.
View< const Vec3 > delta(const localIdx i) const
Get a view of delta vectors for a specific boundary face.
localIdx nBoundaries() const
Get the number of the boundaries.
const labelVector & faceOwners() const
Get the list of labels of owner cells of boundary faces.
const Vector< localIdx > & getRowOrderWriteIndex() const
bool isDistributed() const
Return whether this local mesh is a part of a global distributed mesh.
const vectorVector & faceNormals() const
Get the field of face areas normals.
localIdx neighbourRankForRange(std::pair< localIdx, localIdx > range) const
Returns the neighbour rank for the processor patch whose face range matches the given range.
const vectorVector & faceCenters() const
Get the field of face centers.
localIdx nBoundaryFaces() const
Get the number of the boundary faces.
const std::vector< localIdx > & getRowSortPerm() const
View< const Vec3 > ownerCellCenters(const localIdx i) const
Get a view of owner cell centers for a specific boundary face.
BoundaryMesh(const Executor &exec, labelVector faceOwners, vectorVector faceCenters, vectorVector ownerCellCenters, vectorVector faceNormals, scalarVector faceAreas, vectorVector faceUnitNormals, vectorVector delta, scalarVector weights, scalarVector deltaCoeffs, std::vector< localIdx > offset, localIdx procBoundaryPatches, std::vector< localIdx > neighbourRank)
Constructor for the BoundaryMesh class.
localIdx nProcBoundaryFaces() const
Get the number of the processor boundary faces.
const scalarVector & faceAreas() const
Get the field of face areas.
const vectorVector & delta() const
Get the field of delta vectors.
const scalarVector & weights() const
Get the field of weights.
View< const Vec3 > faceCenters(const localIdx i) const
Get a view of face centers for a specific boundary face.
localIdx size() const
Gets the size of the field.
Definition vector.hpp:268
Integer types used throughout NeoN.
Definition array.hpp:18
int32_t localIdx
Definition label.hpp:50
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:20