DOLFIN-X
DOLFIN-X C++ interface
Public Member Functions | Static Public Member Functions | List of all members
dolfinx::refinement::ParallelRefinement Class Reference

Data structure and methods for refining meshes in parallel. More...

#include <ParallelRefinement.h>

Public Member Functions

 ParallelRefinement (const mesh::Mesh &mesh)
 Constructor.
 
 ParallelRefinement (const ParallelRefinement &p)=delete
 Disable copy constructor.
 
ParallelRefinementoperator= (const ParallelRefinement &p)=delete
 Disable copy assignment.
 
 ~ParallelRefinement ()
 Destructor.
 
const std::vector< bool > & marked_edges () const
 Return markers for all edges. More...
 
bool mark (std::int32_t edge_index)
 Mark edge by index. More...
 
void mark_all ()
 Mark all edges in mesh.
 
void mark (const mesh::MeshTags< std::int8_t > &refinement_marker)
 Mark all edges incident on entities indicated by refinement marker. More...
 
void update_logical_edgefunction ()
 Transfer marked edges between processes.
 
std::map< std::int32_t, std::int64_t > create_new_vertices ()
 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. More...
 
mesh::Mesh partition (const std::vector< std::int64_t > &cell_topology, int num_ghost_cells, bool redistribute) const
 Use vertex and topology data to partition new mesh across processes. More...
 
mesh::Mesh build_local (const std::vector< std::int64_t > &cell_topology) const
 Build local mesh from internal data when not running in parallel. More...
 

Static Public Member Functions

static std::vector< std::int64_t > adjust_indices (const std::shared_ptr< const common::IndexMap > &index_map, std::int32_t n)
 Adjust indices to account for extra n values on each process This is a utility to help add new topological vertices on each process into the space of the index map. More...
 

Detailed Description

Data structure and methods for refining meshes in parallel.

ParallelRefinement encapsulates two main features: a distributed MeshTags defined over the mesh edges, which can be updated across processes, and storage for local mesh data, which can be used to construct the new Mesh

Member Function Documentation

◆ adjust_indices()

std::vector< std::int64_t > ParallelRefinement::adjust_indices ( const std::shared_ptr< const common::IndexMap > &  index_map,
std::int32_t  n 
)
static

Adjust indices to account for extra n values on each process This is a utility to help add new topological vertices on each process into the space of the index map.

Parameters
index_mapIndexMap of current mesh vertices
nNumber of new entries to be accommodated on this process
Returns
Global indices as if "n" extra values are appended on each process

◆ build_local()

mesh::Mesh ParallelRefinement::build_local ( const std::vector< std::int64_t > &  cell_topology) const

Build local mesh from internal data when not running in parallel.

Parameters
[in]cell_topology
Returns
A Mesh

◆ create_new_vertices()

std::map< std::int32_t, std::int64_t > ParallelRefinement::create_new_vertices ( )

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.

Returns
edge_to_new_vertex map

◆ mark() [1/2]

void ParallelRefinement::mark ( const mesh::MeshTags< std::int8_t > &  refinement_marker)

Mark all edges incident on entities indicated by refinement marker.

Parameters
[in]refinement_markerValue 1 means "refine", any other value means "do not refine"

◆ mark() [2/2]

bool ParallelRefinement::mark ( std::int32_t  edge_index)

Mark edge by index.

Parameters
[in]edge_indexIndex of edge to mark
Returns
false if marker was already set, otherwise true

◆ marked_edges()

const std::vector< bool > & ParallelRefinement::marked_edges ( ) const

Return markers for all edges.

Returns
array of markers

◆ partition()

mesh::Mesh ParallelRefinement::partition ( const std::vector< std::int64_t > &  cell_topology,
int  num_ghost_cells,
bool  redistribute 
) const

Use vertex and topology data to partition new mesh across processes.

Parameters
[in]cell_topologyTopology of cells, (vertex indices)
[in]num_ghost_cellsNumber of cells which are ghost (at end of list)
[in]redistributeCall graph partitioner if true
Returns
New mesh

The documentation for this class was generated from the following files: