Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d9/dd6/namespacedolfinx_1_1refinement.html
DOLFINx  0.5.1
DOLFINx C++ interface
Namespaces | Functions
dolfinx::refinement Namespace Reference

Mesh refinement algorithms. More...

Namespaces

 plaza
 Function in this namespace implement the refinement method described in Plaza and Carey "Local refinement of simplicial grids based on the skeleton" (Applied Numerical Mathematics 32 (2000) 195-218).
 

Functions

mesh::Mesh refine (const mesh::Mesh &mesh, bool redistribute=true)
 Create a uniformly refined mesh. More...
 
mesh::Mesh refine (const mesh::Mesh &mesh, const std::span< const std::int32_t > &edges, bool redistribute=true)
 Create a locally refined mesh. More...
 
void update_logical_edgefunction (MPI_Comm neighbor_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. More...
 
std::tuple< std::map< std::int32_t, std::int64_t >, std::vector< double >, std::array< std::size_t, 2 > > create_new_vertices (MPI_Comm neighbor_comm, const graph::AdjacencyList< int > &shared_edges, const mesh::Mesh &mesh, const std::vector< std::int8_t > &marked_edges)
 Add new vertex for each marked edge, and create new_vertex_coordinates and global_edge->new_vertex map. More...
 
mesh::Mesh partition (const mesh::Mesh &old_mesh, const graph::AdjacencyList< std::int64_t > &cell_topology, std::span< const double > 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. More...
 
std::vector< std::int64_t > adjust_indices (const common::IndexMap &map, std::int32_t n)
 Add indices to account for extra n values on this process. More...
 
mesh::MeshTags< std::int32_t > transfer_facet_meshtag (const mesh::MeshTags< std::int32_t > &meshtag, std::shared_ptr< const mesh::Mesh > refined_mesh, const std::vector< std::int32_t > &cell, const std::vector< std::int8_t > &facet)
 Transfer facet MeshTags from coarse mesh to refined mesh. More...
 
mesh::MeshTags< std::int32_t > transfer_cell_meshtag (const mesh::MeshTags< std::int32_t > &parent_meshtag, std::shared_ptr< const mesh::Mesh > refined_mesh, const std::vector< std::int32_t > &parent_cell)
 Transfer cell MeshTags from coarse mesh to refined mesh. More...
 

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 
)

Add indices to account for extra n values on this process.

Todo:
Fix docstring. It is unclear.

This is a utility to help add new topological vertices on each process into the space of the index map.

Parameters
[in]mapIndex map for the current mesh vertices
[in]nNumber of new entries to be accommodated on this process
Returns
Global indices as if "n" extra values are appended on each process

◆ create_new_vertices()

std::tuple< std::map< std::int32_t, std::int64_t >, std::vector< double >, std::array< std::size_t, 2 > > create_new_vertices ( MPI_Comm  neighbor_comm,
const graph::AdjacencyList< int > &  shared_edges,
const mesh::Mesh mesh,
const std::vector< 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]neighbor_commMPI Communicator for neighborhood
[in]shared_edges
[in]meshExisting mesh
[in]marked_edges
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()

mesh::Mesh partition ( const mesh::Mesh old_mesh,
const graph::AdjacencyList< std::int64_t > &  cell_topology,
std::span< const double >  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]

mesh::Mesh refine ( const mesh::Mesh mesh,
bool  redistribute = true 
)

Create a uniformly refined mesh.

Parameters
[in]meshThe mesh from which to build a refined Mesh
[in]redistributeOptional argument to redistribute the refined mesh if mesh is a distributed mesh.
Returns
A refined mesh

◆ refine() [2/2]

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

Create a locally refined mesh.

Parameters
[in]meshThe mesh from which to build a refined Mesh
[in]edgesIndices of the edges that should be split by this refinement. mesh::compute_incident_entities can be used to compute the edges that are incident to other entities, e.g. incident to cells.
[in]redistributeOptional argument to redistribute the refined mesh if mesh is a distributed mesh.
Returns
A locally refined mesh

◆ transfer_cell_meshtag()

mesh::MeshTags< std::int32_t > transfer_cell_meshtag ( const mesh::MeshTags< std::int32_t > &  parent_meshtag,
std::shared_ptr< const mesh::Mesh refined_mesh,
const std::vector< 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]parent_meshtagCell MeshTags on parent mesh
[in]refined_meshRefined mesh based on parent mesh
[in]parent_cellParent cell of each cell in refined mesh
Returns
MeshTags on refined mesh, values copied over from coarse mesh

◆ transfer_facet_meshtag()

mesh::MeshTags< std::int32_t > transfer_facet_meshtag ( const mesh::MeshTags< std::int32_t > &  meshtag,
std::shared_ptr< const mesh::Mesh refined_mesh,
const std::vector< std::int32_t > &  cell,
const std::vector< 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]meshtagFacet tags on parent mesh
[in]refined_meshRefined mesh based on parent mesh
[in]cellParent cell of each cell in refined mesh
[in]facetLocal facets of parent in each cell in refined mesh
Returns
MeshTags on refined mesh

◆ update_logical_edgefunction()

void update_logical_edgefunction ( MPI_Comm  neighbor_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]neighbor_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