DOLFINx 0.8.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
Namespaces | Functions
dolfinx::refinement Namespace Reference

Mesh refinement algorithms. More...

Namespaces

namespace  plaza
 Plaza mesh refinement.
 

Functions

template<std::floating_point T>
mesh::Mesh< T > refine (const mesh::Mesh< T > &mesh, bool redistribute=true)
 Create a uniformly refined mesh.
 
template<std::floating_point T>
mesh::Mesh< T > refine (const mesh::Mesh< T > &mesh, std::span< const std::int32_t > edges, bool redistribute=true)
 Create a locally refined mesh.
 
void update_logical_edgefunction (MPI_Comm comm, const std::vector< std::vector< std::int32_t > > &marked_for_update, std::vector< std::int8_t > &marked_edges, const common::IndexMap &map)
 Communicate edge markers between processes that share edges.
 
template<std::floating_point T>
std::tuple< std::map< std::int32_t, std::int64_t >, std::vector< T >, std::array< std::size_t, 2 > > create_new_vertices (MPI_Comm comm, const graph::AdjacencyList< int > &shared_edges, const mesh::Mesh< T > &mesh, std::span< const std::int8_t > marked_edges)
 Add new vertex for each marked edge, and create new_vertex_coordinates and global_edge->new_vertex map.
 
template<std::floating_point T>
mesh::Mesh< T > partition (const mesh::Mesh< T > &old_mesh, const graph::AdjacencyList< std::int64_t > &cell_topology, std::span< const T > new_coords, std::array< std::size_t, 2 > xshape, bool redistribute, mesh::GhostMode ghost_mode)
 
std::vector< std::int64_t > adjust_indices (const common::IndexMap &map, std::int32_t n)
 Given an index map, add "n" extra indices at the end of local range.
 
std::array< std::vector< std::int32_t >, 2 > transfer_facet_meshtag (const mesh::MeshTags< std::int32_t > &tags0, const mesh::Topology &topology1, std::span< const std::int32_t > cell, std::span< const std::int8_t > facet)
 Transfer facet MeshTags from coarse mesh to refined mesh.
 
std::array< std::vector< std::int32_t >, 2 > transfer_cell_meshtag (const mesh::MeshTags< std::int32_t > &tags0, const mesh::Topology &topology1, std::span< const std::int32_t > parent_cell)
 Transfer cell MeshTags from coarse mesh to refined mesh.
 

Detailed Description

Mesh refinement algorithms.

Methods for refining meshes uniformly, or with markers, using edge bisection.

Function Documentation

◆ adjust_indices()

std::vector< std::int64_t > adjust_indices ( const common::IndexMap & map,
std::int32_t n )

Given an index map, add "n" extra indices at the end of local range.

Note
The returned global indices (local and ghosts) are adjust for the addition of new local indices.
Parameters
[in]mapIndex map
[in]nNumber of new local indices
Returns
New global indices for both owned and ghosted indices in input index map.

◆ create_new_vertices()

template<std::floating_point T>
std::tuple< std::map< std::int32_t, std::int64_t >, std::vector< T >, std::array< std::size_t, 2 > > create_new_vertices ( MPI_Comm comm,
const graph::AdjacencyList< int > & shared_edges,
const mesh::Mesh< T > & mesh,
std::span< const std::int8_t > marked_edges )

Add new vertex for each marked edge, and create new_vertex_coordinates and global_edge->new_vertex map.

Communicate new vertices with MPI to all affected processes.

Parameters
[in]commMPI Communicator for neighborhood
[in]shared_edgesFor each local edge on a process map to ghost processes
[in]meshExisting mesh
[in]marked_edgesA marker for all edges on the process (local + ghosts) indicating if an edge should be refined
Returns
(0) map from local edge index to new vertex global index, (1) the coordinates of the new vertices (row-major storage) and (2) the shape of the new coordinates.

◆ partition()

template<std::floating_point T>
mesh::Mesh< T > partition ( const mesh::Mesh< T > & old_mesh,
const graph::AdjacencyList< std::int64_t > & cell_topology,
std::span< const T > new_coords,
std::array< std::size_t, 2 > xshape,
bool redistribute,
mesh::GhostMode ghost_mode )

Use vertex and topology data to partition new mesh across processes

Parameters
[in]old_mesh
[in]cell_topologyTopology of cells, (vertex indices)
[in]new_coordsNew coordinates, row-major storage
[in]xshapeThe shape of new_coords
[in]redistributeCall graph partitioner if true
[in]ghost_modeNone or shared_facet
Returns
New mesh

◆ refine() [1/2]

template<std::floating_point T>
mesh::Mesh< T > refine ( const mesh::Mesh< T > & mesh,
bool redistribute = true )

Create a uniformly refined mesh.

Parameters
[in]meshMesh to create a new, refined mesh from
[in]redistributeIf true refined mesh is re-partitioned across MPI ranks.
Returns
Refined mesh

◆ refine() [2/2]

template<std::floating_point T>
mesh::Mesh< T > refine ( const mesh::Mesh< T > & mesh,
std::span< const std::int32_t > edges,
bool redistribute = true )

Create a locally refined mesh.

Parameters
[in]meshMesh to create a new, refined mesh from.
[in]edgesIndices of the edges that should be split during refinement. mesh::compute_incident_entities can be used to compute the edges that are incident to other entities, e.g. incident to cells.
[in]redistributeIf true refined mesh is re-partitioned across MPI ranks.
Returns
Refined mesh.

◆ transfer_cell_meshtag()

std::array< std::vector< std::int32_t >, 2 > transfer_cell_meshtag ( const mesh::MeshTags< std::int32_t > & tags0,
const mesh::Topology & topology1,
std::span< const std::int32_t > parent_cell )

Transfer cell MeshTags from coarse mesh to refined mesh.

Note
The refined mesh must not have been redistributed during refinement.
GhostMode must be GhostMode.none
Parameters
[in]tags0Tags on the parent mesh
[in]topology1Refined mesh topology
[in]parent_cellParent cell of each cell in refined mesh
Returns
(0) entities and (1) values on the refined topology

◆ transfer_facet_meshtag()

std::array< std::vector< std::int32_t >, 2 > transfer_facet_meshtag ( const mesh::MeshTags< std::int32_t > & tags0,
const mesh::Topology & topology1,
std::span< const std::int32_t > cell,
std::span< const std::int8_t > facet )

Transfer facet MeshTags from coarse mesh to refined mesh.

Note
The refined mesh must not have been redistributed during refinement
GhostMode must be GhostMode.none
Parameters
[in]tags0Tags on the parent mesh
[in]topology1Refined mesh topology
[in]cellParent cell of each cell in refined mesh
[in]facetLocal facets of parent in each cell in refined mesh
Returns
(0) entities and (1) values on the refined topology

◆ update_logical_edgefunction()

void update_logical_edgefunction ( MPI_Comm comm,
const std::vector< std::vector< std::int32_t > > & marked_for_update,
std::vector< std::int8_t > & marked_edges,
const common::IndexMap & map )

Communicate edge markers between processes that share edges.

Parameters
[in]commMPI Communicator for neighborhood
[in]marked_for_updateLists of edges to be updated on each neighbor. marked_for_update[r] is the list of edge indices that are marked by the caller and are shared with local MPI rank r.
[in,out]marked_edgesMarker for each edge on the calling process
[in]mapIndex map for the mesh edges