Skip to content

Mesh

All docstrings from Mantis.Mesh

Mantis.Mesh Module
julia
module Mesh

Contains all mesh structs and functions. At the moment, these are simple versions to be able to start experimenting with the other parts of the code. This module makes extensive use of getters and setters, so the internals of a struct are considered 'hidden' details that can change without warning, even those not preceded with an underscore.

source
Mantis.Mesh.MeshTopology Type
julia
MeshTopology{manifold_dim, incidence_relations_dim, num_patches}

Represents the topological structure of a collection of patches forming a structured mesh.

Each patch is considered an individual mesh patch at the global level. This structure enables the computation of all incidence relations between geometric objects (vertices, edges, faces, volumes), and the determination of topological neighbors. Supports 1D (lines), 2D (quads), and 3D (hexahedra) topologies.

Fields

  • incidence_relations: A nested tuple containing the incidence relations between geometric objects of different dimensions.

  • n_geometric_objects: Total number of global geometric objects per topological dimension.

  • n_local_geometric_objects: Number of local geometric objects per patch per dimension.

  • local_edge2vertex: Local edge-to-vertex mapping, local_edge2vertex[i,j] contains the i-th vertex of the j-th edge, all at local level.

  • local_face2vertex: Local face-to-vertex mapping, local_face2vertex[i,j] contains the i-th vertex of the j-th face, all at local level.

Constructors

  • MeshTopology(patches::Vector{Vector{Int}}): Builds the patch topology from a list of patch connectivities (vertex indices).
source
Mantis.Mesh.Patch Type
julia
Patch{n}

Is an n-dimensional structured tensor-product patch.

Fields

  • patches_per_dim::NTuple{n, Patch1D}: Patches per dimension. Should be strictly increasing.

Extended help

Implementation

The patch is assumed to be a tensor-product patch of quadilaterals. This is also reflected in the implementation.

source
Mantis.Mesh.Patch1D Type
julia
Patch1D

Is a 1-dimensional patch, so only the breakpoints.

Fields

  • breakpoints::Vector{Float64}: Breakpoints. Should be strictly increasing.

Extended help

Error behaviour

The strictly increasing property of the breakpoints is checked. An ArgumentError is raised if the breakpoints are not strictly increasing.

source
Base.size Method
julia
size(patch_1d::Patch1D)

Returns the number of elements in the patch_1d.

Redefinition of Base.size for a Patch1D. This ensures that one can call size(patch_1d) to get the size of the patch.

Arguments

  • patch_1d::Patch1D: Patch of which to get the size.

Returns

  • ::Int: Number of elements in the patch.
source
Base.size Method
julia
size(patch::Patch{n}) where {n}

Returns the number of elements in the patch.

Redefinition of Base.size for a Patch. This ensures that one can call size(patch) to get the size of the patch.

Arguments

  • patch::Patch{n}: Patch of which to get the size.

Returns

  • ::NTuple{n, Int}: Tuple of the number of elements per dimension.
source
Base.size Method
julia
size(patch::Patch{n}, d::Int) where {n}

Returns the number of elements in the patch in dimension d.

Redefinition of Base.size for a Patch. This ensures that one can call size(patch, d) to get the size of the patch.

Arguments

  • patch::Patch{n}: Patch of which to get the size.

  • d::Int: Dimension in which to get the size.

Returns

  • ::Int: Number of elements in dimension d.
source
Mantis.Mesh.compute_edge_neighbours Method
julia
compute_edge_neighbours(mesh_topology::MeshTopology{2,3}, patch_id::Int, edge_local_id::Int)

Returns a 4 × N matrix describing the neighboring patches across edge edge_local_id of patch_id. Each column encodes:

  • Row 1: Neighboring patch ID.

  • Row 2: Local edge ID in neighbor.

  • Row 3: Always 0 (edges do not rotate), only orientation needs to be considered.

  • Row 4: Orientation (+1 or -1), this indicates whether you need to apply reverse on edge numbering or not.

Only applicable to 2D quadrilateral meshes.

source
Mantis.Mesh.compute_edge_neighbours Method
julia
compute_edge_neighbours(mesh_topology::MeshTopology{3,4}, patch_id::Int, edge_local_id::Int)

Same as the 2D version, but for 3D hexahedral meshes. Computes edge neighbors of a specific patch edge. Returns a 4 × N matrix describing the neighboring patches across edge edge_local_id of patch_id. Each column encodes:

  • Row 1: Neighboring patch ID.

  • Row 2: Local edge ID in neighbor.

  • Row 3: Always 0 (edges do not rotate), only orientation needs to be considered.

  • Row 4: Orientation (+1 or -1).

Only applicable to 3D hexahedral meshes.

source
Mantis.Mesh.compute_edge_neighbours Method
julia
compute_edge_neighbours(mesh_topology::MeshTopology)

Returns a matrix containing neighbor information for all edges of all patches. Each entry [i,j] corresponds to the result of compute_edge_neighbours(mesh_topology, i, j).

source
Mantis.Mesh.compute_face_neighbours Method
julia
compute_face_neighbours(mesh_topology::MeshTopology{3,4})

Returns a matrix where each entry [i,j] contains the neighbor information of the j-th face of patch i, as described in compute_face_neighbours(mesh_topology, patch_id, face_local_id).

source
Mantis.Mesh.compute_face_neighbours Method
julia
compute_face_neighbours(mesh_topology::MeshTopology{3,4}, patch_id::Int, face_local_id::Int)

Returns a 4 × N matrix for the face face_local_id of patch_id containing information about its neighboring patches:

  • Row 1: Neighboring patch ID

  • Row 2: Local face ID in the neighbor patch

  • Row 3: Rotation (number of vertices shifted), numbering of neighbour face dofs must be rotated clockwise 90 degrees as many times are rotation.

  • Row 4: Orientation (+1 if aligned, -1 if reversed), indicates if the axis of the face in the neighbor patch is aligned with the axis of the face in the current patch, if not, the dof numbering must be transposed.

Only applicable to 3D hexahedral meshes.

source
Mantis.Mesh.compute_vertex_neighbours Method
julia
compute_vertex_neighbours(mesh_topology::MeshTopology, patch_id::Int, vertex_local_id::Int)

Returns a 4 × N matrix of vertex neighbor data:

  • Row 1: Neighboring patch ID.

  • Row 2: Local vertex ID in neighbor.

  • Row 3: Always 0 (no rotation for vertices).

  • Row 4: Always 0 (no orientation.

Applicable to all supported topologies.

source
Mantis.Mesh.compute_vertex_neighbours Method
julia
compute_vertex_neighbours(mesh_topology::MeshTopology)

Returns a matrix of vertex neighbor information for all vertices of all patches.

source
Mantis.Mesh.get_breakpoints Method
julia
get_breakpoints(patch::Patch{n}) where {n}

Returns the breakpoints per dimension.

Arguments

  • patch::Patch{n}: Patch of which to get the breakpoints.

Returns

  • ::NTuple{n, Vector{Float64}}: Breakpoints per dimension.
source
Mantis.Mesh.get_breakpoints Method
julia
get_breakpoints(patch::Patch{n}, d::Int) where {n}

Returns the breakpoints in dimension d.

Arguments

  • patch::Patch{n}: Patch of which to get the breakpoints.

  • d::Int: Dimension in which to get the size.

Returns

  • ::Vector{Float64}: Breakpoints in dimension d.
source
Mantis.Mesh.get_element_ids Method
julia
get_element_ids(patch::Patch{n}) where {n}

Returns an iterator of the valid element ids for this patch.

The element ids are computed on-the-fly by the iterator and are neither precomputed nor stored.

Arguments

  • patch::Patch{n}: Patch to get the element ids for.

Returns

  • ::Base.Iterators.ProductIterator{NTuple{n, StepRange{Int, Int}}}: Iterator of NTuples of element ids.
source
Mantis.Mesh.get_element_vertices Method
julia
get_element_vertices(patch::Patch1D, element_id::Int)

Returns the vertices of the element specified by element_id.

Arguments

  • patch::Patch1D: The 1-dimensional patch.

  • element_id::Int: The id of the element.

Returns

  • ::NTuple{1, Vector{Float64}}: The vertices of the element.
source
Mantis.Mesh.id2position Method
julia
id2position(manifold_dim::Int, object_dim::Int, object_local_id::Int)

Maps the local object ID (vertex, edge, face) in a reference patch to a logical position tuple.

Supports dimensions 1 to 3. Logical positions are defined based on assumption of tensor product patches (lines, quads, hexahedra) and logical coordinate system is as follows: - -1: located at the leftmost or bottommost position (start of interval of that dimension) - 1: located at rightmost or topmost position (end of interval of that dimension) - 0: extended over that dimension

This means that the start vertex of a line segment is at (-1,), the end vertex is at (1,), and the edge is at (0,).

For a quadrilateral, the vertices are at (-1, -1), (1, -1), (1, 1), (-1, 1), and the edges are at (-1, 0), (1, 0), (0, -1), (0, 1) (left, right, bottom, top). The face is at (0, 0).

For hexahedra, the same logic follows, but now with one additional index.

source
Mantis.Mesh.position2id Method
julia
position2id(position::NTuple{D, Int}) where {D}

Maps a logical position (tuple of Ints) to its local object ID within the reference patch. Inverse of id2position.

See id2position for the definition of logical positions.

source