Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d0/d47/mesh_2utils_8h.html
DOLFINx 0.7.3
DOLFINx C++ interface
Loading...
Searching...
No Matches
Namespaces | Concepts | Typedefs | Enumerations | Functions
utils.h File Reference

Functions supporting mesh operations. More...

Go to the source code of this file.

Namespaces

namespace  dolfinx
 Top-level namespace.
 
namespace  dolfinx::fem
 Finite element method functionality.
 
namespace  dolfinx::mesh
 Mesh data structures and algorithms on meshes.
 

Concepts

concept  dolfinx::mesh::MarkerFn
 Requirements on function for geometry marking.
 

Typedefs

using CellPartitionFunction = std::function< graph::AdjacencyList< std::int32_t >(MPI_Comm comm, int nparts, int tdim, const graph::AdjacencyList< std::int64_t > &cells)>
 Signature for the cell partitioning function. The function should compute the destination rank for cells currently on this rank.
 

Enumerations

enum class  GhostMode : int { none , shared_facet , shared_vertex }
 Enum for different partitioning ghost modes.
 

Functions

template<std::floating_point T>
std::tuple< std::vector< std::int32_t >, std::vector< T >, std::vector< std::int32_t > > compute_vertex_coords_boundary (const mesh::Mesh< T > &mesh, int dim, std::span< const std::int32_t > facets)
 The coordinates of 'vertices' for for entities of a give dimension that are attached to specified facets.
 
std::vector< std::int32_t > exterior_facet_indices (const Topology &topology)
 Compute the indices of all exterior facets that are owned by the caller.
 
graph::AdjacencyList< std::int64_t > extract_topology (const CellType &cell_type, const fem::ElementDofLayout &layout, const graph::AdjacencyList< std::int64_t > &cells)
 Extract topology from cell data, i.e. extract cell vertices.
 
template<std::floating_point T>
std::vector< T > h (const Mesh< T > &mesh, std::span< const std::int32_t > entities, int dim)
 Compute greatest distance between any two vertices of the mesh entities (h).
 
template<std::floating_point T>
std::vector< T > cell_normals (const Mesh< T > &mesh, int dim, std::span< const std::int32_t > entities)
 Compute normal to given cell (viewed as embedded in 3D)
 
template<std::floating_point T>
std::vector< T > compute_midpoints (const Mesh< T > &mesh, int dim, std::span< const std::int32_t > entities)
 Compute the midpoints for mesh entities of a given dimension.
 
template<std::floating_point T>
std::pair< std::vector< T >, std::array< std::size_t, 2 > > compute_vertex_coords (const mesh::Mesh< T > &mesh)
 The coordinates for all 'vertices' in the mesh.
 
template<std::floating_point T, MarkerFn< T > U>
std::vector< std::int32_t > locate_entities (const Mesh< T > &mesh, int dim, U marker)
 Compute indices of all mesh entities that evaluate to true for the provided geometric marking function.
 
template<std::floating_point T, MarkerFn< T > U>
std::vector< std::int32_t > locate_entities_boundary (const Mesh< T > &mesh, int dim, U marker)
 Compute indices of all mesh entities that are attached to an owned boundary facet and evaluate to true for the provided geometric marking function.
 
template<std::floating_point T>
std::vector< std::int32_t > entities_to_geometry (const Mesh< T > &mesh, int dim, std::span< const std::int32_t > entities, bool orient)
 Determine the indices in the geometry data for each vertex of the given mesh entities.
 
CellPartitionFunction create_cell_partitioner (mesh::GhostMode ghost_mode=mesh::GhostMode::none, const graph::partition_fn &partfn=&graph::partition_graph)
 Create a function that computes destination rank for mesh cells in this rank by applying the default graph partitioner to the dual graph of the mesh.
 
std::vector< std::int32_t > compute_incident_entities (const Topology &topology, std::span< const std::int32_t > entities, int d0, int d1)
 Compute incident indices.
 
template<typename U >
Mesh< typename std::remove_reference_t< typename U::value_type > > create_mesh (MPI_Comm comm, const graph::AdjacencyList< std::int64_t > &cells, const std::vector< fem::CoordinateElement< typename std::remove_reference_t< typename U::value_type > > > &elements, const U &x, std::array< std::size_t, 2 > xshape, CellPartitionFunction partitioner)
 Create a mesh using a provided mesh partitioning function.
 
template<typename U >
Mesh< typename std::remove_reference_t< typename U::value_type > > create_mesh (MPI_Comm comm, const graph::AdjacencyList< std::int64_t > &cells, const std::vector< fem::CoordinateElement< std::remove_reference_t< typename U::value_type > > > &elements, const U &x, std::array< std::size_t, 2 > xshape, GhostMode ghost_mode)
 Create a mesh using the default partitioner.
 
template<std::floating_point T>
std::tuple< Mesh< T >, std::vector< std::int32_t >, std::vector< std::int32_t >, std::vector< std::int32_t > > create_submesh (const Mesh< T > &mesh, int dim, std::span< const std::int32_t > entities)
 Create a new mesh consisting of a subset of entities in a mesh.
 

Detailed Description

Functions supporting mesh operations.

Function Documentation

◆ compute_vertex_coords()

template<std::floating_point T>
std::pair< std::vector< T >, std::array< std::size_t, 2 > > compute_vertex_coords ( const mesh::Mesh< T > &  mesh)

The coordinates for all 'vertices' in the mesh.

Parameters
[in]meshMesh to compute the vertex coordinates for
Returns
The vertex coordinates. The shape is (3, num_vertices) and the jth column hold the coordinates of vertex j.

◆ compute_vertex_coords_boundary()

template<std::floating_point T>
std::tuple< std::vector< std::int32_t >, std::vector< T >, std::vector< std::int32_t > > compute_vertex_coords_boundary ( const mesh::Mesh< T > &  mesh,
int  dim,
std::span< const std::int32_t >  facets 
)

The coordinates of 'vertices' for for entities of a give dimension that are attached to specified facets.

Precondition
The provided facets must be on the boundary of the mesh.
Parameters
[in]meshMesh to compute the vertex coordinates for
[in]dimTopological dimension of the entities
[in]facetsList of facets on the meh boundary
Returns
(0) Entities attached to the boundary facets, (1) vertex coordinates (shape is (3, num_vertices)) and (2) map from vertex in the full mesh to the position (column) in the vertex coordinates array (set to -1 if vertex in full mesh is not in the coordinate array).