Class ae108::cpppetsc::Mesh
ClassList > ae108 > cpppetsc > Mesh
Public Types
| Type | Name |
|---|---|
| typedef PetscReal | real_type |
| typedef PetscInt | size_type |
| typedef PetscScalar | value_type |
| typedef Vector | vector_type |
Public Static Attributes
| Type | Name |
|---|---|
| const std::string_view | FaceLabelName = "Face Sets" |
| constexpr size_type | IGNORE_VERTEX_INDEX = -1 |
Public Functions
| Type | Name |
|---|---|
| void | addToGlobalVector (const local< Vector > & localVector, distributed< Vector > *const globalVector) const Add the values in the local vector to the corresponding values in the global vector. |
| Mesh | cloneWithDofs (const size_type dofPerVertex, const size_type dofPerElement) const Clone the mesh with a different default section. |
| std::vector< std::array< real_type, Dim > > | closureCoordinates (size_type mesh_point) const Returns the coordinates of the closure of a mesh point. |
| std::vector< std::array< typename Mesh::real_type, Dim > > | closureCoordinates (size_type local_mesh_point) const |
| size_type | coordinateDimension () const Returns the dimension of the coordinates. |
| void | copyToGlobalVector (const local< Vector > & localVector, distributed< Vector > *const globalVector) const Copy the values in the local vector to the corresponding values in the global vector. |
| void | copyToLocalVector (const distributed< Vector > & globalVector, local< Vector > *const localVector) const Fill the local vector with the corresponding values from the global vector. |
| DM | data () const Returns the internal mesh. |
| distributed< Vector > | fromCanonicalOrder (const distributed< Vector > & vector) const Returns a global vector in PETSc's row order transformed from the provided vector in canonical row order (the degrees of freedom of the elements sorted by global index, followed by the degrees of freedom of the vertices sorted by global index). |
| Mesh | fromConnectivityImpl (std::span< const std::span< const size_type > > elementVertexIDs, std::span< const std::array< real_type, CoordDim > > coords, const size_type dofPerVertex, const size_type dofPerElement, int topologicalDimension, size_type discretizationOrder, bool isSimplex) |
| std::vector< size_type > | localClosureIndices (size_type mesh_point) const Returns the DOF indices of the closure of a mesh point. |
| auto | localElements () const Makes it possible to iterate over (views of) the local elements. |
| size_type | localNumberOfElements () const Returns the local number of elements in the mesh. |
| size_type | localNumberOfVertices () const Returns the local number of vertices in the mesh. |
| cpppetsc::Range | localOwnershipRange () const Returns local dof range owned by this process. |
| auto | localVertices () const Makes it possible to iterate over (views of) the local vertices. |
| void | markBoundaryCells (const std::vector< LabelConstraints< Dim > > & boundary_conditions) Add cells to the default label "Face Sets" with a label value if all mesh points of that cell fullfil the condition. |
| void | print () const Prints the mesh to stdout. |
| distributed< Vector > | toCanonicalOrder (const distributed< Vector > & vector) const Returns a global vector in canonical row order (the degrees of freedom of the elements sorted by global index, followed by the degrees of freedom of the vertices sorted by global index) transformed from the provided vector in PETSc's row order. |
| Matrix | toCanonicalOrder (const Matrix & matrix) const Returns a matrix in canonical row/column order (the degrees of freedom of the elements sorted by global index, followed by the degrees of freedom of the vertices sorted by global index) transformed from the provided matrix in PETSc's row/column order. |
| size_type | totalNumberOfElements () const Returns the total number of elements in the mesh. |
| size_type | totalNumberOfVertices () const Returns the total number of vertices in the mesh. |
| void | writeAsHdf5 (const std::filesystem::path & filepath) const Write the discretized mesh as two arrays of coordinates and cells into an hdf5 file. It will contain higher order nodes as well. |
| void | writeAsVtu (const std::filesystem::path & filepath) const Write the mesh as VTK vtu file that can be directly openend by Paraview. Useful to visualize the ranks of distributed cells. |
Public Static Functions
| Type | Name |
|---|---|
| Mesh | fromConnectivity (std::span< const std::array< size_type, ElementTypeTrait< S >::NumVertices > > elementVertexIDs, std::span< const std::array< real_type, N > > coords, const size_type dofPerVertex, const size_type dofPerElement=0, size_type order=1) Creates a Mesh from the connectivity representation consisting of the same simplex. |
| Mesh | fromGmsh (std::string_view filename, size_type order, const size_type dofPerVertex, const size_type dofPerElement) |
| Mesh | fromMixedConnectivity (std::span< const std::vector< size_type > > elementVertexIDs, std::span< const std::array< real_type, N > > coords, const size_type dofPerVertex, const size_type dofPerElement=0, int topologicalDimension=1, size_type discretizationOrder=1) Creates a Mesh from the connectivity representation. |
Public Types Documentation
typedef real_type
using ae108::cpppetsc::Mesh::real_type = PetscReal;
typedef size_type
using ae108::cpppetsc::Mesh::size_type = PetscInt;
typedef value_type
using ae108::cpppetsc::Mesh::value_type = PetscScalar;
typedef vector_type
using ae108::cpppetsc::Mesh::vector_type = Vector;
Public Static Attributes Documentation
variable FaceLabelName
const std::string_view ae108::cpppetsc::Mesh::FaceLabelName;
variable IGNORE_VERTEX_INDEX
constexpr size_type ae108::cpppetsc::Mesh::IGNORE_VERTEX_INDEX;
Public Functions Documentation
function addToGlobalVector
Add the values in the local vector to the corresponding values in the global vector.
void ae108::cpppetsc::Mesh::addToGlobalVector (
const local < Vector > & localVector,
distributed < Vector > *const globalVector
) const
function cloneWithDofs
Clone the mesh with a different default section.
Mesh ae108::cpppetsc::Mesh::cloneWithDofs (
const size_type dofPerVertex,
const size_type dofPerElement
) const
function closureCoordinates [1/2]
Returns the coordinates of the closure of a mesh point.
template<int Dim>
std::vector< std::array< real_type, Dim > > ae108::cpppetsc::Mesh::closureCoordinates (
size_type mesh_point
) const
Remark:
The order of coordinates corresponds to the order of basis functions
function closureCoordinates [2/2]
template<int Dim>
std::vector< std::array< typename Mesh::real_type, Dim > > ae108::cpppetsc::Mesh::closureCoordinates (
size_type local_mesh_point
) const
function coordinateDimension
Returns the dimension of the coordinates.
size_type ae108::cpppetsc::Mesh::coordinateDimension () const
function copyToGlobalVector
Copy the values in the local vector to the corresponding values in the global vector.
void ae108::cpppetsc::Mesh::copyToGlobalVector (
const local < Vector > & localVector,
distributed < Vector > *const globalVector
) const
Remark:
Be careful with overlapping areas (e.g. for ghost points) on different nodes.
function copyToLocalVector
Fill the local vector with the corresponding values from the global vector.
void ae108::cpppetsc::Mesh::copyToLocalVector (
const distributed < Vector > & globalVector,
local < Vector > *const localVector
) const
function data
Returns the internal mesh.
DM ae108::cpppetsc::Mesh::data () const
Remark:
For internal use only.
function fromCanonicalOrder
Returns a global vector in PETSc's row order transformed from the provided vector in canonical row order (the degrees of freedom of the elements sorted by global index, followed by the degrees of freedom of the vertices sorted by global index).
distributed < Vector > ae108::cpppetsc::Mesh::fromCanonicalOrder (
const distributed < Vector > & vector
) const
function fromConnectivityImpl [1/2]
template<std::size_t CoordDim>
Mesh ae108::cpppetsc::Mesh::fromConnectivityImpl (
std::span< const std::span< const size_type > > elementVertexIDs,
std::span< const std::array< real_type, CoordDim > > coords,
const size_type dofPerVertex,
const size_type dofPerElement,
int topologicalDimension,
size_type discretizationOrder,
bool isSimplex
)
function localClosureIndices
Returns the DOF indices of the closure of a mesh point.
std::vector< size_type > ae108::cpppetsc::Mesh::localClosureIndices (
size_type mesh_point
) const
Remark:
The order corresponds to the order of basis functions
function localElements
Makes it possible to iterate over (views of) the local elements.
inline auto ae108::cpppetsc::Mesh::localElements () const
function localNumberOfElements
Returns the local number of elements in the mesh.
size_type ae108::cpppetsc::Mesh::localNumberOfElements () const
function localNumberOfVertices
Returns the local number of vertices in the mesh.
size_type ae108::cpppetsc::Mesh::localNumberOfVertices () const
function localOwnershipRange
Returns local dof range owned by this process.
cpppetsc::Range ae108::cpppetsc::Mesh::localOwnershipRange () const
function localVertices
Makes it possible to iterate over (views of) the local vertices.
inline auto ae108::cpppetsc::Mesh::localVertices () const
Note:
this only returns the topology vertices and not the ones used for discretization
function markBoundaryCells
Add cells to the default label "Face Sets" with a label value if all mesh points of that cell fullfil the condition.
template<int Dim>
void ae108::cpppetsc::Mesh::markBoundaryCells (
const std::vector< LabelConstraints < Dim > > & boundary_conditions
)
function print
Prints the mesh to stdout.
void ae108::cpppetsc::Mesh::print () const
function toCanonicalOrder [1/2]
Returns a global vector in canonical row order (the degrees of freedom of the elements sorted by global index, followed by the degrees of freedom of the vertices sorted by global index) transformed from the provided vector in PETSc's row order.
distributed < Vector > ae108::cpppetsc::Mesh::toCanonicalOrder (
const distributed < Vector > & vector
) const
function toCanonicalOrder [2/2]
Returns a matrix in canonical row/column order (the degrees of freedom of the elements sorted by global index, followed by the degrees of freedom of the vertices sorted by global index) transformed from the provided matrix in PETSc's row/column order.
Matrix ae108::cpppetsc::Mesh::toCanonicalOrder (
const Matrix & matrix
) const
function totalNumberOfElements
Returns the total number of elements in the mesh.
size_type ae108::cpppetsc::Mesh::totalNumberOfElements () const
function totalNumberOfVertices
Returns the total number of vertices in the mesh.
size_type ae108::cpppetsc::Mesh::totalNumberOfVertices () const
function writeAsHdf5
Write the discretized mesh as two arrays of coordinates and cells into an hdf5 file. It will contain higher order nodes as well.
void ae108::cpppetsc::Mesh::writeAsHdf5 (
const std::filesystem::path & filepath
) const
function writeAsVtu
Write the mesh as VTK vtu file that can be directly openend by Paraview. Useful to visualize the ranks of distributed cells.
void ae108::cpppetsc::Mesh::writeAsVtu (
const std::filesystem::path & filepath
) const
Public Static Functions Documentation
function fromConnectivity
Creates a Mesh from the connectivity representation consisting of the same simplex.
template<ElementType S, std::size_t N>
static Mesh ae108::cpppetsc::Mesh::fromConnectivity (
std::span< const std::array< size_type, ElementTypeTrait < S >::NumVertices > > elementVertexIDs,
std::span< const std::array< real_type, N > > coords,
const size_type dofPerVertex,
const size_type dofPerElement=0,
size_type order=1
)
Template parameters:
SSimplexNCoordinate Dimension (2 or 3)
Parameters:
elementVertexIDsA container of containers: the container at index i contains the vertex IDs of the element with index i. Each vertex ID must lie in [0, numberOfVertices) u {IGNORE_VERTEX_INDEX}. IDs of value IGNORE_VERTEX_INDEX are ignored.coordsCoodinates of the vertices of dimension N.dofPerVertexDegrees of freedom of each (interpolated) vertexdofPerElementDegrees of freedom of each elementorderDiscretization order. If higher than 1, mesh will be interpolated.
function fromGmsh
static Mesh ae108::cpppetsc::Mesh::fromGmsh (
std::string_view filename,
size_type order,
const size_type dofPerVertex,
const size_type dofPerElement
)
function fromMixedConnectivity
Creates a Mesh from the connectivity representation.
template<std::size_t N>
static Mesh ae108::cpppetsc::Mesh::fromMixedConnectivity (
std::span< const std::vector< size_type > > elementVertexIDs,
std::span< const std::array< real_type, N > > coords,
const size_type dofPerVertex,
const size_type dofPerElement=0,
int topologicalDimension=1,
size_type discretizationOrder=1
)
Template parameters:
ContainerRequirements: size(); Container::value_type requirements: size(), data().
Parameters:
dimensionThe coordinate dimension.elementVertexIDsA container of containers: the container at index i contains the vertex IDs of the element with index i. Each vertex ID must lie in [0, numberOfVertices) u {IGNORE_VERTEX_INDEX}. IDs of value IGNORE_VERTEX_INDEX are ignored.numberOfVerticesThe maximum vertex ID in the mesh.
The documentation for this class was generated from the following file cpppetsc/src/include/ae108/cpppetsc/Mesh.h