unstructuredMesh

The unstructuredMesh in the current implementation stores the relevant data for the unstructuredMesh on the selected executor. So it is currently a data container for mesh data.

Warning

  • unable to read the mesh from disc

  • mesh data needs to be provided by the user

class UnstructuredMesh

Represents an unstructured mesh in NeoFOAM.

The UnstructuredMesh class stores the data and provides access to the properties of an unstructured mesh. It contains information such as mesh points, cell volumes, cell centres, face areas, face centres, face owner cells, face neighbour cells, and boundary information. It also provides methods to retrieve the number of cells, internal faces, boundary faces, boundaries, and faces in the mesh. Additionally, it includes a boundary mesh and a stencil data base. The executor is used to run parallel operations on the mesh.

Public Functions

UnstructuredMesh(vectorField points, scalarField cellVolumes, vectorField cellCentres, vectorField faceAreas, vectorField faceCentres, scalarField magFaceAreas, labelField faceOwner, labelField faceNeighbour, localIdx nCells, localIdx nInternalFaces, localIdx nBoundaryFaces, localIdx nBoundaries, localIdx nFaces, BoundaryMesh boundaryMesh)

Constructor for the UnstructuredMesh class.

Parameters:
  • points – The field of mesh points.

  • cellVolumes – The field of cell volumes in the mesh.

  • cellCentres – The field of cell centres in the mesh.

  • faceAreas – The field of area face normals.

  • faceCentres – The field of face centres.

  • magFaceAreas – The field of magnitudes of face areas.

  • faceOwner – The field of face owner cells.

  • faceNeighbour – The field of face neighbour cells.

  • nCells – The number of cells in the mesh.

  • nInternalFaces – The number of internal faces in the mesh.

  • nBoundaryFaces – The number of boundary faces in the mesh.

  • nBoundaries – The number of boundaries in the mesh.

  • nFaces – The number of faces in the mesh.

  • boundaryMesh – The boundary mesh.

const vectorField &points() const

Get the field of mesh points.

Returns:

The field of mesh points.

const scalarField &cellVolumes() const

Get the field of cell volumes in the mesh.

Returns:

The field of cell volumes in the mesh.

const vectorField &cellCentres() const

Get the field of cell centres in the mesh.

Returns:

The field of cell centres in the mesh.

const vectorField &faceCentres() const

Get the field of face centres.

Returns:

The field of face centres.

const vectorField &faceAreas() const

Get the field of area face normals.

Returns:

The field of area face normals.

const scalarField &magFaceAreas() const

Get the field of magnitudes of face areas.

Returns:

The field of magnitudes of face areas.

const labelField &faceOwner() const

Get the field of face owner cells.

Returns:

The field of face owner cells.

const labelField &faceNeighbour() const

Get the field of face neighbour cells.

Returns:

The field of face neighbour cells.

localIdx nCells() const

Get the number of cells in the mesh.

Returns:

The number of cells in the mesh.

localIdx nInternalFaces() const

Get the number of internal faces in the mesh.

Returns:

The number of internal faces in the mesh.

localIdx nBoundaryFaces() const

Get the number of boundary faces in the mesh.

Returns:

The number of boundary faces in the mesh.

localIdx nBoundaries() const

Get the number of boundaries in the mesh.

Returns:

The number of boundaries in the mesh.

localIdx nFaces() const

Get the number of faces in the mesh.

Returns:

The number of faces in the mesh.

const BoundaryMesh &boundaryMesh() const

Get the boundary mesh.

Returns:

The boundary mesh.

StencilDataBase &stencilDB() const

Get the stencil data base.

Returns:

The stencil data base.

const Executor &exec() const

Get the executor.

Returns:

The executor.

BoundaryMesh

The boundaryMesh in the current implementation stores the relevant data for the boundaryMesh on the selected executor. So it is currently a data container for boundary mesh data. The boundaryMesh information are stored in a continuous array and the index for the boundary patch is stored in a offset.

Warning

  • unable to read the boundary mesh from disc

  • boundary mesh data needs to be provided by the user

class BoundaryMesh

Represents boundaries of an unstructured mesh.

The BoundaryMesh class stores information about the boundary faces and their properties in an unstructured mesh. It provides access to various fields such as face cells, face centres, face normals, face areas normals, magnitudes of face areas normals, delta vectors, weights, delta coefficients, and offsets.

The class also provides getter methods to access the individual fields and their components.

Template Parameters:

Executor – The type of the executor used for computations.

Public Functions

BoundaryMesh(const Executor &exec, labelField faceCells, vectorField cf, vectorField cn, vectorField sf, scalarField magSf, vectorField nf, vectorField delta, scalarField weights, scalarField deltaCoeffs, std::vector<localIdx> offset)

Constructor for the BoundaryMesh class.

Parameters:
  • exec – The executor used for computations.

  • faceCells – A field with the neighbouring cell of each boundary face.

  • Cf – A field of face centres.

  • Cn – A field of face normals.

  • Sf – A field of face areas normals.

  • magSf – A field of magnitudes of face areas normals.

  • nf – A field of face normals.

  • delta – A field of delta vectors.

  • weights – A field of weights used in cell to face interpolation.

  • deltaCoeffs – A field of cell to face distances.

  • offset – The offset of the boundary faces.

const labelField &faceCells() const

Get the field of face cells.

Returns:

A constant reference to the field of face cells.

std::span<const label> faceCells(const localIdx i) const

Get a span of face cells for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of face cells for the specified boundary face.

const vectorField &cf() const

Get the field of face centres.

Returns:

A constant reference to the field of face centres.

std::span<const Vector> cf(const localIdx i) const

Get a span of face centres for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of face centres for the specified boundary face.

const vectorField &cn() const

Get the field of face normals.

Returns:

A constant reference to the field of face normals.

std::span<const Vector> cn(const localIdx i) const

Get a span of face normals for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of face normals for the specified boundary face.

const vectorField &sf() const

Get the field of face areas normals.

Returns:

A constant reference to the field of face areas normals.

std::span<const Vector> sf(const localIdx i) const

Get a span of face areas normals for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of face areas normals for the specified boundary face.

const scalarField &magSf() const

Get the field of magnitudes of face areas normals.

Returns:

A constant reference to the field of magnitudes of face areas normals.

std::span<const scalar> magSf(const localIdx i) const

Get a span of magnitudes of face areas normals for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of magnitudes of face areas normals for the specified boundary face.

const vectorField &nf() const

Get the field of face normals.

Returns:

A constant reference to the field of face normals.

std::span<const Vector> nf(const localIdx i) const

Get a span of face normals for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of face normals for the specified boundary face.

const vectorField &delta() const

Get the field of delta vectors.

Returns:

A constant reference to the field of delta vectors.

std::span<const Vector> delta(const localIdx i) const

Get a span of delta vectors for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of delta vectors for the specified boundary face.

const scalarField &weights() const

Get the field of weights.

Returns:

A constant reference to the boundary field of weights.

std::span<const scalar> weights(const localIdx i) const

Get a span of weights for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of weights for the specified boundary face.

const scalarField &deltaCoeffs() const

Get the field of delta coefficients.

Returns:

A constant reference to the field of delta coefficients.

std::span<const scalar> deltaCoeffs(const localIdx i) const

Get a span of delta coefficients for a specific boundary face.

Parameters:

i – The index of the boundary face.

Returns:

A span of delta coefficients for the specified boundary face.

const std::vector<localIdx> &offset() const

Get the offset of the boundary faces.

Returns:

A constant reference to the offset of the boundary faces.

StencilDataBase

Offers the ability to register additional stencil data for the unstructuredMesh. If the mesh changes, the stencil data is automatically updated.

Warning

StencilDataBas is currently a placeholder based on dictionary. The implementation is not yet complete and requires the additional of additional members functions that are linked to the implementation of the operators

Warning

  • unable to read the boundary mesh from disc

  • boundary mesh data needs to be provided by the user

class StencilDataBase

A class that represents a stencil database.

The StencilDataBase class provides a container for storing stencil data. It allows insertion, retrieval, and checking of stencil data using string keys.

Public Functions

StencilDataBase() = default

Default constructor for StencilDataBase.

template<typename T>
inline void insert(const std::string &key, T value)

Inserts a value into the stencil database.

Template Parameters:

T – The type of the value to be inserted.

Parameters:
  • key – The key associated with the value.

  • value – The value to be inserted.

std::any &operator[](const std::string &key)

Retrieves a reference to the value associated with the given key.

Parameters:

key – The key associated with the value.

Returns:

A reference to the value associated with the key.

const std::any &operator[](const std::string &key) const

Retrieves a const reference to the value associated with the given key.

Parameters:

key – The key associated with the value.

Returns:

A const reference to the value associated with the key.

template<typename T>
inline T &get(const std::string &key)

Retrieves a reference to the value associated with the given key.

Template Parameters:

T – The type of the value to be retrieved.

Parameters:

key – The key associated with the value.

Throws:

std::bad_any_cast – if the value cannot be cast to type T.

Returns:

A reference to the value associated with the key.

template<typename T>
inline const T &get(const std::string &key) const

Retrieves a const reference to the value associated with the given key.

Template Parameters:

T – The type of the value to be retrieved.

Parameters:

key – The key associated with the value.

Throws:

std::bad_any_cast – if the value cannot be cast to type T.

Returns:

A const reference to the value associated with the key.

bool contains(const std::string &key) const

Checks if the stencil database contains a value associated with the given key.

Parameters:

key – The key to check.

Returns:

true if the database contains the key, false otherwise.