dolfin/mesh

Documentation for C++ code found in dolfin/mesh/*.h

Type definitions

CellIterator

C++ documentation for CellIterator from dolfin/mesh/Cell.h:

type dolfin::CellIterator

A CellIterator is a MeshEntityIterator of topological codimension 0.

EdgeIterator

C++ documentation for EdgeIterator from dolfin/mesh/Edge.h:

type dolfin::EdgeIterator

An EdgeIterator is a MeshEntityIterator of topological dimension 1.

FaceIterator

C++ documentation for FaceIterator from dolfin/mesh/Face.h:

type dolfin::FaceIterator

A FaceIterator is a MeshEntityIterator of topological dimension 2.

FacetIterator

C++ documentation for FacetIterator from dolfin/mesh/Facet.h:

type dolfin::FacetIterator

A FacetIterator is a MeshEntityIterator of topological codimension 1.

VertexIterator

C++ documentation for VertexIterator from dolfin/mesh/Vertex.h:

type dolfin::VertexIterator

A VertexIterator is a MeshEntityIterator of topological dimension 0.

Classes

BoundaryComputation

C++ documentation for BoundaryComputation from dolfin/mesh/BoundaryComputation.h:

class dolfin::BoundaryComputation

Provide a set of basic algorithms for the computation of boundaries.

void dolfin::BoundaryComputation::compute_boundary(const Mesh &mesh, const std::string type, BoundaryMesh &boundary)

Compute the exterior boundary of a given mesh

Parameters:
  • mesh – input mesh [direction=in]
  • type – “internal” or “external” [direction=in]
  • boundary – output boundary mesh [direction=out]
void dolfin::BoundaryComputation::reorder(std::vector<std::size_t> &vertices, const Facet &facet)
Parameters:
  • vertices
  • facet

BoundaryMesh

C++ documentation for BoundaryMesh from dolfin/mesh/BoundaryMesh.h:

class dolfin::BoundaryMesh : public dolfin::Mesh

A BoundaryMesh is a mesh over the boundary of some given mesh. The cells of the boundary mesh (facets of the original mesh) are oriented to produce outward pointing normals relative to the original mesh.

dolfin::BoundaryMesh::BoundaryMesh()
dolfin::BoundaryMesh::BoundaryMesh(const Mesh &mesh, std::string type, bool order = true)

Create boundary mesh from given mesh.

Parameters:
  • mesh – (Mesh ) Another Mesh object.
  • type – (std::string) The type of BoundaryMesh() , which can be “exterior”, “interior” or “local”. “exterior” is the globally external boundary, “interior” is the inter-process mesh and “local” is the boundary of the local (this process) mesh.
  • order – (bool) Optional argument which can be used to control whether or not the boundary mesh should be ordered according to the UFC ordering convention. If set to false, the boundary mesh will be ordered with right-oriented facets (outward-pointing unit normals). The default value is true.
MeshFunction<std::size_t> &dolfin::BoundaryMesh::entity_map(std::size_t d)

Get index map for entities of dimension d in the boundary mesh to the entity in the original full mesh

Parameters:d
const MeshFunction<std::size_t> &dolfin::BoundaryMesh::entity_map(std::size_t d) const

Get index map for entities of dimension d in the boundary mesh to the entity in the original full mesh (const version)

Parameters:d
dolfin::BoundaryMesh::~BoundaryMesh()

Destructor.

Cell

C++ documentation for Cell from dolfin/mesh/Cell.h:

class dolfin::Cell

A Cell is a MeshEntity of topological codimension 0.

dolfin::Cell::Cell()

Create empty cell.

dolfin::Cell::Cell(const Mesh &mesh, std::size_t index)

Create cell on given mesh with given index

Parameters:
  • mesh – The mesh.
  • index – The index.
Point dolfin::Cell::cell_normal() const

Compute normal to cell itself (viewed as embedded in 3D)

Returns:Point Normal of the cell
double dolfin::Cell::circumradius() const

Compute circumradius of cell

UnitSquareMesh mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.circumradius());
Returns:double The circumradius of the cell.
bool dolfin::Cell::collides(const MeshEntity &entity) const

Check whether given entity collides with cell

Parameters:entity – The cell to be checked.
Returns:bool True iff entity collides with cell.
bool dolfin::Cell::collides(const Point &point) const

Check whether given point collides with cell

Parameters:point – The point to be checked.
Returns:bool True iff point collides with cell.
bool dolfin::Cell::contains(const Point &point) const

Check whether given point is contained in cell. This function is identical to the function collides(point).

Parameters:point – The point to be checked.
Returns:bool True iff point is contained in cell.
double dolfin::Cell::distance(const Point &point) const

Compute distance to given point.

Parameters:point – The point.
Returns:double The distance to the point.
double dolfin::Cell::facet_area(std::size_t facet) const

Compute the area/length of given facet with respect to the cell

Parameters:facet – Index of the facet.
Returns:double Area/length of the facet.
void dolfin::Cell::get_cell_data(ufc::cell &ufc_cell, int local_facet = -1) const

Fill UFC cell with miscellaneous data.

Parameters:
  • ufc_cell
  • local_facet
void dolfin::Cell::get_cell_topology(ufc::cell &ufc_cell) const

Fill UFC cell with topology data.

Parameters:ufc_cell
void dolfin::Cell::get_coordinate_dofs(std::vector<double> &coordinates) const

Get cell coordinate dofs (not vertex coordinates)

Parameters:coordinates
void dolfin::Cell::get_vertex_coordinates(std::vector<double> &coordinates) const

Get cell vertex coordinates (not coordinate dofs)

Parameters:coordinates
double dolfin::Cell::h() const

Compute greatest distance between any two vertices

UnitSquareMesh mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.h());
Returns:double The greatest distance between any two vertices of the cell.
double dolfin::Cell::inradius() const

Compute inradius of cell

UnitSquareMesh mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.inradius());
Returns:double Radius of the sphere inscribed in the cell.
std::vector<Point> dolfin::Cell::intersection(const MeshEntity &entity) const

Compute triangulation of intersection with given entity

Parameters:entity – The entity with which to intersect.
Returns:std::vector<Point> A flattened array of simplices of dimension num_simplices x num_vertices x gdim = num_simplices x (tdim + 1) x gdim
Point dolfin::Cell::normal(std::size_t facet) const

Compute normal of given facet with respect to the cell

Parameters:facet – Index of facet.
Returns:Point Normal of the facet.
double dolfin::Cell::normal(std::size_t facet, std::size_t i) const

Compute component i of normal of given facet with respect to the cell

Parameters:
  • facet – Index of facet.
  • i – Component.
Returns:

double Component i of the normal of the facet.

std::size_t dolfin::Cell::num_vertices() const

Return number of vertices of cell.

void dolfin::Cell::order(const std::vector<std::int64_t> &local_to_global_vertex_indices)

Order entities locally

Parameters:local_to_global_vertex_indices – The global vertex indices.
bool dolfin::Cell::ordered(const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Check if entities are ordered

Parameters:local_to_global_vertex_indices – The global vertex indices.
Returns:bool True iff ordered.
std::size_t dolfin::Cell::orientation() const

Compute orientation of cell

Returns:std::size_t Orientation of the cell (0 is ‘up’/’right’, 1 is ‘down’/’left’)
std::size_t dolfin::Cell::orientation(const Point &up) const

Compute orientation of cell relative to given ‘up’ direction

Parameters:up – The direction defined as ‘up’
Returns:std::size_t Orientation of the cell (0 is ‘same’, 1 is ‘opposite’)
double dolfin::Cell::radius_ratio() const

Compute ratio of inradius to circumradius times dim for cell. Useful as cell quality measure. Returns 1. for equilateral and 0. for degenerate cell. See Jonathan Richard Shewchuk: What Is a Good Linear Finite Element?, online: http://www.cs.berkeley.edu/~jrs/papers/elemj.pdf

UnitSquareMesh mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.radius_ratio());
Returns:double topological_dimension * inradius / circumradius
double dolfin::Cell::squared_distance(const Point &point) const

Compute squared distance to given point.

Parameters:point – The point.
Returns:double The squared distance to the point.
CellType::Type dolfin::Cell::type() const

Return type of cell.

double dolfin::Cell::volume() const

Compute (generalized) volume of cell

UnitSquare mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.volume());
Returns:double The volume of the cell.
dolfin::Cell::~Cell()

Destructor.

CellFunction

C++ documentation for CellFunction from dolfin/mesh/Cell.h:

class dolfin::CellFunction : public dolfin::CellFunction<T>, dolfin::MeshFunction<T>

A CellFunction is a MeshFunction of topological codimension 0.

dolfin::CellFunction::CellFunction(std::shared_ptr<const Mesh> mesh)

Constructor on Mesh .

Parameters:mesh
dolfin::CellFunction::CellFunction(std::shared_ptr<const Mesh> mesh, const T &value)

Constructor on Mesh and value.

Parameters:
  • mesh
  • value

CellType

C++ documentation for CellType from dolfin/mesh/CellType.h:

class dolfin::CellType

This class provides a common interface for different cell types. Each cell type implements mesh functionality that is specific to a certain type of cell.

dolfin::CellType::CellType(Type cell_type, Type facet_type)

Constructor.

Parameters:
  • cell_type
  • facet_type
enum dolfin::CellType::Type

Enum for different cell types.

enumerator dolfin::CellType::Type::point
enumerator dolfin::CellType::Type::interval
enumerator dolfin::CellType::Type::triangle
enumerator dolfin::CellType::Type::quadrilateral
enumerator dolfin::CellType::Type::tetrahedron
enumerator dolfin::CellType::Type::hexahedron
Point dolfin::CellType::cell_normal(const Cell &cell) const = 0

Compute normal to given cell (viewed as embedded in 3D)

Parameters:cell
Type dolfin::CellType::cell_type() const

Return type of cell.

double dolfin::CellType::circumradius(const MeshEntity &entity) const = 0

Compute circumradius of mesh entity.

Parameters:entity
bool dolfin::CellType::collides(const Cell &cell, const MeshEntity &entity) const = 0

Check whether given entity collides with cell.

Parameters:
  • cell
  • entity
bool dolfin::CellType::collides(const Cell &cell, const Point &point) const = 0

Check whether given point collides with cell.

Parameters:
  • cell
  • point
CellType *dolfin::CellType::create(Type type)

Create cell type from type (factory function)

Parameters:type
CellType *dolfin::CellType::create(std::string type)

Create cell type from string (factory function)

Parameters:type
void dolfin::CellType::create_entities(boost::multi_array<unsigned int, 2> &e, std::size_t dim, const unsigned int *v) const = 0

Create entities e of given topological dimension from vertices v

Parameters:
  • e
  • dim
  • v
std::string dolfin::CellType::description(bool plural) const = 0

Return description of cell type.

Parameters:plural
std::size_t dolfin::CellType::dim() const = 0

Return topological dimension of cell.

Type dolfin::CellType::entity_type(std::size_t i) const

Return type of cell for entity of dimension i.

Parameters:i
double dolfin::CellType::facet_area(const Cell &cell, std::size_t facet) const = 0

Compute the area/length of given facet with respect to the cell.

Parameters:
  • cell
  • facet
Type dolfin::CellType::facet_type() const

Return type of cell for facets.

double dolfin::CellType::h(const MeshEntity &entity) const

Compute greatest distance between any two vertices.

Parameters:entity
bool dolfin::CellType::increasing(std::size_t n0, const unsigned int *v0, std::size_t n1, const unsigned int *v1, std::size_t num_vertices, const unsigned int *vertices, const std::vector<std::int64_t> &local_to_global_vertex_indices)
Parameters:
  • n0
  • v0
  • n1
  • v1
  • num_vertices
  • vertices
  • local_to_global_vertex_indices
bool dolfin::CellType::increasing(std::size_t num_vertices, const unsigned int *vertices, const std::vector<std::int64_t> &local_to_global_vertex_indices)
Parameters:
  • num_vertices
  • vertices
  • local_to_global_vertex_indices
double dolfin::CellType::inradius(const Cell &cell) const

Compute inradius of cell.

Parameters:cell
bool dolfin::CellType::is_simplex() const = 0

Check if cell is a simplex.

Point dolfin::CellType::normal(const Cell &cell, std::size_t facet) const = 0

Compute of given facet with respect to the cell.

Parameters:
  • cell
  • facet
double dolfin::CellType::normal(const Cell &cell, std::size_t facet, std::size_t i) const = 0

Compute component i of normal of given facet with respect to the cell.

Parameters:
  • cell
  • facet
  • i
std::size_t dolfin::CellType::num_entities(std::size_t dim) const = 0

Return number of entities of given topological dimension.

Parameters:dim
std::size_t dolfin::CellType::num_vertices() const

Return number of vertices for cell.

std::size_t dolfin::CellType::num_vertices(std::size_t dim) const = 0

Return number of vertices for entity of given topological dimension.

Parameters:dim
void dolfin::CellType::order(Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const = 0

Order entities locally.

Parameters:
  • cell
  • local_to_global_vertex_indices
bool dolfin::CellType::ordered(const Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Check if entities are ordered.

Parameters:
  • cell
  • local_to_global_vertex_indices
std::size_t dolfin::CellType::orientation(const Cell &cell) const = 0

Return orientation of the cell (assuming flat space)

Parameters:cell
std::size_t dolfin::CellType::orientation(const Cell &cell, const Point &up) const

Return orientation of the cell relative to given up direction.

Parameters:
  • cell
  • up
double dolfin::CellType::radius_ratio(const Cell &cell) const

Compute dim*inradius/circumradius for given cell.

Parameters:cell
void dolfin::CellType::sort_entities(std::size_t num_vertices, unsigned int *vertices, const std::vector<std::int64_t> &local_to_global_vertex_indices)

Sort vertices based on global entity indices.

Parameters:
  • num_vertices
  • vertices
  • local_to_global_vertex_indices
double dolfin::CellType::squared_distance(const Cell &cell, const Point &point) const = 0

Compute squared distance to given point.

Parameters:
  • cell
  • point
Type dolfin::CellType::string2type(std::string type)

Convert from string to cell type.

Parameters:type
std::string dolfin::CellType::type2string(Type type)

Convert from cell type to string.

Parameters:type
double dolfin::CellType::volume(const MeshEntity &entity) const = 0

Compute (generalized) volume of mesh entity.

Parameters:entity
std::vector<std::int8_t> dolfin::CellType::vtk_mapping() const = 0

Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.

dolfin::CellType::~CellType()

Destructor.

DistributedMeshTools

C++ documentation for DistributedMeshTools from dolfin/mesh/DistributedMeshTools.h:

class dolfin::DistributedMeshTools

This class provides various functionality for working with distributed meshes.

type dolfin::DistributedMeshTools::Entity
void dolfin::DistributedMeshTools::compute_entity_ownership(const MPI_Comm mpi_comm, const std::map<std::vector<std::size_t>, unsigned int> &entities, const std::map<std::int32_t, std::set<unsigned int>> &shared_vertices_local, const std::vector<std::int64_t> &global_vertex_indices, std::size_t d, std::vector<std::size_t> &owned_entities, std::array<std::map<Entity, EntityData>, 2> &shared_entities)
Parameters:
  • mpi_comm
  • entities
  • shared_vertices_local
  • global_vertex_indices
  • d
  • owned_entities
  • shared_entities
void dolfin::DistributedMeshTools::compute_final_entity_ownership(const MPI_Comm mpi_comm, std::vector<std::size_t> &owned_entities, std::array<std::map<Entity, EntityData>, 2> &entity_ownership)
Parameters:
  • mpi_comm
  • owned_entities
  • entity_ownership
std::pair<std::size_t, std::size_t> dolfin::DistributedMeshTools::compute_num_global_entities(const MPI_Comm mpi_comm, std::size_t num_local_entities, std::size_t num_processes, std::size_t process_number)
Parameters:
  • mpi_comm
  • num_local_entities
  • num_processes
  • process_number
void dolfin::DistributedMeshTools::compute_preliminary_entity_ownership(const MPI_Comm mpi_comm, const std::map<std::size_t, std::set<unsigned int>> &shared_vertices, const std::map<Entity, unsigned int> &entities, std::vector<std::size_t> &owned_entities, std::array<std::map<Entity, EntityData>, 2> &entity_ownership)
Parameters:
  • mpi_comm
  • shared_vertices
  • entities
  • owned_entities
  • entity_ownership
std::unordered_map<unsigned int, std::vector<std::pair<unsigned int, unsigned int>>> dolfin::DistributedMeshTools::compute_shared_entities(const Mesh &mesh, std::size_t d)

Compute map from local index of shared entity to list of sharing process and local index, i.e. (local index, [(sharing process p, local index on p)])

Parameters:
  • mesh
  • d
void dolfin::DistributedMeshTools::init_facet_cell_connections(Mesh &mesh)

Compute number of cells connected to each facet (globally). Facets on internal boundaries will be connected to two cells (with the cells residing on neighboring processes)

Parameters:mesh
bool dolfin::DistributedMeshTools::is_shared(const std::vector<std::size_t> &entity_vertices, const std::map<std::size_t, std::set<unsigned int>> &shared_vertices)
Parameters:
  • entity_vertices
  • shared_vertices
std::map<std::size_t, std::set<std::pair<std::size_t, std::size_t>>> dolfin::DistributedMeshTools::locate_off_process_entities(const std::vector<std::size_t> &entity_indices, std::size_t dim, const Mesh &mesh)

Find processes that own or share mesh entities (using entity global indices). Returns (global_dof, set(process_num, local_index)). Exclusively local entities will not appear in the map. Works only for vertices and cells

Parameters:
  • entity_indices
  • dim
  • mesh
std::size_t dolfin::DistributedMeshTools::number_entities(const Mesh &mesh, const std::map<unsigned int, std::pair<unsigned int, unsigned int>> &slave_entities, std::vector<std::int64_t> &global_entity_indices, std::map<std::int32_t, std::set<unsigned int>> &shared_entities, std::size_t d)

Create global entity indices for entities of dimension d for given global vertex indices.

Parameters:
  • mesh
  • slave_entities
  • global_entity_indices
  • shared_entities
  • d
void dolfin::DistributedMeshTools::number_entities(const Mesh &mesh, std::size_t d)

Create global entity indices for entities of dimension d.

Parameters:
  • mesh
  • d
void dolfin::DistributedMeshTools::reorder_values_by_global_indices(MPI_Comm mpi_comm, std::vector<double> &values, const std::size_t width, const std::vector<std::int64_t> &global_indices)

Reorder the values of given width, according to explicit global indices, distributing evenly across processes

Parameters:
  • mpi_comm
  • values
  • width
  • global_indices
void dolfin::DistributedMeshTools::reorder_values_by_global_indices(const Mesh &mesh, std::vector<double> &data, const std::size_t width)

Reorder the values (of given width) in data to be in global vertex index order on the Mesh , redistributing evenly across processes

Parameters:
  • mesh
  • data
  • width
std::vector<double> dolfin::DistributedMeshTools::reorder_vertices_by_global_indices(const Mesh &mesh)

Reorders the vertices in a distributed mesh according to their global index, and redistributes them evenly across processes returning the coordinates as a local vector

Parameters:mesh

DomainBoundary

C++ documentation for DomainBoundary from dolfin/mesh/DomainBoundary.h:

class dolfin::DomainBoundary

This class provides a SubDomain which picks out the boundary of a mesh, and provides a convenient way to specify boundary conditions on the entire boundary of a mesh.

dolfin::DomainBoundary::DomainBoundary()

Constructor.

bool dolfin::DomainBoundary::inside(const Array<double> &x, bool on_boundary) const

Return true for points on the boundary.

Parameters:
  • x
  • on_boundary
dolfin::DomainBoundary::~DomainBoundary()

Destructor.

DynamicMeshEditor

C++ documentation for DynamicMeshEditor from dolfin/mesh/DynamicMeshEditor.h:

class dolfin::DynamicMeshEditor

This class provides an interface for dynamic editing of meshes, that is, when the number of vertices and cells are not known a priori. If the number of vertices and cells are known a priori, it is more efficient to use the default editor MeshEditor .

dolfin::DynamicMeshEditor::DynamicMeshEditor()

Constructor.

void dolfin::DynamicMeshEditor::add_cell(std::size_t c, const std::vector<std::size_t> &v)

Add cell with given vertices.

Parameters:
  • c
  • v
void dolfin::DynamicMeshEditor::add_cell(std::size_t c, std::size_t v0, std::size_t v1)

Add cell (interval) with given vertices.

Parameters:
  • c
  • v0
  • v1
void dolfin::DynamicMeshEditor::add_cell(std::size_t c, std::size_t v0, std::size_t v1, std::size_t v2)

Add cell (triangle) with given vertices.

Parameters:
  • c
  • v0
  • v1
  • v2
void dolfin::DynamicMeshEditor::add_cell(std::size_t c, std::size_t v0, std::size_t v1, std::size_t v2, std::size_t v3)

Add cell (tetrahedron) with given vertices.

Parameters:
  • c
  • v0
  • v1
  • v2
  • v3
void dolfin::DynamicMeshEditor::add_vertex(std::size_t v, const Point &p)

Add vertex v at given point p.

Parameters:
  • v
  • p
void dolfin::DynamicMeshEditor::add_vertex(std::size_t v, double x)

Add vertex v at given coordinate x.

Parameters:
  • v
  • x
void dolfin::DynamicMeshEditor::add_vertex(std::size_t v, double x, double y)

Add vertex v at given coordinate (x, y)

Parameters:
  • v
  • x
  • y
void dolfin::DynamicMeshEditor::add_vertex(std::size_t v, double x, double y, double z)

Add vertex v at given coordinate (x, y, z)

Parameters:
  • v
  • x
  • y
  • z
std::vector<std::size_t> dolfin::DynamicMeshEditor::cell_vertices
void dolfin::DynamicMeshEditor::clear()
void dolfin::DynamicMeshEditor::close(bool order = false)

Close mesh, finish editing, and order entities locally.

Parameters:order
void dolfin::DynamicMeshEditor::open(Mesh &mesh, CellType::Type type, std::size_t tdim, std::size_t gdim, std::size_t num_global_vertices, std::size_t num_global_cells)

Open mesh of given cell type, topological and geometrical dimension.

Parameters:
  • mesh
  • type
  • tdim
  • gdim
  • num_global_vertices
  • num_global_cells
void dolfin::DynamicMeshEditor::open(Mesh &mesh, std::string type, std::size_t tdim, std::size_t gdim, std::size_t num_global_vertices, std::size_t num_global_cells)

Open mesh of given cell type, topological and geometrical dimension.

Parameters:
  • mesh
  • type
  • tdim
  • gdim
  • num_global_vertices
  • num_global_cells
std::vector<double> dolfin::DynamicMeshEditor::vertex_coordinates
dolfin::DynamicMeshEditor::~DynamicMeshEditor()

Destructor.

Edge

C++ documentation for Edge from dolfin/mesh/Edge.h:

class dolfin::Edge

An Edge is a MeshEntity of topological dimension 1.

dolfin::Edge::Edge(MeshEntity &entity)

Create edge from mesh entity

Parameters:entity – (MeshEntity ) The mesh entity to create an edge from.
dolfin::Edge::Edge(const Mesh &mesh, std::size_t index)

Create edge on given mesh

Parameters:
  • mesh – (Mesh ) The mesh.
  • index – (std::size_t) Index of the edge.
double dolfin::Edge::dot(const Edge &edge) const

Compute dot product between edge and other edge

UnitSquare mesh(2, 2);
Edge edge1(mesh, 0);
Edge edge2(mesh, 1);
info("%g", edge1.dot(edge2));
Parameters:edge – (Edge ) Another edge.
Returns:double The dot product.
double dolfin::Edge::length() const

Compute Euclidean length of edge

UnitSquare mesh(2, 2);
Edge edge(mesh, 0);
info("%g", edge.length());
Returns:double Euclidean length of edge.
dolfin::Edge::~Edge()

Destructor.

EdgeFunction

C++ documentation for EdgeFunction from dolfin/mesh/Edge.h:

class dolfin::EdgeFunction : public dolfin::EdgeFunction<T>, dolfin::MeshFunction<T>

An EdgeFunction is a MeshFunction of topological dimension 1.

dolfin::EdgeFunction::EdgeFunction(std::shared_ptr<const Mesh> mesh)

Constructor on Mesh .

Parameters:mesh
dolfin::EdgeFunction::EdgeFunction(std::shared_ptr<const Mesh> mesh, const T &value)

Constructor on Mesh and value.

Parameters:
  • mesh
  • value

Face

C++ documentation for Face from dolfin/mesh/Face.h:

class dolfin::Face

A Face is a MeshEntity of topological dimension 2.

dolfin::Face::Face(const Mesh &mesh, std::size_t index)

Constructor.

Parameters:
  • mesh
  • index
double dolfin::Face::area() const

Calculate the area of the face (triangle)

Point dolfin::Face::normal() const

Compute normal to the face.

double dolfin::Face::normal(std::size_t i) const

Compute component i of the normal to the face.

Parameters:i
dolfin::Face::~Face()

Destructor.

FaceFunction

C++ documentation for FaceFunction from dolfin/mesh/Face.h:

class dolfin::FaceFunction : public dolfin::FaceFunction<T>, dolfin::MeshFunction<T>

A FaceFunction is a MeshFunction of topological dimension 2.

dolfin::FaceFunction::FaceFunction(std::shared_ptr<const Mesh> mesh)

Constructor on Mesh .

Parameters:mesh
dolfin::FaceFunction::FaceFunction(std::shared_ptr<const Mesh> mesh, const T &value)

Constructor on Mesh and value.

Parameters:
  • mesh
  • value

Facet

C++ documentation for Facet from dolfin/mesh/Facet.h:

class dolfin::Facet

A Facet is a MeshEntity of topological codimension 1.

dolfin::Facet::Facet(const Mesh &mesh, std::size_t index)

Constructor.

Parameters:
  • mesh
  • index
double dolfin::Facet::distance(const Point &point) const

Compute distance to given point.

Parameters:point – (Point ) The point.
Returns:double The distance to the point.
bool dolfin::Facet::exterior() const

Return true if facet is an exterior facet (relative to global mesh, so this function will return false for facets on partition boundaries). Facet connectivity must be initialized before calling this function.

Point dolfin::Facet::normal() const

Compute normal to the facet.

double dolfin::Facet::normal(std::size_t i) const

Compute component i of the normal to the facet.

Parameters:i
double dolfin::Facet::squared_distance(const Point &point) const

Compute squared distance to given point.

Parameters:point – (Point ) The point.
Returns:double The squared distance to the point.
dolfin::Facet::~Facet()

Destructor.

FacetCell

C++ documentation for FacetCell from dolfin/mesh/FacetCell.h:

class dolfin::FacetCell : public dolfin::Cell

This class represents a cell in a mesh incident to a facet on the boundary. It is useful in cases where one needs to iterate over a boundary mesh and access the corresponding cells in the original mesh.

dolfin::FacetCell::FacetCell(const BoundaryMesh &mesh, const Cell &facet)

Create cell on mesh corresponding to given facet (cell) on boundary.

Parameters:
  • mesh
  • facet
std::size_t dolfin::FacetCell::facet_index() const

Return local index of facet with respect to the cell.

dolfin::FacetCell::~FacetCell()

Destructor.

FacetFunction

C++ documentation for FacetFunction from dolfin/mesh/Facet.h:

class dolfin::FacetFunction : public dolfin::FacetFunction<T>, dolfin::MeshFunction<T>

A FacetFunction is a MeshFunction of topological codimension 1.

dolfin::FacetFunction::FacetFunction(std::shared_ptr<const Mesh> mesh)

Constructor on Mesh .

Parameters:mesh
dolfin::FacetFunction::FacetFunction(std::shared_ptr<const Mesh> mesh, const T &value)

Constructor on Mesh and value.

Parameters:
  • mesh
  • value

HexahedronCell

C++ documentation for HexahedronCell from dolfin/mesh/HexahedronCell.h:

class dolfin::HexahedronCell

This class implements functionality for hexahedral cell meshes.

dolfin::HexahedronCell::HexahedronCell()

Specify cell type and facet type.

Point dolfin::HexahedronCell::cell_normal(const Cell &cell) const

Compute normal to given cell (viewed as embedded in 3D)

Parameters:cell
double dolfin::HexahedronCell::circumradius(const MeshEntity &triangle) const

Compute diameter of triangle.

Parameters:triangle
bool dolfin::HexahedronCell::collides(const Cell &cell, const MeshEntity &entity) const

Check whether given entity collides with cell.

Parameters:
  • cell
  • entity
bool dolfin::HexahedronCell::collides(const Cell &cell, const Point &point) const

Check whether given point collides with cell.

Parameters:
  • cell
  • point
void dolfin::HexahedronCell::create_entities(boost::multi_array<unsigned int, 2> &e, std::size_t dim, const unsigned int *v) const

Create entities e of given topological dimension from vertices v.

Parameters:
  • e
  • dim
  • v
std::string dolfin::HexahedronCell::description(bool plural) const

Return description of cell type.

Parameters:plural
std::size_t dolfin::HexahedronCell::dim() const

Return topological dimension of cell.

double dolfin::HexahedronCell::facet_area(const Cell &cell, std::size_t facet) const

Compute the area/length of given facet with respect to the cell.

Parameters:
  • cell
  • facet
bool dolfin::HexahedronCell::is_simplex() const

Check if cell is a simplex.

Point dolfin::HexahedronCell::normal(const Cell &cell, std::size_t facet) const

Compute of given facet with respect to the cell.

Parameters:
  • cell
  • facet
double dolfin::HexahedronCell::normal(const Cell &cell, std::size_t facet, std::size_t i) const

Compute component i of normal of given facet with respect to the cell.

Parameters:
  • cell
  • facet
  • i
std::size_t dolfin::HexahedronCell::num_entities(std::size_t dim) const

Return number of entities of given topological dimension.

Parameters:dim
std::size_t dolfin::HexahedronCell::num_vertices(std::size_t dim) const

Return number of vertices for entity of given topological dimension.

Parameters:dim
void dolfin::HexahedronCell::order(Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Order entities locally.

Parameters:
  • cell
  • local_to_global_vertex_indices
std::size_t dolfin::HexahedronCell::orientation(const Cell &cell) const

Return orientation of the cell.

Parameters:cell
double dolfin::HexahedronCell::squared_distance(const Cell &cell, const Point &point) const

Compute squared distance to given point (3D enabled)

Parameters:
  • cell
  • point
double dolfin::HexahedronCell::volume(const MeshEntity &triangle) const

Compute (generalized) volume (area) of triangle.

Parameters:triangle
std::vector<std::int8_t> dolfin::HexahedronCell::vtk_mapping() const

Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.

IntervalCell

C++ documentation for IntervalCell from dolfin/mesh/IntervalCell.h:

class dolfin::IntervalCell

This class implements functionality for interval cell meshes.

dolfin::IntervalCell::IntervalCell()

Specify cell type and facet type.

Point dolfin::IntervalCell::cell_normal(const Cell &cell) const

Compute normal to given cell (viewed as embedded in 2D)

Parameters:cell
double dolfin::IntervalCell::circumradius(const MeshEntity &interval) const

Compute circumradius of interval.

Parameters:interval
bool dolfin::IntervalCell::collides(const Cell &cell, const MeshEntity &entity) const

Check whether given entity collides with cell.

Parameters:
  • cell
  • entity
bool dolfin::IntervalCell::collides(const Cell &cell, const Point &point) const

Check whether given point collides with cell.

Parameters:
  • cell
  • point
void dolfin::IntervalCell::create_entities(boost::multi_array<unsigned int, 2> &e, std::size_t dim, const unsigned int *v) const

Create entities e of given topological dimension from vertices v.

Parameters:
  • e
  • dim
  • v
std::string dolfin::IntervalCell::description(bool plural) const

Return description of cell type.

Parameters:plural
std::size_t dolfin::IntervalCell::dim() const

Return topological dimension of cell.

double dolfin::IntervalCell::facet_area(const Cell &cell, std::size_t facet) const

Compute the area/length of given facet with respect to the cell.

Parameters:
  • cell
  • facet
bool dolfin::IntervalCell::is_simplex() const

Check if cell is a simplex.

Point dolfin::IntervalCell::normal(const Cell &cell, std::size_t facet) const

Compute of given facet with respect to the cell.

Parameters:
  • cell
  • facet
double dolfin::IntervalCell::normal(const Cell &cell, std::size_t facet, std::size_t i) const

Compute component i of normal of given facet with respect to the cell

Parameters:
  • cell
  • facet
  • i
std::size_t dolfin::IntervalCell::num_entities(std::size_t dim) const

Return number of entities of given topological dimension.

Parameters:dim
std::size_t dolfin::IntervalCell::num_vertices(std::size_t dim) const

Return number of vertices for entity of given topological dimension

Parameters:dim
void dolfin::IntervalCell::order(Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Order entities locally.

Parameters:
  • cell
  • local_to_global_vertex_indices
std::size_t dolfin::IntervalCell::orientation(const Cell &cell) const

Return orientation of the cell (assuming flat space)

Parameters:cell
double dolfin::IntervalCell::squared_distance(const Cell &cell, const Point &point) const

Compute squared distance to given point (3D enabled)

Parameters:
  • cell
  • point
double dolfin::IntervalCell::squared_distance(const Point &point, const Point &a, const Point &b)

Compute squared distance to given point. This version takes the two vertex coordinates as 3D points. This makes it possible to reuse this function for computing the (squared) distance to a triangle.

Parameters:
  • point
  • a
  • b
double dolfin::IntervalCell::volume(const MeshEntity &interval) const

Compute (generalized) volume (length) of interval.

Parameters:interval
std::vector<std::int8_t> dolfin::IntervalCell::vtk_mapping() const

Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.

LocalMeshData

C++ documentation for LocalMeshData from dolfin/mesh/LocalMeshData.h:

class dolfin::LocalMeshData

This class stores mesh data on a local processor corresponding to a portion of a (larger) global mesh. Note that the data stored in this class does typically not correspond to a topologically connected mesh; it merely stores a list of vertex coordinates, a list of cell-vertex mappings and a list of global vertex numbers for the locally stored vertices. It is typically used for parsing meshes in parallel from mesh XML files. After local mesh data has been parsed on each processor, a subsequent repartitioning takes place: first a geometric partitioning of the vertices followed by a redistribution of vertex and cell data, and then a topological partitioning again followed by redistribution of vertex and cell data, at that point corresponding to topologically connected meshes instead of local mesh data.

dolfin::LocalMeshData::LocalMeshData(const MPI_Comm mpi_comm)

Create empty local mesh data.

Parameters:mpi_comm
dolfin::LocalMeshData::LocalMeshData(const Mesh &mesh)

Create local mesh data for given mesh.

Parameters:mesh
void dolfin::LocalMeshData::broadcast_mesh_data(const MPI_Comm mpi_comm)

Broadcast mesh data from main process (used when Mesh is created on one process)

Parameters:mpi_comm
void dolfin::LocalMeshData::check() const

Check that all essential data has been initialized, and throw error if there is a problem

void dolfin::LocalMeshData::clear()

Clear all data.

std::map<std::size_t, std::vector<std::pair<std::pair<std::size_t, std::size_t>, std::size_t>>> dolfin::LocalMeshData::domain_data

Mesh domain data [dim](line, (cell_index, local_index, value))

void dolfin::LocalMeshData::extract_mesh_data(const Mesh &mesh)

Copy data from mesh.

Parameters:mesh
Geometry dolfin::LocalMeshData::geometry

Geometry data.

MPI_Comm dolfin::LocalMeshData::mpi_comm() const

Return MPI communicator.

void dolfin::LocalMeshData::receive_mesh_data(const MPI_Comm mpi_comm)

Receive mesh data from main process.

Parameters:mpi_comm
void dolfin::LocalMeshData::reorder()

Reorder cell data.

std::string dolfin::LocalMeshData::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose
Topology dolfin::LocalMeshData::topology

Holder for topology data.

dolfin::LocalMeshData::~LocalMeshData()

Destructor.

LocalMeshValueCollection

C++ documentation for LocalMeshValueCollection from dolfin/mesh/LocalMeshValueCollection.h:

class dolfin::LocalMeshValueCollection

This class stores mesh data on a local processor corresponding to a portion of a MeshValueCollection .

dolfin::LocalMeshValueCollection::LocalMeshValueCollection(MPI_Comm comm, const MeshValueCollection<T> &values, std::size_t dim)

Create local mesh data for given LocalMeshValueCollection() .

Parameters:
  • comm
  • values
  • dim
std::size_t dolfin::LocalMeshValueCollection::dim() const

Return dimension of cell entity.

const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T>> &dolfin::LocalMeshValueCollection::values() const

Return data.

dolfin::LocalMeshValueCollection::~LocalMeshValueCollection()

Destructor.

Mesh

C++ documentation for Mesh from dolfin/mesh/Mesh.h:

class dolfin::Mesh

A Mesh consists of a set of connected and numbered mesh entities. Both the representation and the interface are dimension-independent, but a concrete interface is also provided for standard named mesh entities:

Entity Dimension Codimension
Vertex 0  
Edge 1  
Face 2  
Facet   1
Cell   0

When working with mesh iterators, all entities and connectivity are precomputed automatically the first time an iterator is created over any given topological dimension or connectivity. Note that for efficiency, only entities of dimension zero (vertices) and entities of the maximal dimension (cells) exist when creating a Mesh . Other entities must be explicitly created by calling init() . For example, all edges in a mesh may be created by a call to mesh.init(1). Similarly, connectivities such as all edges connected to a given vertex must also be explicitly created (in this case by a call to mesh.init(0, 1)).

Friends: MeshEditor, MeshPartitioning, TopologyComputation, create_mesh().

dolfin::Mesh::Mesh()

Create empty mesh.

dolfin::Mesh::Mesh(MPI_Comm comm)

Create empty mesh.

Parameters:comm
dolfin::Mesh::Mesh(MPI_Comm comm, LocalMeshData &local_mesh_data)

Create a distributed mesh from local (per process) data.

Parameters:
  • comm – (MPI_Comm) MPI communicator for the mesh.
  • local_mesh_data – (LocalMeshData ) Data from which to build the mesh.
dolfin::Mesh::Mesh(MPI_Comm comm, std::string filename)

Create mesh from data file.

Parameters:
  • comm – (MPI_Comm) The MPI communicator
  • filename – (std::string) Name of file to load.
dolfin::Mesh::Mesh(const Mesh &mesh)

Copy constructor.

Parameters:mesh – (Mesh() ) Object to be copied.
dolfin::Mesh::Mesh(std::string filename)

Create mesh from data file.

Parameters:filename – (std::string) Name of file to load.
std::shared_ptr<BoundingBoxTree> dolfin::Mesh::bounding_box_tree() const

Get bounding box tree for mesh. The bounding box tree is initialized and built upon the first call to this function. The bounding box tree can be used to compute collisions between the mesh and other objects. It is the responsibility of the caller to use (and possibly rebuild) the tree. It is stored as a (mutable) member of the mesh to enable sharing of the bounding box tree data structure.

Returns:std::shared_ptr<BoundingBoxTree>
const std::vector<int> &dolfin::Mesh::cell_orientations() const

Return cell_orientations (const version)

Returns:std::vector<int> :: Map from cell index to orientation of cell. Is empty if cell orientations have not been computed.
const std::vector<unsigned int> &dolfin::Mesh::cells() const

Get cell connectivity.

Returns:std::vector<unsigned int>& Connectivity for all cells.
void dolfin::Mesh::clean()

Clean out all auxiliary topology data. This clears all topological data, except the connectivity between cells and vertices.

const std::vector<std::size_t> &dolfin::Mesh::color(std::string coloring_type) const

Color the cells of the mesh such that no two neighboring cells share the same color. A colored mesh keeps a MeshFunction<std::size_t> named “cell colors” as mesh data which holds the colors of the mesh.

Parameters:coloring_type – (std::string) Coloring type, specifying what relation makes two cells neighbors, can be one of “vertex”, “edge” or “facet”.
Returns:std::vector<std::size_t>& The colors as a mesh function over the cells of the mesh.
const std::vector<std::size_t> &dolfin::Mesh::color(std::vector<std::size_t> coloring_type) const

Color the cells of the mesh such that no two neighboring cells share the same color. A colored mesh keeps a MeshFunction<std::size_t> named “cell colors” as mesh data which holds the colors of the mesh.

Parameters:coloring_type – (std::vector<std::size_t>&) Coloring type given as list of topological dimensions, specifying what relation makes two mesh entities neighbors.
Returns:std::vector<std::size_t>& The colors as a mesh function over entities of the mesh.
std::vector<double> &dolfin::Mesh::coordinates()

Get vertex coordinates.

Returns:std::vector<double>& Coordinates of all vertices.
const std::vector<double> &dolfin::Mesh::coordinates() const

Return coordinates of all vertices (const version).

Returns:std::vector<double>& Coordinates of all vertices.
MeshData &dolfin::Mesh::data()

Get mesh data.

Returns:MeshData & The mesh data object associated with the mesh.
const MeshData &dolfin::Mesh::data() const

Get mesh data (const version).

Returns:MeshData & The mesh data object associated with the mesh.
MeshDomains &dolfin::Mesh::domains()

Get mesh (sub)domains.

Returns:MeshDomains The (sub)domains associated with the mesh.
const MeshDomains &dolfin::Mesh::domains() const

Get mesh (sub)domains (const).

Returns:MeshDomains The (sub)domains associated with the mesh.
MeshGeometry &dolfin::Mesh::geometry()

Get mesh geometry.

Returns:MeshGeometry The geometry object associated with the mesh.
const MeshGeometry &dolfin::Mesh::geometry() const

Get mesh geometry (const version).

Returns:MeshGeometry The geometry object associated with the mesh.
std::string dolfin::Mesh::ghost_mode() const

Ghost mode used for partitioning. Possible values are same as parameters["ghost_mode"] . WARNING: the interface may change in future without deprecation; the method is now intended for internal library use.

std::size_t dolfin::Mesh::hash() const

Compute hash of mesh, currently based on the has of the mesh geometry and mesh topology.

Returns:std::size_t A tree-hashed value of the coordinates over all MPI processes
double dolfin::Mesh::hmax() const

Compute maximum cell size in mesh, measured greatest distance between any two vertices of a cell.

Returns:double The maximum cell size. The size is computed using Cell::h
double dolfin::Mesh::hmin() const

Compute minimum cell size in mesh, measured greatest distance between any two vertices of a cell.

Returns:double The minimum cell size. The size is computed using Cell::h
void dolfin::Mesh::init() const

Compute all entities and connectivity.

void dolfin::Mesh::init(std::size_t d0, std::size_t d1) const

Compute connectivity between given pair of dimensions.

Parameters:
  • d0 – (std::size_t) Topological dimension.
  • d1 – (std::size_t) Topological dimension.
std::size_t dolfin::Mesh::init(std::size_t dim) const

Compute entities of given topological dimension.

Parameters:dim – (std::size_t) Topological dimension.
Returns:std::size_t Number of created entities.
void dolfin::Mesh::init_cell_orientations(const Expression &global_normal)

Compute and initialize cell_orientations relative to a given global outward direction/normal/orientation. Only defined if mesh is orientable.

Parameters:global_normal – (Expression ) A global normal direction to the mesh
void dolfin::Mesh::init_global(std::size_t dim) const

Compute global indices for entity dimension dim.

Parameters:dim
MPI_Comm dolfin::Mesh::mpi_comm() const

Mesh MPI communicator

Returns:MPI_Comm
std::size_t dolfin::Mesh::num_cells() const

Get number of cells in mesh.

Returns:std::size_t Number of cells.
std::size_t dolfin::Mesh::num_edges() const

Get number of edges in mesh.

Returns:std::size_t Number of edges.
std::size_t dolfin::Mesh::num_entities(std::size_t d) const

Get number of entities of given topological dimension.

Parameters:d – (std::size_t) Topological dimension.
Returns:std::size_t Number of entities of topological dimension d.
std::size_t dolfin::Mesh::num_entities_global(std::size_t dim) const

Get global number of entities of given topological dimension.

Parameters:dim – (std::size_t) Topological dimension.
Returns:std::size_t Global number of entities of topological dimension d.
std::size_t dolfin::Mesh::num_faces() const

Get number of faces in mesh.

Returns:std::size_t Number of faces.
std::size_t dolfin::Mesh::num_facets() const

Get number of facets in mesh.

Returns:std::size_t Number of facets.
std::size_t dolfin::Mesh::num_vertices() const

Get number of vertices in mesh.

Returns:std::size_t Number of vertices.
const Mesh &dolfin::Mesh::operator=(const Mesh &mesh)

Assignment operator

Parameters:mesh – (Mesh ) Another Mesh object.
void dolfin::Mesh::order()

Order all mesh entities. See also: UFC documentation (put link here!)

bool dolfin::Mesh::ordered() const

Check if mesh is ordered according to the UFC numbering convention.

Returns:bool The return values is true iff the mesh is ordered.
Mesh dolfin::Mesh::renumber_by_color() const

Renumber mesh entities by coloring. This function is currently restricted to renumbering by cell coloring. The cells (cell-vertex connectivity) and the coordinates of the mesh are renumbered to improve the locality within each color. It is assumed that the mesh has already been colored and that only cell-vertex connectivity exists as part of the mesh.

Returns:Mesh
double dolfin::Mesh::rmax() const

Compute maximum cell inradius.

Returns:double The maximum of cells’ inscribed sphere radii
double dolfin::Mesh::rmin() const

Compute minimum cell inradius.

Returns:double The minimum of cells’ inscribed sphere radii
void dolfin::Mesh::rotate(double angle, std::size_t axis, const Point &point)

Rotate mesh around a coordinate axis through a given point

Parameters:
  • angle – (double) The number of degrees (0-360) of rotation.
  • axis – (std::size_t) The coordinate axis around which to rotate the mesh.
  • point – (Point ) The point around which to rotate the mesh.
void dolfin::Mesh::rotate(double angle, std::size_t axis = 2)

Rotate mesh around a coordinate axis through center of mass of all mesh vertices

Parameters:
  • angle – (double) The number of degrees (0-360) of rotation.
  • axis – (std::size_t) The coordinate axis around which to rotate the mesh.
void dolfin::Mesh::scale(double factor)

Scale mesh coordinates with given factor. Arguments factor (double) The factor defining the scaling.

Parameters:factor
void dolfin::Mesh::smooth(std::size_t num_iterations = 1)

Smooth internal vertices of mesh by local averaging.

Parameters:num_iterations – (std::size_t) Number of iterations to perform smoothing, default value is 1.
void dolfin::Mesh::smooth_boundary(std::size_t num_iterations = 1, bool harmonic_smoothing = true)

Smooth boundary vertices of mesh by local averaging.

Parameters:
  • num_iterations – (std::size_t) Number of iterations to perform smoothing, default value is 1.
  • harmonic_smoothing – (bool) Flag to turn on harmonics smoothing, default value is true.
void dolfin::Mesh::snap_boundary(const SubDomain &sub_domain, bool harmonic_smoothing = true)

Snap boundary vertices of mesh to match given sub domain.

Parameters:
  • sub_domain – (SubDomain ) A SubDomain object.
  • harmonic_smoothing – (bool) Flag to turn on harmonics smoothing, default value is true.
std::string dolfin::Mesh::str(bool verbose) const

Informal string representation.

Parameters:verbose – (bool) Flag to turn on additional output.
Returns:std::string An informal representation of the mesh.
MeshTopology &dolfin::Mesh::topology()

Get mesh topology.

Returns:MeshTopology The topology object associated with the mesh.
const MeshTopology &dolfin::Mesh::topology() const

Get mesh topology (const version).

Returns:MeshTopology The topology object associated with the mesh.
void dolfin::Mesh::translate(const Point &point)

Translate mesh according to a given vector.

Parameters:point – (Point ) The vector defining the translation.
CellType &dolfin::Mesh::type()

Get mesh cell type.

Returns:CellType & The cell type object associated with the mesh.
const CellType &dolfin::Mesh::type() const

Get mesh cell type (const version).

dolfin::Mesh::~Mesh()

Destructor.

MeshColoring

C++ documentation for MeshColoring from dolfin/mesh/MeshColoring.h:

class dolfin::MeshColoring

This class computes colorings for a local mesh. It supports vertex, edge, and facet-based colorings.

MeshFunction<std::size_t> dolfin::MeshColoring::cell_colors(std::shared_ptr<const Mesh> mesh, std::string coloring_type)

Return a MeshFunction with the cell colors (used for visualisation)

Parameters:
  • mesh
  • coloring_type
MeshFunction<std::size_t> dolfin::MeshColoring::cell_colors(std::shared_ptr<const Mesh> mesh, std::vector<std::size_t> coloring_type)

Return a MeshFunction with the cell colors (used for visualisation)

Parameters:
  • mesh
  • coloring_type
const std::vector<std::size_t> &dolfin::MeshColoring::color(Mesh &mesh, const std::vector<std::size_t> &coloring_type)

Color the cells of a mesh for given coloring type specified by topological dimension, which can be one of 0, 1 or D -

  1. Coloring is saved in the mesh topology
Parameters:
  • mesh
  • coloring_type
const std::vector<std::size_t> &dolfin::MeshColoring::color_cells(Mesh &mesh, std::string coloring_type)

Color the cells of a mesh for given coloring type, which can be one of “vertex”, “edge” or “facet”. Coloring is saved in the mesh topology

Parameters:
  • mesh
  • coloring_type
std::size_t dolfin::MeshColoring::compute_colors(const Mesh &mesh, std::vector<std::size_t> &colors, const std::vector<std::size_t> &coloring_type)

Compute cell colors for given coloring type specified by topological dimension, which can be one of 0, 1 or D - 1.

Parameters:
  • mesh
  • colors
  • coloring_type
std::size_t dolfin::MeshColoring::type_to_dim(std::string coloring_type, const Mesh &mesh)

Convert coloring type to topological dimension.

Parameters:
  • coloring_type
  • mesh

MeshConnectivity

C++ documentation for MeshConnectivity from dolfin/mesh/MeshConnectivity.h:

class dolfin::MeshConnectivity

Mesh connectivity stores a sparse data structure of connections (incidence relations) between mesh entities for a fixed pair of topological dimensions. The connectivity can be specified either by first giving the number of entities and the number of connections for each entity, which may either be equal for all entities or different, or by giving the entire (sparse) connectivity pattern.

dolfin::MeshConnectivity::MeshConnectivity(const MeshConnectivity &connectivity)

Copy constructor.

Parameters:connectivity
dolfin::MeshConnectivity::MeshConnectivity(std::size_t d0, std::size_t d1)

Create empty connectivity between given dimensions (d0 – d1)

Parameters:
  • d0
  • d1
void dolfin::MeshConnectivity::clear()

Clear all data.

bool dolfin::MeshConnectivity::empty() const

Return true if the total number of connections is equal to zero.

std::size_t dolfin::MeshConnectivity::hash() const

Hash of connections.

std::vector<unsigned int> dolfin::MeshConnectivity::index_to_position
void dolfin::MeshConnectivity::init(std::size_t num_entities, std::size_t num_connections)

Initialize number of entities and number of connections (equal for all)

Parameters:
  • num_entities
  • num_connections
void dolfin::MeshConnectivity::init(std::vector<std::size_t> &num_connections)

Initialize number of entities and number of connections (individually)

Parameters:num_connections
const std::vector<unsigned int> &dolfin::MeshConnectivity::operator()() const

Return contiguous array of connections for all entities.

const unsigned int *dolfin::MeshConnectivity::operator()(std::size_t entity) const

Return array of connections for given entity.

Parameters:entity
const MeshConnectivity &dolfin::MeshConnectivity::operator=(const MeshConnectivity &connectivity)

Assignment.

Parameters:connectivity
void dolfin::MeshConnectivity::set(const T &connections)

Set all connections for all entities (T is a ‘2D’ container, e.g. a std::vector<<std::vector<std::size_t>>, std::vector<<std::set<std::size_t>>, etc)

Parameters:connections
void dolfin::MeshConnectivity::set(std::size_t entity, const T &connections)

Set all connections for given entity. T is a contains, e.g. std::vector<std::size_t>

Parameters:
  • entity
  • connections
void dolfin::MeshConnectivity::set(std::size_t entity, std::size_t *connections)

Set all connections for given entity.

Parameters:
  • entity
  • connections
void dolfin::MeshConnectivity::set(std::size_t entity, std::size_t connection, std::size_t pos)

Set given connection for given entity.

Parameters:
  • entity
  • connection
  • pos
void dolfin::MeshConnectivity::set_global_size(const std::vector<unsigned int> &num_global_connections)

Set global number of connections for all local entities.

Parameters:num_global_connections
std::size_t dolfin::MeshConnectivity::size() const

Return total number of connections.

std::size_t dolfin::MeshConnectivity::size(std::size_t entity) const

Return number of connections for given entity.

Parameters:entity
std::size_t dolfin::MeshConnectivity::size_global(std::size_t entity) const

Return global number of connections for given entity.

Parameters:entity
std::string dolfin::MeshConnectivity::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose
dolfin::MeshConnectivity::~MeshConnectivity()

Destructor.

MeshData

C++ documentation for MeshData from dolfin/mesh/MeshData.h:

class dolfin::MeshData

The class MeshData is a container for auxiliary mesh data, represented either as arrays or maps. Each dataset is identified by a unique user-specified string. Only std::size_t-valued data are currently supported. Auxiliary mesh data may be attached to a mesh by users as a convenient way to store data associated with a mesh. It is also used internally by DOLFIN to communicate data associated with meshes. The following named mesh data are recognized by DOLFIN: Facet orientation (used for assembly over interior facets)

  • “facet_orientation” - std:vector <std::size_t> of dimension D - 1

Sub meshes (used by the class SubMesh )

  • “parent_vertex_indices” - std::vector <std::size_t> of dimension 0

Note to developers: use underscore in names in place of spaces.

Friends: XMLMesh.

dolfin::MeshData::MeshData()

Constructor.

std::vector<std::size_t> &dolfin::MeshData::array(std::string name, std::size_t dim)

Return array with given name (returning zero if data is not available)

Parameters:
  • name – (std::string) The name of the array.
  • dim – (std::size_t) Dimension.
Returns:

std::vector<std::size_t> The array.

const std::vector<std::size_t> &dolfin::MeshData::array(std::string name, std::size_t dim) const

Return array with given name (returning zero if data is not available)

Parameters:
  • name – (std::string) The name of the array.
  • dim – (std::size_t) Dimension.
Returns:

std::vector<std::size_t> The array.

void dolfin::MeshData::check_deprecated(std::string name) const
Parameters:name
void dolfin::MeshData::clear()

Clear all data.

std::vector<std::size_t> &dolfin::MeshData::create_array(std::string name, std::size_t dim)

Create array (vector) with given name and size

Parameters:
  • name – (std::string) The name of the array.
  • dim – (std::size_t) Dimension.
Returns:

std::vector<std::size_t> The array.

void dolfin::MeshData::erase_array(const std::string name, std::size_t dim)

Erase array with given name

Parameters:
  • name – (std::string) The name of the array.
  • dim – (std::size_t) Dimension.
bool dolfin::MeshData::exists(std::string name, std::size_t dim) const

Check is array exists

Parameters:
  • name – (std::string) The name of the array.
  • dim – (std::size_t)
Returns:

bool True is array exists, false otherwise.

const MeshData &dolfin::MeshData::operator=(const MeshData &data)

Assignment operator

Parameters:data – (MeshData ) Another MeshData object.
std::string dolfin::MeshData::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose – (bool) Flag to turn on additional output.
Returns:std::string An informal representation.
dolfin::MeshData::~MeshData()

Destructor.

MeshDomains

C++ documentation for MeshDomains from dolfin/mesh/MeshDomains.h:

class dolfin::MeshDomains

The class MeshDomains stores the division of a Mesh into subdomains. For each topological dimension 0 <= d <= D, where D is the topological dimension of the Mesh , a set of integer markers are stored for a subset of the entities of dimension d, indicating for each entity in the subset the number of the subdomain. It should be noted that the subset does not need to contain all entities of any given dimension; entities not contained in the subset are “unmarked”.

dolfin::MeshDomains::MeshDomains()

Create empty mesh domains.

void dolfin::MeshDomains::clear()

Clear all data.

std::size_t dolfin::MeshDomains::get_marker(std::size_t entity_index, std::size_t dim) const

Get marker (entity index, marker value) of a given dimension d. Throws an error if marker does not exist.

Parameters:
  • entity_index
  • dim
void dolfin::MeshDomains::init(std::size_t dim)

Initialize mesh domains for given topological dimension.

Parameters:dim
bool dolfin::MeshDomains::is_empty() const

Check whether domain data is empty.

std::map<std::size_t, std::size_t> &dolfin::MeshDomains::markers(std::size_t dim)

Get subdomain markers for given dimension (shared pointer version)

Parameters:dim
const std::map<std::size_t, std::size_t> &dolfin::MeshDomains::markers(std::size_t dim) const

Get subdomain markers for given dimension (const shared pointer version)

Parameters:dim
std::size_t dolfin::MeshDomains::max_dim() const

Return maximum topological dimension of stored markers.

std::size_t dolfin::MeshDomains::num_marked(std::size_t dim) const

Return number of marked entities of given dimension.

Parameters:dim
const MeshDomains &dolfin::MeshDomains::operator=(const MeshDomains &domains)

Assignment operator.

Parameters:domains
bool dolfin::MeshDomains::set_marker(std::pair<std::size_t, std::size_t> marker, std::size_t dim)

Set marker (entity index, marker value) of a given dimension d. Returns true if a new key is inserted, false otherwise.

Parameters:
  • marker
  • dim
dolfin::MeshDomains::~MeshDomains()

Destructor.

MeshEditor

C++ documentation for MeshEditor from dolfin/mesh/MeshEditor.h:

class dolfin::MeshEditor

A simple mesh editor for creating simplicial meshes in 1D, 2D and 3D.

Friends: TetrahedronCell.

dolfin::MeshEditor::MeshEditor()

Constructor.

void dolfin::MeshEditor::add_cell(std::size_t c, const T &v)

Add cell with given vertices

Parameters:
  • c – (std::size_t) The cell (index).
  • v – (typename T) The vertex indices (local indices)
void dolfin::MeshEditor::add_cell(std::size_t c, const std::vector<std::size_t> &v)

Add cell with given vertices (non-templated version for Python interface)

Parameters:
  • c – (std::size_t) The cell (index).
  • v – (std::vector<std::size_t>) The vertex indices (local indices)
void dolfin::MeshEditor::add_cell(std::size_t c, std::size_t v0, std::size_t v1)

Add cell with given vertices (1D)

Parameters:
  • c – (std::size_t) The cell (index).
  • v0 – (std::vector<std::size_t>) The first vertex (local index).
  • v1 – (std::vector<std::size_t>) The second vertex (local index).
void dolfin::MeshEditor::add_cell(std::size_t c, std::size_t v0, std::size_t v1, std::size_t v2)

Add cell with given vertices (2D)

Parameters:
  • c – (std::size_t) The cell (index).
  • v0 – (std::vector<std::size_t>) The first vertex (local index).
  • v1 – (std::vector<std::size_t>) The second vertex (local index).
  • v2 – (std::vector<std::size_t>) The third vertex (local index).
void dolfin::MeshEditor::add_cell(std::size_t c, std::size_t v0, std::size_t v1, std::size_t v2, std::size_t v3)

Add cell with given vertices (3D)

Parameters:
  • c – (std::size_t) The cell (index).
  • v0 – (std::vector<std::size_t>) The first vertex (local index).
  • v1 – (std::vector<std::size_t>) The second vertex (local index).
  • v2 – (std::vector<std::size_t>) The third vertex (local index).
  • v3 – (std::vector<std::size_t>) The fourth vertex (local index).
void dolfin::MeshEditor::add_cell(std::size_t local_index, std::size_t global_index, const T &v)

Add cell with given vertices

Parameters:
  • local_index – (std::size_t) The cell (index).
  • global_index – (std::size_t) The global (user) cell index.
  • v – (std::vector<std::size_t>) The vertex indices (local indices)
void dolfin::MeshEditor::add_cell_common(std::size_t v, std::size_t dim)
Parameters:
  • v
  • dim
void dolfin::MeshEditor::add_entity_point(std::size_t entity_dim, std::size_t order, std::size_t index, const Point &p)

Add a point in a given entity of dimension entity_dim.

Parameters:
  • entity_dim
  • order
  • index
  • p
void dolfin::MeshEditor::add_vertex(std::size_t index, const Point &p)

Add vertex v at given point p

Parameters:
  • index – (std::size_t) The vertex (index).
  • p – (Point ) The point.
void dolfin::MeshEditor::add_vertex(std::size_t index, const std::vector<double> &x)

Add vertex v at given coordinate x

Parameters:
  • index – (std::size_t) The vertex (index).
  • x – (std::vector<double>) The x-coordinates.
void dolfin::MeshEditor::add_vertex(std::size_t index, double x)

Add vertex v at given point x (for a 1D mesh)

Parameters:
  • index – (std::size_t) The vertex (index).
  • x – (double) The x-coordinate.
void dolfin::MeshEditor::add_vertex(std::size_t index, double x, double y)

Add vertex v at given point (x, y) (for a 2D mesh)

Parameters:
  • index – (std::size_t) The vertex (index).
  • x – (double) The x-coordinate.
  • y – (double) The y-coordinate.
void dolfin::MeshEditor::add_vertex(std::size_t index, double x, double y, double z)

Add vertex v at given point (x, y, z) (for a 3D mesh)

Parameters:
  • index – (std::size_t) The vertex (index).
  • x – (double) The x-coordinate.
  • y – (double) The y-coordinate.
  • z – (double) The z-coordinate.
void dolfin::MeshEditor::add_vertex_common(std::size_t v, std::size_t dim)
Parameters:
  • v
  • dim
void dolfin::MeshEditor::add_vertex_global(std::size_t local_index, std::size_t global_index, const Point &p)

Add vertex v at given point p

Parameters:
  • local_index – (std::size_t) The vertex (local index).
  • global_index – (std::size_t) The vertex (global_index).
  • p – (Point ) The point.
void dolfin::MeshEditor::add_vertex_global(std::size_t local_index, std::size_t global_index, const std::vector<double> &x)

Add vertex v at given coordinate x

Parameters:
  • local_index – (std::size_t) The vertex (local index).
  • global_index – (std::size_t) The vertex (global_index).
  • x – (std::vector<double>) The x-coordinates.
void dolfin::MeshEditor::check_vertices(const T &v) const
Parameters:v
void dolfin::MeshEditor::clear()
void dolfin::MeshEditor::close(bool order = true)

Close mesh, finish editing, and order entities locally

MeshEditor editor;
editor.open(mesh, 2, 2);
...
editor.close()
Parameters:order – (bool) Order entities locally if true. Default values is true.
void dolfin::MeshEditor::compute_boundary_indicators()
void dolfin::MeshEditor::init_cells(std::size_t num_cells)

Specify number of cells (serial version)

Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_cells(8);
Parameters:num_cells – (std::size_t) The number of cells.
void dolfin::MeshEditor::init_cells_global(std::size_t num_local_cells, std::size_t num_global_cells)

Specify number of cells (distributed version)

Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_cells(2, 6);
Parameters:
  • num_local_cells – (std::size_t) The number of local cells.
  • num_global_cells – (std::size_t) The number of cells in distributed mesh.
void dolfin::MeshEditor::init_entities()

Initialise entities in MeshGeometry Create required Edges and Faces for the current polynomial degree in the mesh topology, so that points can be added for them. In order to initialise entities, cells must all be added first.

void dolfin::MeshEditor::init_vertices(std::size_t num_vertices)

Specify number of vertices (serial version)

Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_vertices(9);
Parameters:num_vertices – (std::size_t) The number of vertices.
void dolfin::MeshEditor::init_vertices_global(std::size_t num_local_vertices, std::size_t num_global_vertices)

Specify number of vertices (distributed version)

Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_vertices(4, 8);
Parameters:
  • num_local_vertices – (std::size_t) The number of vertices on this process.
  • num_global_vertices – (std::size_t) The number of vertices in distributed mesh.
std::size_t dolfin::MeshEditor::next_cell
std::size_t dolfin::MeshEditor::next_vertex
void dolfin::MeshEditor::open(Mesh &mesh, CellType::Type type, std::size_t tdim, std::size_t gdim, std::size_t degree = 1)

Open mesh of given cell type, topological and geometrical dimension

Parameters:
  • mesh – (Mesh ) The mesh to open.
  • type – (CellType::Type ) Cell type.
  • tdim – (std::size_t) The topological dimension.
  • gdim – (std::size_t) The geometrical dimension.
  • degree – (std::size_t) The polynomial degree.
void dolfin::MeshEditor::open(Mesh &mesh, std::string type, std::size_t tdim, std::size_t gdim, std::size_t degree = 1)

Open mesh of given cell type, topological and geometrical dimension

Parameters:
  • mesh – (Mesh ) The mesh to open.
  • type – (std::string) Cell type.
  • tdim – (std::size_t) The topological dimension.
  • gdim – (std::size_t) The geometrical dimension.
  • degree – (std::size_t) The polynomial degree.
dolfin::MeshEditor::~MeshEditor()

Destructor.

MeshEntity

C++ documentation for MeshEntity from dolfin/mesh/MeshEntity.h:

class dolfin::MeshEntity

A MeshEntity represents a mesh entity associated with a specific topological dimension of some Mesh .

Friends: MeshEntityIterator, MeshEntityIteratorBase, SubsetIterator.

dolfin::MeshEntity::MeshEntity()

Default Constructor.

dolfin::MeshEntity::MeshEntity(const Mesh &mesh, std::size_t dim, std::size_t index)

Constructor

Parameters:
  • mesh – (Mesh ) The mesh.
  • dim – (std::size_t) The topological dimension.
  • index – (std::size_t) The index.
std::size_t dolfin::MeshEntity::dim() const

Return topological dimension

Returns:std::size_t The dimension.
const unsigned int *dolfin::MeshEntity::entities(std::size_t dim) const

Return array of indices for incident mesh entities of given topological dimension

Parameters:dim – (std::size_t) The topological dimension.
Returns:std::size_t The index for incident mesh entities of given dimension.
std::int64_t dolfin::MeshEntity::global_index() const

Return global index of mesh entity

Returns:std::size_t The global index. Set to std::numerical_limits<std::size_t>::max() if global index has not been computed
bool dolfin::MeshEntity::incident(const MeshEntity &entity) const

Check if given entity is incident

Parameters:entity – (MeshEntity ) The entity.
Returns:bool True if the given entity is incident
std::size_t dolfin::MeshEntity::index() const

Return index of mesh entity

Returns:std::size_t The index.
std::size_t dolfin::MeshEntity::index(const MeshEntity &entity) const

Compute local index of given incident entity (error if not found)

Parameters:entity – (MeshEntity ) The mesh entity.
Returns:std::size_t The local index of given entity.
void dolfin::MeshEntity::init(const Mesh &mesh, std::size_t dim, std::size_t index)

Initialize mesh entity with given data

Parameters:
  • mesh – (Mesh ) The mesh.
  • dim – (std::size_t) The topological dimension.
  • index – (std::size_t) The index.
bool dolfin::MeshEntity::is_ghost() const

Determine whether an entity is a ‘ghost’ from another process

Returns:bool True if entity is a ghost entity
bool dolfin::MeshEntity::is_shared() const

Determine if an entity is shared or not

Returns:bool True if entity is shared
const Mesh &dolfin::MeshEntity::mesh() const

Return mesh associated with mesh entity

Returns:Mesh The mesh.
std::size_t dolfin::MeshEntity::mesh_id() const

Return unique mesh ID

Returns:std::size_t The unique mesh ID.
Point dolfin::MeshEntity::midpoint() const

Compute midpoint of cell

Returns:Point The midpoint of the cell.
std::size_t dolfin::MeshEntity::num_entities(std::size_t dim) const

Return local number of incident mesh entities of given topological dimension

Parameters:dim – (std::size_t) The topological dimension.
Returns:std::size_t The number of local incident MeshEntity objects of given dimension.
std::size_t dolfin::MeshEntity::num_global_entities(std::size_t dim) const

Return global number of incident mesh entities of given topological dimension

Parameters:dim – (std::size_t) The topological dimension.
Returns:std::size_t The number of global incident MeshEntity objects of given dimension.
bool dolfin::MeshEntity::operator!=(const MeshEntity &e) const

Comparison Operator

Parameters:e – (MeshEntity ) Another mesh entity.
Returns:bool True if the two mesh entities are NOT equal.
bool dolfin::MeshEntity::operator==(const MeshEntity &e) const

Comparison Operator

Parameters:e – (MeshEntity ) Another mesh entity
Returns:bool True if the two mesh entities are equal.
unsigned int dolfin::MeshEntity::owner() const

Get ownership of this entity - only really valid for cells

Returns:unsigned int Owning process
std::set<unsigned int> dolfin::MeshEntity::sharing_processes() const

Return set of sharing processes

Returns:std::set<unsigned int> List of sharing processes
std::string dolfin::MeshEntity::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose – (bool) Flag to turn on additional output.
Returns:std::string An informal representation of the function space.
dolfin::MeshEntity::~MeshEntity()

Destructor.

MeshEntityIterator

C++ documentation for MeshEntityIterator from dolfin/mesh/MeshEntityIterator.h:

class dolfin::MeshEntityIterator

MeshEntityIterator provides a common iterator for mesh entities over meshes, boundaries and incidence relations. The basic use is illustrated below.

The following example shows how to iterate over all mesh entities
of a mesh of topological dimension dim:
for (MeshEntityIterator e(mesh, dim); !e.end(); ++e)
{
e->foo();
}
The following example shows how to iterate over mesh entities of
topological dimension dim connected (incident) to some mesh entity f:
for (MeshEntityIterator e(f, dim); !e.end(); ++e)
{
e->foo();
}

In addition to the general iterator, a set of specific named iterators are provided for entities of type Vertex , Edge , Face , Facet and Cell . These iterators are defined along with their respective classes.

dolfin::MeshEntityIterator::MeshEntityIterator()

Default constructor.

dolfin::MeshEntityIterator::MeshEntityIterator(const Mesh &mesh, std::size_t dim)

Create iterator for mesh entities over given topological dimension.

Parameters:
  • mesh
  • dim
dolfin::MeshEntityIterator::MeshEntityIterator(const Mesh &mesh, std::size_t dim, std::string opt)

Iterator over MeshEntity of dimension dim on mesh, with string option to iterate over “regular”, “ghost” or “all” entities

Parameters:
  • mesh
  • dim
  • opt
dolfin::MeshEntityIterator::MeshEntityIterator(const MeshEntity &entity, std::size_t dim)

Create iterator for entities of given dimension connected to given entity

Parameters:
  • entity
  • dim
dolfin::MeshEntityIterator::MeshEntityIterator(const MeshEntityIterator &it)

Copy constructor.

Parameters:it
bool dolfin::MeshEntityIterator::end() const

Check if iterator has reached the end.

MeshEntityIterator dolfin::MeshEntityIterator::end_iterator()

Provide a safeguard iterator pointing beyond the end of an iteration process, either iterating over the mesh /or incident entities. Added to be bit more like STL iterators, since many algorithms rely on a kind of beyond iterator.

const unsigned int *dolfin::MeshEntityIterator::index
bool dolfin::MeshEntityIterator::operator!=(const MeshEntityIterator &it) const

Comparison operator.

Parameters:it
MeshEntity &dolfin::MeshEntityIterator::operator*()

Dereference operator.

MeshEntityIterator &dolfin::MeshEntityIterator::operator++()

Step to next mesh entity (prefix increment)

MeshEntityIterator &dolfin::MeshEntityIterator::operator--()

Step to the previous mesh entity (prefix decrease)

MeshEntity *dolfin::MeshEntityIterator::operator->()

Member access operator.

bool dolfin::MeshEntityIterator::operator==(const MeshEntityIterator &it) const

Comparison operator.

Parameters:it
std::size_t dolfin::MeshEntityIterator::pos() const

Return current position.

std::size_t dolfin::MeshEntityIterator::pos_end
void dolfin::MeshEntityIterator::set_end()
dolfin::MeshEntityIterator::~MeshEntityIterator()

Destructor.

MeshEntityIteratorBase

C++ documentation for MeshEntityIteratorBase from dolfin/mesh/MeshEntityIteratorBase.h:

class dolfin::MeshEntityIteratorBase

Base class for MeshEntityIterators.

dolfin::MeshEntityIteratorBase::MeshEntityIteratorBase(const Mesh &mesh)

Create iterator for mesh entities over given topological dimension.

Parameters:mesh
dolfin::MeshEntityIteratorBase::MeshEntityIteratorBase(const Mesh &mesh, std::string opt)

Iterator over MeshEntity of dimension dim on mesh, with string option to iterate over “regular”, “ghost” or “all” entities

Parameters:
  • mesh
  • opt
dolfin::MeshEntityIteratorBase::MeshEntityIteratorBase(const MeshEntity &entity)

Create iterator for entities of given dimension connected to given entity.

Parameters:entity
dolfin::MeshEntityIteratorBase::MeshEntityIteratorBase(const MeshEntityIteratorBase &it)

Copy constructor.

Parameters:it
bool dolfin::MeshEntityIteratorBase::end() const

Check if iterator has reached the end.

MeshEntityIteratorBase dolfin::MeshEntityIteratorBase::end_iterator()

Provide a safeguard iterator pointing beyond the end of an iteration process, either iterating over the mesh /or incident entities. Added to be bit more like STL iterators, since many algorithms rely on a kind of beyond iterator.

const unsigned int *dolfin::MeshEntityIteratorBase::index
bool dolfin::MeshEntityIteratorBase::operator!=(const MeshEntityIteratorBase &it) const

Comparison operator.

Parameters:it
T &dolfin::MeshEntityIteratorBase::operator*()

Dereference operator.

MeshEntityIteratorBase &dolfin::MeshEntityIteratorBase::operator++()

Step to next mesh entity (prefix increment)

MeshEntityIteratorBase &dolfin::MeshEntityIteratorBase::operator--()

Step to the previous mesh entity (prefix decrease)

T *dolfin::MeshEntityIteratorBase::operator->()

Member access operator.

bool dolfin::MeshEntityIteratorBase::operator==(const MeshEntityIteratorBase &it) const

Comparison operator.

Parameters:it
std::size_t dolfin::MeshEntityIteratorBase::pos() const

Return current position.

std::size_t dolfin::MeshEntityIteratorBase::pos_end
void dolfin::MeshEntityIteratorBase::set_end()

Set pos to end position. To create a kind of mesh.end() iterator.

dolfin::MeshEntityIteratorBase::~MeshEntityIteratorBase()

Destructor.

MeshGeometry

C++ documentation for MeshGeometry from dolfin/mesh/MeshGeometry.h:

class dolfin::MeshGeometry

MeshGeometry stores the geometry imposed on a mesh. Currently, the geometry is represented by the set of coordinates for the vertices of a mesh, but other representations are possible.

dolfin::MeshGeometry::MeshGeometry()

Create empty set of coordinates.

dolfin::MeshGeometry::MeshGeometry(const MeshGeometry &geometry)

Copy constructor.

Parameters:geometry
std::vector<double> dolfin::MeshGeometry::coordinates
std::size_t dolfin::MeshGeometry::degree() const

Return polynomial degree of coordinate field.

std::size_t dolfin::MeshGeometry::dim() const

Return Euclidean dimension of coordinate system.

std::vector<std::vector<std::size_t>> dolfin::MeshGeometry::entity_offsets
std::size_t dolfin::MeshGeometry::get_entity_index(std::size_t entity_dim, std::size_t order, std::size_t index) const

Get the index for an entity point in coordinates.

Parameters:
  • entity_dim
  • order
  • index
std::size_t dolfin::MeshGeometry::hash() const

Hash of coordinate values Returns std::size_t A tree-hashed value of the coordinates over all MPI processes

void dolfin::MeshGeometry::init(std::size_t dim, std::size_t degree)

Initialize coordinate list to given dimension and degree.

Parameters:
  • dim
  • degree
void dolfin::MeshGeometry::init_entities(const std::vector<std::size_t> &num_entities)

Initialise entities. To be called after init.

Parameters:num_entities
std::size_t dolfin::MeshGeometry::num_entity_coordinates(std::size_t entity_dim) const

Get the number of coordinate points per entity for this degree.

Parameters:entity_dim
std::size_t dolfin::MeshGeometry::num_points() const

Return the total number of points in the geometry, located on any entity

std::size_t dolfin::MeshGeometry::num_vertices() const

Return the number of vertex coordinates.

const MeshGeometry &dolfin::MeshGeometry::operator=(const MeshGeometry &geometry)

Assignment.

Parameters:geometry
Point dolfin::MeshGeometry::point(std::size_t n) const

Return coordinate with local index n as a 3D point value.

Parameters:n
const double *dolfin::MeshGeometry::point_coordinates(std::size_t point_index)

Get vertex coordinates.

Parameters:point_index
void dolfin::MeshGeometry::set(std::size_t local_index, const double *x)

Set value of coordinate.

Parameters:
  • local_index
  • x
std::string dolfin::MeshGeometry::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose
const double *dolfin::MeshGeometry::vertex_coordinates(std::size_t point_index)

Get vertex coordinates.

Parameters:point_index
std::vector<double> &dolfin::MeshGeometry::x()

Return array of values for all coordinates.

const std::vector<double> &dolfin::MeshGeometry::x() const

Return array of values for all coordinates.

const double *dolfin::MeshGeometry::x(std::size_t n) const

Return array of values for coordinate with local index n.

Parameters:n
double dolfin::MeshGeometry::x(std::size_t n, std::size_t i) const

Return value of coordinate with local index n in direction i.

Parameters:
  • n
  • i
dolfin::MeshGeometry::~MeshGeometry()

Destructor.

MeshHierarchy

C++ documentation for MeshHierarchy from dolfin/mesh/MeshHierarchy.h:

class dolfin::MeshHierarchy

Experimental implementation of a list of Meshes as a hierarchy.

dolfin::MeshHierarchy::MeshHierarchy()

Constructor.

dolfin::MeshHierarchy::MeshHierarchy(std::shared_ptr<const Mesh> mesh)

Constructor with initial mesh.

Parameters:mesh
std::shared_ptr<const MeshHierarchy> dolfin::MeshHierarchy::coarsen(const MeshFunction<bool> &markers) const

Coarsen finest mesh by one level, based on markers (level n->n)

Parameters:markers
std::shared_ptr<const Mesh> dolfin::MeshHierarchy::coarsest() const

Get the coarsest mesh of the MeshHierarchy .

std::shared_ptr<const Mesh> dolfin::MeshHierarchy::finest() const

Get the finest mesh of the MeshHierarchy .

std::shared_ptr<const Mesh> dolfin::MeshHierarchy::operator[](int i) const

Get Mesh i, in range [0:size() ] where 0 is the coarsest Mesh .

Parameters:i
std::shared_ptr<Mesh> dolfin::MeshHierarchy::rebalance() const

Rebalance across processes.

std::shared_ptr<const MeshHierarchy> dolfin::MeshHierarchy::refine(const MeshFunction<bool> &markers) const

Refine finest mesh of existing hierarchy, creating a new hierarchy (level n -> n+1)

Parameters:markers
unsigned int dolfin::MeshHierarchy::size() const

Number of meshes.

std::shared_ptr<const MeshHierarchy> dolfin::MeshHierarchy::unrefine() const

Unrefine by returning the previous MeshHierarchy (level n -> n-1) Returns NULL for a MeshHierarchy containing a single Mesh

std::vector<std::size_t> dolfin::MeshHierarchy::weight() const

Calculate the number of cells on the finest Mesh which are descendents of each cell on the coarsest Mesh , returning a vector over the cells of the coarsest Mesh .

dolfin::MeshHierarchy::~MeshHierarchy()

Destructor.

MeshOrdering

C++ documentation for MeshOrdering from dolfin/mesh/MeshOrdering.h:

class dolfin::MeshOrdering

This class implements the ordering of mesh entities according to the UFC specification (see appendix of DOLFIN user manual).

void dolfin::MeshOrdering::order(Mesh &mesh)

Order mesh.

Parameters:mesh
bool dolfin::MeshOrdering::ordered(const Mesh &mesh)

Check if mesh is ordered.

Parameters:mesh

MeshPartitioning

C++ documentation for MeshPartitioning from dolfin/mesh/MeshPartitioning.h:

class dolfin::MeshPartitioning

This class partitions and distributes a mesh based on partitioned local mesh data.The local mesh data will also be repartitioned and redistributed during the computation of the mesh partitioning. After partitioning, each process has a local mesh and some data that couples the meshes together.

void dolfin::MeshPartitioning::build(Mesh &mesh, const LocalMeshData &data, const std::vector<int> &cell_partition, const std::map<std::int64_t, std::vector<int>> &ghost_procs, const std::string ghost_mode)
Parameters:
  • mesh
  • data
  • cell_partition
  • ghost_procs
  • ghost_mode
void dolfin::MeshPartitioning::build_distributed_mesh(Mesh &mesh)

Build a distributed mesh from a local mesh on process 0.

Parameters:mesh
void dolfin::MeshPartitioning::build_distributed_mesh(Mesh &mesh, const LocalMeshData &data, const std::string ghost_mode)

Build a distributed mesh from ‘local mesh data’ that is distributed across processes

Parameters:
  • mesh
  • data
  • ghost_mode
void dolfin::MeshPartitioning::build_distributed_mesh(Mesh &mesh, const std::vector<int> &cell_partition, const std::string ghost_mode)

Build a distributed mesh from a local mesh on process 0, with distribution of cells supplied (destination processes for each cell)

Parameters:
  • mesh
  • cell_partition
  • ghost_mode
void dolfin::MeshPartitioning::build_distributed_value_collection(MeshValueCollection<T> &values, const LocalMeshValueCollection<T> &local_data, const Mesh &mesh)

Build a MeshValueCollection based on LocalMeshValueCollection .

Parameters:
  • values
  • local_data
  • mesh
void dolfin::MeshPartitioning::build_local_mesh(Mesh &mesh, const std::vector<std::int64_t> &global_cell_indices, const boost::multi_array<std::int64_t, 2> &cell_global_vertices, const CellType::Type cell_type, const int tdim, const std::int64_t num_global_cells, const std::vector<std::int64_t> &vertex_indices, const boost::multi_array<double, 2> &vertex_coordinates, const int gdim, const std::int64_t num_global_vertices, const std::map<std::int64_t, std::int32_t> &vertex_global_to_local_indices)
Parameters:
  • mesh
  • global_cell_indices
  • cell_global_vertices
  • cell_type
  • tdim
  • num_global_cells
  • vertex_indices
  • vertex_coordinates
  • gdim
  • num_global_vertices
  • vertex_global_to_local_indices
void dolfin::MeshPartitioning::build_mesh_domains(Mesh &mesh, const LocalMeshData &local_data)
Parameters:
  • mesh
  • local_data
void dolfin::MeshPartitioning::build_mesh_value_collection(const Mesh &mesh, const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T>> &local_value_data, MeshValueCollection &mesh_values)
Parameters:
  • mesh
  • local_value_data
  • mesh_values
void dolfin::MeshPartitioning::build_shared_vertices(MPI_Comm mpi_comm, std::map<std::int32_t, std::set<unsigned int>> &shared_vertices, const std::map<std::int64_t, std::int32_t> &vertex_global_to_local_indices, const std::vector<std::vector<std::size_t>> &received_vertex_indices)
Parameters:
  • mpi_comm
  • shared_vertices
  • vertex_global_to_local_indices
  • received_vertex_indices
std::int32_t dolfin::MeshPartitioning::compute_vertex_mapping(MPI_Comm mpi_comm, const std::int32_t num_regular_cells, const boost::multi_array<std::int64_t, 2> &cell_vertices, std::vector<std::int64_t> &vertex_indices, std::map<std::int64_t, std::int32_t> &vertex_global_to_local)
Parameters:
  • mpi_comm
  • num_regular_cells
  • cell_vertices
  • vertex_indices
  • vertex_global_to_local
void dolfin::MeshPartitioning::distribute_cell_layer(MPI_Comm mpi_comm, const int num_regular_cells, const std::int64_t num_global_vertices, std::map<std::int32_t, std::set<unsigned int>> &shared_cells, boost::multi_array<std::int64_t, 2> &cell_vertices, std::vector<std::int64_t> &global_cell_indices, std::vector<int> &cell_partition)
Parameters:
  • mpi_comm
  • num_regular_cells
  • num_global_vertices
  • shared_cells
  • cell_vertices
  • global_cell_indices
  • cell_partition
std::int32_t dolfin::MeshPartitioning::distribute_cells(const MPI_Comm mpi_comm, const LocalMeshData &data, const std::vector<int> &cell_partition, const std::map<std::int64_t, std::vector<int>> &ghost_procs, boost::multi_array<std::int64_t, 2> &new_cell_vertices, std::vector<std::int64_t> &new_global_cell_indices, std::vector<int> &new_cell_partition, std::map<std::int32_t, std::set<unsigned int>> &shared_cells)
Parameters:
  • mpi_comm
  • data
  • cell_partition
  • ghost_procs
  • new_cell_vertices
  • new_global_cell_indices
  • new_cell_partition
  • shared_cells
void dolfin::MeshPartitioning::distribute_vertices(const MPI_Comm mpi_comm, const LocalMeshData &mesh_data, const std::vector<std::int64_t> &vertex_indices, boost::multi_array<double, 2> &new_vertex_coordinates, std::map<std::int64_t, std::int32_t> &vertex_global_to_local_indices, std::map<std::int32_t, std::set<unsigned int>> &shared_vertices_local)
Parameters:
  • mpi_comm
  • mesh_data
  • vertex_indices
  • new_vertex_coordinates
  • vertex_global_to_local_indices
  • shared_vertices_local
void dolfin::MeshPartitioning::partition_cells(const MPI_Comm &mpi_comm, const LocalMeshData &mesh_data, const std::string partitioner, std::vector<int> &cell_partition, std::map<std::int64_t, std::vector<int>> &ghost_procs)
Parameters:
  • mpi_comm
  • mesh_data
  • partitioner
  • cell_partition
  • ghost_procs
void dolfin::MeshPartitioning::reorder_cells_gps(MPI_Comm mpi_comm, const unsigned int num_regular_cells, const CellType &cell_type, const std::map<std::int32_t, std::set<unsigned int>> &shared_cells, const boost::multi_array<std::int64_t, 2> &cell_vertices, const std::vector<std::int64_t> &global_cell_indices, std::map<std::int32_t, std::set<unsigned int>> &reordered_shared_cells, boost::multi_array<std::int64_t, 2> &reordered_cell_vertices, std::vector<std::int64_t> &reordered_global_cell_indices)
Parameters:
  • mpi_comm
  • num_regular_cells
  • cell_type
  • shared_cells
  • cell_vertices
  • global_cell_indices
  • reordered_shared_cells
  • reordered_cell_vertices
  • reordered_global_cell_indices
void dolfin::MeshPartitioning::reorder_vertices_gps(MPI_Comm mpi_comm, const std::int32_t num_regular_vertices, const std::int32_t num_regular_cells, const int num_cell_vertices, const boost::multi_array<std::int64_t, 2> &cell_vertices, const std::vector<std::int64_t> &vertex_indices, const std::map<std::int64_t, std::int32_t> &vertex_global_to_local, std::vector<std::int64_t> &reordered_vertex_indices, std::map<std::int64_t, std::int32_t> &reordered_vertex_global_to_local)
Parameters:
  • mpi_comm
  • num_regular_vertices
  • num_regular_cells
  • num_cell_vertices
  • cell_vertices
  • vertex_indices
  • vertex_global_to_local
  • reordered_vertex_indices
  • reordered_vertex_global_to_local

MeshQuality

C++ documentation for MeshQuality from dolfin/mesh/MeshQuality.h:

class dolfin::MeshQuality

The class provides functions to quantify mesh quality.

void dolfin::MeshQuality::dihedral_angles(const Cell &cell, std::vector<double> &dh_angle)

Get internal dihedral angles of a tetrahedral cell.

Parameters:
  • cell
  • dh_angle
std::pair<std::vector<double>, std::vector<double>> dolfin::MeshQuality::dihedral_angles_histogram_data(const Mesh &mesh, std::size_t num_bins = 100)

Create (dihedral angles, number of cells) data for creating a histogram of dihedral

Parameters:
  • mesh
  • num_bins
std::string dolfin::MeshQuality::dihedral_angles_matplotlib_histogram(const Mesh &mesh, std::size_t num_intervals = 100)

Create Matplotlib string to plot dihedral angles quality histogram.

Parameters:
  • mesh
  • num_intervals
std::pair<double, double> dolfin::MeshQuality::dihedral_angles_min_max(const Mesh &mesh)

Get internal minimum and maximum dihedral angles of a 3D mesh.

Parameters:mesh
std::pair<std::vector<double>, std::vector<double>> dolfin::MeshQuality::radius_ratio_histogram_data(const Mesh &mesh, std::size_t num_bins = 50)

Create (ratio, number of cells) data for creating a histogram of cell quality

Parameters:
  • mesh – (const Mesh &)
  • num_bins – (std::size_t)
Returns:

std::pair<std::vector<double>, std::vector<double>>

std::string dolfin::MeshQuality::radius_ratio_matplotlib_histogram(const Mesh &mesh, std::size_t num_intervals = 50)

Create Matplotlib string to plot cell quality histogram

Parameters:
  • mesh – (const Mesh &)
  • num_intervals – (std::size_t)
Returns:

std::string

std::pair<double, double> dolfin::MeshQuality::radius_ratio_min_max(const Mesh &mesh)

Compute the minimum and maximum radius ratio of cells (across all processes)

Parameters:mesh – (const Mesh &)
Returns:std::pair<double, double> The [minimum, maximum] cell radii ratio (geometric_dimension * * inradius / circumradius, geometric_dimension is normalization factor). It has range zero to one. Zero indicates a degenerate element.
MeshFunction<double> dolfin::MeshQuality::radius_ratios(std::shared_ptr<const Mesh> mesh)

Compute the radius ratio for all cells.

Parameters:mesh – (std::shared_ptr<const Mesh>)
Returns:MeshFunction<double> The cell radius ratio radius ratio geometric_dimension * * inradius / circumradius (geometric_dimension is normalization factor). It has range zero to one. Zero indicates a degenerate element.

MeshRelation

C++ documentation for MeshRelation from dolfin/mesh/MeshRelation.h:

class dolfin::MeshRelation

MeshRelation encapsulates the relationships which may exist between two Meshes or which may exist in a Mesh as a result of being related to another Mesh

Friends: MeshHierarchy, PlazaRefinementND.

dolfin::MeshRelation::MeshRelation()

Constructor.

std::shared_ptr<const std::map<std::size_t, std::size_t>> dolfin::MeshRelation::edge_to_global_vertex
dolfin::MeshRelation::~MeshRelation()

Destructor.

MeshRenumbering

C++ documentation for MeshRenumbering from dolfin/mesh/MeshRenumbering.h:

class dolfin::MeshRenumbering

This class implements renumbering algorithms for meshes.

void dolfin::MeshRenumbering::compute_renumbering(const Mesh &mesh, const std::vector<std::size_t> &coloring, std::vector<double> &coordinates, std::vector<std::size_t> &connectivity)
Parameters:
  • mesh
  • coloring
  • coordinates
  • connectivity
Mesh dolfin::MeshRenumbering::renumber_by_color(const Mesh &mesh, std::vector<std::size_t> coloring)

Renumber mesh entities by coloring. This function is currently restricted to renumbering by cell coloring. The cells (cell-vertex connectivity) and the coordinates of the mesh are renumbered to improve the locality within each color. It is assumed that the mesh has already been colored and that only cell-vertex connectivity exists as part of the mesh.

Parameters:
  • mesh – (Mesh ) Mesh to be renumbered.
  • coloring – (std::vector<std::size_t>) Mesh coloring type.
Returns:

Mesh

MeshSmoothing

C++ documentation for MeshSmoothing from dolfin/mesh/MeshSmoothing.h:

class dolfin::MeshSmoothing

This class implements various mesh smoothing algorithms.

void dolfin::MeshSmoothing::move_interior_vertices(Mesh &mesh, BoundaryMesh &boundary, bool harmonic_smoothing)
Parameters:
  • mesh
  • boundary
  • harmonic_smoothing
void dolfin::MeshSmoothing::smooth(Mesh &mesh, std::size_t num_iterations = 1)

Smooth internal vertices of mesh by local averaging.

Parameters:
  • mesh
  • num_iterations
void dolfin::MeshSmoothing::smooth_boundary(Mesh &mesh, std::size_t num_iterations = 1, bool harmonic_smoothing = true)

Smooth boundary vertices of mesh by local averaging and (optionally) use harmonic smoothing on interior vertices

Parameters:
  • mesh
  • num_iterations
  • harmonic_smoothing
void dolfin::MeshSmoothing::snap_boundary(Mesh &mesh, const SubDomain &sub_domain, bool harmonic_smoothing = true)

Snap boundary vertices of mesh to match given sub domain and (optionally) use harmonic smoothing on interior vertices

Parameters:
  • mesh
  • sub_domain
  • harmonic_smoothing

MeshTopology

C++ documentation for MeshTopology from dolfin/mesh/MeshTopology.h:

class dolfin::MeshTopology

MeshTopology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relations for the mesh entities). Note that the mesh entities don’t need to be stored, only the number of entities and the connectivity. Any numbering scheme for the mesh entities is stored separately in a MeshFunction over the entities. A mesh entity e may be identified globally as a pair e = (dim, i), where dim is the topological dimension and i is the index of the entity within that topological dimension.

dolfin::MeshTopology::MeshTopology()

Create empty mesh topology.

dolfin::MeshTopology::MeshTopology(const MeshTopology &topology)

Copy constructor.

Parameters:topology
std::vector<unsigned int> &dolfin::MeshTopology::cell_owner()

Return mapping from local ghost cell index to owning process Since ghost cells are at the end of the range, this is just a vector over those cells

const std::vector<unsigned int> &dolfin::MeshTopology::cell_owner() const

Return mapping from local ghost cell index to owning process (const version) Since ghost cells are at the end of the range, this is just a vector over those cells

void dolfin::MeshTopology::clear()

Clear all data.

void dolfin::MeshTopology::clear(std::size_t d0, std::size_t d1)

Clear data for given pair of topological dimensions.

Parameters:
  • d0
  • d1
std::map<std::vector<std::size_t>, std::pair<std::vector<std::size_t>, std::vector<std::vector<std::size_t>>>> dolfin::MeshTopology::coloring

Mesh entity colors, if computed. First vector is (colored entity dim - dim1 - dim2 - ... - colored entity dim) The first vector in the pair stores mesh entity colors and the vector<vector> is a list of all mesh entity indices of the same color, e.g. vector<vector>[col][i] is the index of the ith entity of color ‘col’.

std::vector<std::vector<MeshConnectivity>> dolfin::MeshTopology::connectivity
std::size_t dolfin::MeshTopology::dim() const

Return topological dimension.

std::size_t dolfin::MeshTopology::ghost_offset(std::size_t dim) const

Return number of regular (non-ghost) entities or equivalently, the offset of where ghost entities begin

Parameters:dim
std::vector<std::size_t> dolfin::MeshTopology::ghost_offset_index
const std::vector<std::int64_t> &dolfin::MeshTopology::global_indices(std::size_t d) const

Get local-to-global index map for entities of topological dimension d

Parameters:d
std::vector<std::size_t> dolfin::MeshTopology::global_num_entities
size_t dolfin::MeshTopology::hash() const

Return hash based on the hash of cell-vertex connectivity.

bool dolfin::MeshTopology::have_global_indices(std::size_t dim) const

Check if global indices are available for entities of dimension dim

Parameters:dim
bool dolfin::MeshTopology::have_shared_entities(unsigned int dim) const

Check whether there are any shared entities calculated of dimension dim

Parameters:dim
void dolfin::MeshTopology::init(std::size_t dim)

Initialize topology of given maximum dimension.

Parameters:dim
void dolfin::MeshTopology::init(std::size_t dim, std::size_t local_size, std::size_t global_size)

Set number of local entities (local_size) and global entities (global_size) for given topological dimension dim

Parameters:
  • dim
  • local_size
  • global_size
void dolfin::MeshTopology::init_ghost(std::size_t dim, std::size_t index)

Initialise the offset index of ghost entities for this dimension.

Parameters:
  • dim
  • index
void dolfin::MeshTopology::init_global_indices(std::size_t dim, std::size_t size)

Initialize storage for global entity numbering for entities of dimension dim

Parameters:
  • dim
  • size
std::vector<unsigned int> dolfin::MeshTopology::num_entities
dolfin::MeshConnectivity &dolfin::MeshTopology::operator()(std::size_t d0, std::size_t d1)

Return connectivity for given pair of topological dimensions.

Parameters:
  • d0
  • d1
const dolfin::MeshConnectivity &dolfin::MeshTopology::operator()(std::size_t d0, std::size_t d1) const

Return connectivity for given pair of topological dimensions.

Parameters:
  • d0
  • d1
MeshTopology &dolfin::MeshTopology::operator=(const MeshTopology &topology)

Assignment.

Parameters:topology
void dolfin::MeshTopology::set_global_index(std::size_t dim, std::size_t local_index, std::int64_t global_index)

Set global index for entity of dimension dim and with local index

Parameters:
  • dim
  • local_index
  • global_index
std::map<std::int32_t, std::set<unsigned int>> &dolfin::MeshTopology::shared_entities(unsigned int dim)

Return map from shared entities (local index) to processes that share the entity

Parameters:dim
const std::map<std::int32_t, std::set<unsigned int>> &dolfin::MeshTopology::shared_entities(unsigned int dim) const

Return map from shared entities (local index) to process that share the entity (const version)

Parameters:dim
std::size_t dolfin::MeshTopology::size(std::size_t dim) const

Return number of entities for given dimension.

Parameters:dim
std::size_t dolfin::MeshTopology::size_global(std::size_t dim) const

Return global number of entities for given dimension.

Parameters:dim
std::string dolfin::MeshTopology::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose
dolfin::MeshTopology::~MeshTopology()

Destructor.

MeshTransformation

C++ documentation for MeshTransformation from dolfin/mesh/MeshTransformation.h:

class dolfin::MeshTransformation

This class implements various transformations of the coordinates of a mesh.

void dolfin::MeshTransformation::rescale(Mesh &mesh, const double scale, const Point &center)

Rescale mesh by a given scaling factor with respect to a center point.

Parameters:
  • mesh – (Mesh ) The mesh
  • scale – (double) The scaling factor.
  • center – (Point ) The center of the scaling.
void dolfin::MeshTransformation::rotate(Mesh &mesh, double angle, std::size_t axis)

Rotate mesh around a coordinate axis through center of mass of all mesh vertices

Parameters:
  • mesh – (Mesh ) The mesh.
  • angle – (double) The number of degrees (0-360) of rotation.
  • axis – (std::size_t) The coordinate axis around which to rotate the mesh.
void dolfin::MeshTransformation::rotate(Mesh &mesh, double angle, std::size_t axis, const Point &p)

Rotate mesh around a coordinate axis through a given point

Parameters:
  • mesh – (Mesh ) The mesh.
  • angle – (double) The number of degrees (0-360) of rotation.
  • axis – (std::size_t) The coordinate axis around which to rotate the mesh.
  • p – (Point ) The point around which to rotate the mesh.
void dolfin::MeshTransformation::scale(Mesh &mesh, double factor)

Scale mesh coordinates with given factor. Arguments mesh (Mesh ) The mesh factor (double) The factor defining the scaling.

Parameters:
  • mesh
  • factor
void dolfin::MeshTransformation::translate(Mesh &mesh, const Point &point)

Translate mesh according to a given vector.

Parameters:
  • mesh – (Mesh ) The mesh
  • point – (Point ) The vector defining the translation.

MultiMesh

C++ documentation for MultiMesh from dolfin/mesh/MultiMesh.h:

class dolfin::MultiMesh

This class represents a collection of meshes with arbitrary overlaps. A multimesh may be created from a set of standard meshes spaces by repeatedly calling add , followed by a call to build . Note that a multimesh is not useful until build has been called.

type dolfin::MultiMesh::IncExcKey

Key to identify polyhedra.

dolfin::MultiMesh::MultiMesh()

Create empty multimesh.

dolfin::MultiMesh::MultiMesh(std::shared_ptr<const Mesh> mesh_0, std::shared_ptr<const Mesh> mesh_1, std::shared_ptr<const Mesh> mesh_2, std::size_t quadrature_order)

Create multimesh from three meshes.

Parameters:
  • mesh_0
  • mesh_1
  • mesh_2
  • quadrature_order
dolfin::MultiMesh::MultiMesh(std::shared_ptr<const Mesh> mesh_0, std::shared_ptr<const Mesh> mesh_1, std::size_t quadrature_order)

Create multimesh from two meshes.

Parameters:
  • mesh_0
  • mesh_1
  • quadrature_order
dolfin::MultiMesh::MultiMesh(std::shared_ptr<const Mesh> mesh_0, std::size_t quadrature_order)

Create multimesh from one mesh.

Parameters:
  • mesh_0
  • quadrature_order
dolfin::MultiMesh::MultiMesh(std::vector<std::shared_ptr<const Mesh>> meshes, std::size_t quadrature_order)

Create multimesh from given list of meshes.

Parameters:
  • meshes
  • quadrature_order
type dolfin::MultiMesh::Polyhedron

A polyhedron is a list of simplices.

type dolfin::MultiMesh::Simplex

A simplex is a list of points.

void dolfin::MultiMesh::add(std::shared_ptr<const Mesh> mesh)

Add mesh Arguments mesh (Mesh ) The mesh

Parameters:mesh
std::shared_ptr<const BoundingBoxTree> dolfin::MultiMesh::bounding_box_tree(std::size_t part) const

Return the bounding box tree for the mesh of the given part Arguments part (std::size_t) The part number Returns std::shared_ptr<const BoundingBoxTree> The bounding box tree

Parameters:part
std::shared_ptr<const BoundingBoxTree> dolfin::MultiMesh::bounding_box_tree_boundary(std::size_t part) const

Return the bounding box tree for the boundary mesh of the given part Arguments part (std::size_t) The part number Returns std::shared_ptr<const BoundingBoxTree> The bounding box tree

Parameters:part
void dolfin::MultiMesh::build(std::size_t quadrature_order = 2)

Build multimesh.

Parameters:quadrature_order
void dolfin::MultiMesh::clear()

Clear multimesh.

const std::map<unsigned int, std::vector<std::pair<std::size_t, unsigned int>>> &dolfin::MultiMesh::collision_map_cut_cells(std::size_t part) const

Return the collision map for cut cells of the given part Arguments part (std::size_t) The part number Returns std::map<unsigned int, std::vector<std::pair<std::size_t, unsigned int> > > A map from cell indices of cut cells to a list of cutting cells. Each cutting cell is represented as a pair (part_number, cutting_cell_index).

Parameters:part
double dolfin::MultiMesh::compute_area() const

Compute total interface area or the total volume of multimesh by summing up quadrature weights. If the area or volume of the domain mesh is known, this is a good test to verify that the mesh-mesh intersections and quadrature are correct.

double dolfin::MultiMesh::compute_volume() const

Corresponding function for volume.

const std::vector<unsigned int> &dolfin::MultiMesh::covered_cells(std::size_t part) const

Return the list of covered cells for given part. The covered cells are defined as all cells that collide with the domain of any part with higher part number, but not with the boundary of that part; in other words cells that are completely covered by any other part (and which therefore are inactive). Arguments part (std::size_t) The part number Returns std::vector<unsigned int> List of covered cell indices for given part

Parameters:part
const std::vector<unsigned int> dolfin::MultiMesh::cut_cells(std::size_t part) const

Return the list of cut cells for given part. The cut cells are defined as all cells that collide with the boundary of any part with higher part number. FIXME: Figure out whether this makes sense; a cell may collide with the boundary of part j but may still be covered completely by the domain of part j + 1. Possible solution is to for each part i check overlapping parts starting from the top and working back down to i + 1. Arguments part (std::size_t) The part number Returns std::vector<unsigned int> List of cut cell indices for given part

Parameters:part
const std::map<unsigned int, std::vector<std::vector<double>>> &dolfin::MultiMesh::facet_normals(std::size_t part) const

Return facet normals for the interface on the given part Arguments part (std::size_t) The part number Returns std::map<unsigned int, std::vector<std::vector<double> > > A map from cell indices of cut cells to facet normals on an interface part cutting through the cell. A separate list of facet normals, one for each quadrature point, is given for each cutting cell and stored in the same order as in the collision map. The facet normals for each set of quadrature points is stored as a contiguous flattened array, the length of which should be equal to the number of quadrature points multiplied by the geometric dimension. Puh!

Parameters:part
bool dolfin::MultiMesh::is_built() const

Check whether multimesh has been built.

std::size_t dolfin::MultiMesh::num_parts() const

Return the number of meshes (parts) of the multimesh Returns std::size_t The number of meshes (parts) of the multimesh.

std::shared_ptr<const Mesh> dolfin::MultiMesh::part(std::size_t i) const

Return mesh (part) number i Arguments i (std::size_t) The part number Returns:cpp:any:Mesh Mesh (part) number i

Parameters:i
std::string dolfin::MultiMesh::plot_matplotlib(double delta_z = 1, const std::string &filename = "") const

Create matplotlib string to plot 2D multimesh (small meshes only)

Parameters:
  • delta_z
  • filename
type dolfin::MultiMesh::quadrature_rule

Structure storing a quadrature rule.

const std::map<unsigned int, quadrature_rule> &dolfin::MultiMesh::quadrature_rules_cut_cells(std::size_t part) const

Return quadrature rules for cut cells on the given part Arguments part (std::size_t) The part number Returns std::map<unsigned int, std::pair<std::vector<double>, std::vector<double> > > A map from cell indices of cut cells to quadrature rules. Each quadrature rule is represented as a pair of a flattened array of quadrature points and a corresponding array of quadrature weights.

Parameters:part
const quadrature_rule dolfin::MultiMesh::quadrature_rules_cut_cells(std::size_t part, unsigned int cell_index) const

Return quadrature rule for a given cut cell on the given part Arguments part (std::size_t) The part number cell (unsigned int) The cell index Returns std::pair<std::vector<double>, std::vector<double> > A quadrature rule represented as a pair of a flattened array of quadrature points and a corresponding array of quadrature weights. An error is raised if the given cell is not in the map.

Parameters:
  • part
  • cell_index
const std::map<unsigned int, std::vector<quadrature_rule>> &dolfin::MultiMesh::quadrature_rules_interface(std::size_t part) const

Return quadrature rules for the interface on the given part Arguments part (std::size_t) The part number Returns std::map<unsigned int, std::vector<std::pair<std::vector<double>, std::vector<double> > > > A map from cell indices of cut cells to quadrature rules on an interface part cutting through the cell. A separate quadrature rule is given for each cutting cell and stored in the same order as in the collision map. Each quadrature rule is represented as a pair of an array of quadrature points and a corresponding flattened array of quadrature weights.

Parameters:part
const std::vector<quadrature_rule> dolfin::MultiMesh::quadrature_rules_interface(std::size_t part, unsigned int cell_index) const

Return quadrature rules for the interface of a given cut cell on the given part Arguments part (std::size_t) The part number cell (unsigned int) The cell index Returns std::vector<std::pair<std::vector<double>, std::vector<double> > > A vector of quadrature rules on the cut cell. A separate quadrature rule is given for each cutting cell and stored in the same order as in the collision map. Each quadrature rule represented as a pair of a flattened array of quadrature points and a corresponding array of quadrature weights. An error is raised if the given cell is not in the map. Developer note: this function is mainly useful from Python and could be replaced by a suitable typemap that would make the previous more general function accessible from Python.

Parameters:
  • part
  • cell_index
const std::map<unsigned int, std::vector<quadrature_rule>> &dolfin::MultiMesh::quadrature_rules_overlap(std::size_t part) const

Return quadrature rules for the overlap on the given part. Arguments part (std::size_t) The part number Returns std::map<unsigned int, std::vector<std::pair<std::vector<double>, std::vector<double> > > > A map from cell indices of cut cells to quadrature rules. A separate quadrature rule is given for each cutting cell and stored in the same order as in the collision map. Each quadrature rule is represented as a pair of an array of quadrature points and a corresponding flattened array of quadrature weights.

Parameters:part
const std::vector<quadrature_rule> dolfin::MultiMesh::quadrature_rules_overlap(std::size_t part, unsigned int cell) const

Return quadrature rules for the overlap for a given cell on the given part. Arguments part (std::size_t) The part number Returns std::vector<std::pair<std::vector<double>, std::vector<double> > > A vector of quadrature rules on the cut cell. A separate quadrature rule is given for each cutting cell and stored in the same order as in the collision map. A quadrature rule represented as a pair of a flattened array of quadrature points and a corresponding array of quadrature weights. An error is raised if the given cell is not in the map.

Parameters:
  • part
  • cell
void dolfin::MultiMesh::remove_quadrature_rule(quadrature_rule &qr, double tolerance)
Parameters:
  • qr
  • tolerance
const std::vector<unsigned int> &dolfin::MultiMesh::uncut_cells(std::size_t part) const

Return the list of uncut cells for given part. The uncut cells are defined as all cells that don’t collide with any cells in any other part with higher part number. Arguments part (std::size_t) The part number Returns std::vector<unsigned int> List of uncut cell indices for given part

Parameters:part
dolfin::MultiMesh::~MultiMesh()

Destructor.

PeriodicBoundaryComputation

C++ documentation for PeriodicBoundaryComputation from dolfin/mesh/PeriodicBoundaryComputation.h:

class dolfin::PeriodicBoundaryComputation

This class computes map from slave entity to master entity.

std::map<unsigned int, std::pair<unsigned int, unsigned int>> dolfin::PeriodicBoundaryComputation::compute_periodic_pairs(const Mesh &mesh, const SubDomain &sub_domain, const std::size_t dim)

For entities of dimension dim, compute map from a slave entity on this process (local index) to its master entity (owning process, local index on owner). If a master entity is shared by processes, only one of the owning processes is returned.

Parameters:
  • mesh
  • sub_domain
  • dim
bool dolfin::PeriodicBoundaryComputation::in_bounding_box(const std::vector<double> &point, const std::vector<double> &bounding_box, const double tol)
Parameters:
  • point
  • bounding_box
  • tol
MeshFunction<std::size_t> dolfin::PeriodicBoundaryComputation::masters_slaves(std::shared_ptr<const Mesh> mesh, const SubDomain &sub_domain, const std::size_t dim)

This function returns a MeshFunction which marks mesh entities of dimension dim according to:

2: slave entities
1: master entities
0: all other entities

It is useful for visualising and debugging the Expression::map function that is used to apply periodic boundary conditions.

Parameters:
  • mesh
  • sub_domain
  • dim

PointCell

C++ documentation for PointCell from dolfin/mesh/PointCell.h:

class dolfin::PointCell

This class implements functionality for point cell meshes.

dolfin::PointCell::PointCell()

Specify cell type and facet type.

Point dolfin::PointCell::cell_normal(const Cell &cell) const

Compute normal to given cell (viewed as embedded in 1D)

Parameters:cell
double dolfin::PointCell::circumradius(const MeshEntity &point) const

Compute circumradius of PointCell .

Parameters:point
bool dolfin::PointCell::collides(const Cell &cell, const MeshEntity &entity) const

Check whether given entity collides with cell.

Parameters:
  • cell
  • entity
bool dolfin::PointCell::collides(const Cell &cell, const Point &point) const

Check whether given point is contained in cell.

Parameters:
  • cell
  • point
void dolfin::PointCell::create_entities(boost::multi_array<unsigned int, 2> &e, std::size_t dim, const unsigned int *v) const

Create entities e of given topological dimension from vertices v.

Parameters:
  • e
  • dim
  • v
std::string dolfin::PointCell::description(bool plural) const

Return description of cell type.

Parameters:plural
std::size_t dolfin::PointCell::dim() const

Return topological dimension of cell.

double dolfin::PointCell::facet_area(const Cell &cell, std::size_t facet) const

Compute the area/length of given facet with respect to the cell

Parameters:
  • cell
  • facet
std::size_t dolfin::PointCell::find_edge(std::size_t i, const Cell &cell) const
Parameters:
  • i
  • cell
bool dolfin::PointCell::is_simplex() const

Check if cell is a simplex.

Point dolfin::PointCell::normal(const Cell &cell, std::size_t facet) const

Compute of given facet with respect to the cell.

Parameters:
  • cell
  • facet
double dolfin::PointCell::normal(const Cell &cell, std::size_t facet, std::size_t i) const

Compute component i of normal of given facet with respect to the cell

Parameters:
  • cell
  • facet
  • i
std::size_t dolfin::PointCell::num_entities(std::size_t dim) const

Return number of entities of given topological dimension.

Parameters:dim
std::size_t dolfin::PointCell::num_vertices(std::size_t dim) const

Return number of vertices for entity of given topological dimension

Parameters:dim
void dolfin::PointCell::order(Cell &cell) const

Order entities locally.

Parameters:cell
void dolfin::PointCell::order(Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Order entities locally (connectivity 1-0, 2-0, 2-1)

Parameters:
  • cell
  • local_to_global_vertex_indices
std::size_t dolfin::PointCell::orientation(const Cell &cell) const

Return orientation of the cell.

Parameters:cell
double dolfin::PointCell::squared_distance(const Cell &cell, const Point &point) const

Compute squared distance to given point.

Parameters:
  • cell
  • point
double dolfin::PointCell::volume(const MeshEntity &triangle) const

Compute (generalized) volume (area) of triangle.

Parameters:triangle
std::vector<std::int8_t> dolfin::PointCell::vtk_mapping() const

Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.

QuadrilateralCell

C++ documentation for QuadrilateralCell from dolfin/mesh/QuadrilateralCell.h:

class dolfin::QuadrilateralCell

This class implements functionality for quadrilaterial cells.

dolfin::QuadrilateralCell::QuadrilateralCell()

Specify cell type and facet type.

Point dolfin::QuadrilateralCell::cell_normal(const Cell &cell) const

Compute normal to given cell (viewed as embedded in 3D)

Parameters:cell
double dolfin::QuadrilateralCell::circumradius(const MeshEntity &triangle) const

Compute circumradius of triangle.

Parameters:triangle
bool dolfin::QuadrilateralCell::collides(const Cell &cell, const MeshEntity &entity) const

Check whether given entity collides with cell.

Parameters:
  • cell
  • entity
bool dolfin::QuadrilateralCell::collides(const Cell &cell, const Point &point) const

Check whether given point collides with cell.

Parameters:
  • cell
  • point
void dolfin::QuadrilateralCell::create_entities(boost::multi_array<unsigned int, 2> &e, std::size_t dim, const unsigned int *v) const

Create entities e of given topological dimension from vertices v.

Parameters:
  • e
  • dim
  • v
std::string dolfin::QuadrilateralCell::description(bool plural) const

Return description of cell type.

Parameters:plural
std::size_t dolfin::QuadrilateralCell::dim() const

Return topological dimension of cell.

double dolfin::QuadrilateralCell::facet_area(const Cell &cell, std::size_t facet) const

Compute the area/length of given facet with respect to the cell.

Parameters:
  • cell
  • facet
bool dolfin::QuadrilateralCell::is_simplex() const

Check if cell is a simplex.

Point dolfin::QuadrilateralCell::normal(const Cell &cell, std::size_t facet) const

Compute of given facet with respect to the cell.

Parameters:
  • cell
  • facet
double dolfin::QuadrilateralCell::normal(const Cell &cell, std::size_t facet, std::size_t i) const

Compute component i of normal of given facet with respect to the cell.

Parameters:
  • cell
  • facet
  • i
std::size_t dolfin::QuadrilateralCell::num_entities(std::size_t dim) const

Return number of entities of given topological dimension.

Parameters:dim
std::size_t dolfin::QuadrilateralCell::num_vertices(std::size_t dim) const

Return number of vertices for entity of given topological dimension.

Parameters:dim
void dolfin::QuadrilateralCell::order(Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Order entities locally.

Parameters:
  • cell
  • local_to_global_vertex_indices
std::size_t dolfin::QuadrilateralCell::orientation(const Cell &cell) const

Return orientation of the cell.

Parameters:cell
double dolfin::QuadrilateralCell::squared_distance(const Cell &cell, const Point &point) const

Compute squared distance to given point (3D enabled)

Parameters:
  • cell
  • point
double dolfin::QuadrilateralCell::volume(const MeshEntity &triangle) const

Compute (generalized) volume (area) of triangle.

Parameters:triangle
std::vector<std::int8_t> dolfin::QuadrilateralCell::vtk_mapping() const

Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.

SubDomain

C++ documentation for SubDomain from dolfin/mesh/SubDomain.h:

class dolfin::SubDomain

This class defines the interface for definition of subdomains. Alternatively, subdomains may be defined by a Mesh and a MeshFunction<std::size_t> over the mesh.

Friends: DirichletBC, PeriodicBC.

dolfin::SubDomain::SubDomain(const double map_tol = 1.0e-10)

Constructor

Parameters:map_tol – (double) The tolerance used when identifying mapped points using the function SubDomain::map .
void dolfin::SubDomain::apply_markers(S &sub_domains, T sub_domain, const Mesh &mesh, bool check_midpoint) const

Apply marker of type T (most likely an std::size_t) to object of class S (most likely MeshFunction or MeshValueCollection )

Parameters:
  • sub_domains
  • sub_domain
  • mesh
  • check_midpoint
void dolfin::SubDomain::apply_markers(std::map<std::size_t, std::size_t> &sub_domains, std::size_t dim, T sub_domain, const Mesh &mesh, bool check_midpoint) const
Parameters:
  • sub_domains
  • dim
  • sub_domain
  • mesh
  • check_midpoint
std::size_t dolfin::SubDomain::geometric_dimension() const

Return geometric dimension

Returns:std::size_t The geometric dimension.
double dolfin::SubDomain::get_property(std::string name) const

Property getter

Parameters:name
Returns:double
bool dolfin::SubDomain::inside(Eigen::Ref<const Eigen::VectorXd> x, bool on_boundary) const

Return true for points inside the subdomain

Parameters:
  • x – (Eigen::Ref<const Eigen::VectorXd>) The coordinates of the point.
  • on_boundary – (bool) True for points on the boundary.
Returns:

bool True for points inside the subdomain.

bool dolfin::SubDomain::inside(const Array<double> &x, bool on_boundary) const

Return true for points inside the subdomain

Parameters:
  • x – (Array<double>) The coordinates of the point.
  • on_boundary – (bool) True for points on the boundary.
Returns:

bool True for points inside the subdomain.

void dolfin::SubDomain::map(Eigen::Ref<const Eigen::VectorXd> x, Eigen::Ref<Eigen::VectorXd> y) const

Map coordinate x in domain H to coordinate y in domain G (used for periodic boundary conditions)

Parameters:
  • x – (Eigen::Ref<const Eigen::VectorXd>) The coordinates in domain H.
  • y – (Eigen::Ref<Eigen::VectorXd>) The coordinates in domain G.
void dolfin::SubDomain::map(const Array<double> &x, Array<double> &y) const

Map coordinate x in domain H to coordinate y in domain G (used for periodic boundary conditions)

Parameters:
  • x – (Array<double>) The coordinates in domain H.
  • y – (Array<double>) The coordinates in domain G.
const double dolfin::SubDomain::map_tolerance

Return tolerance uses to find matching point via map function

Returns:double The tolerance.
void dolfin::SubDomain::mark(Mesh &mesh, std::size_t dim, std::size_t sub_domain, bool check_midpoint = true) const

Set subdomain markers (std::size_t) for given topological dimension and subdomain number

Parameters:
  • mesh – (Mesh ) The mesh to be marked.
  • dim – (std::size_t) The topological dimension of entities to be marked.
  • sub_domain – (std::size_t) The subdomain number.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshFunction<bool> &sub_domains, bool sub_domain, bool check_midpoint = true) const

Set subdomain markers (bool) for given subdomain

Parameters:
  • sub_domains – (MeshFunction<bool>) The subdomain markers.
  • sub_domain – (bool) The subdomain number.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshFunction<double> &sub_domains, double sub_domain, bool check_midpoint = true) const

Set subdomain markers (double) for given subdomain number

Parameters:
  • sub_domains – (MeshFunction<double>) The subdomain markers.
  • sub_domain – (double) The subdomain number.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshFunction<int> &sub_domains, int sub_domain, bool check_midpoint = true) const

Set subdomain markers (int) for given subdomain number

Parameters:
  • sub_domains – (MeshFunction<int>) The subdomain markers.
  • sub_domain – (int) The subdomain number.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshFunction<std::size_t> &sub_domains, std::size_t sub_domain, bool check_midpoint = true) const

Set subdomain markers (std::size_t) for given subdomain number

Parameters:
  • sub_domains – (MeshFunction<std::size_t>) The subdomain markers.
  • sub_domain – (std::size_t) The subdomain number.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshValueCollection<bool> &sub_domains, bool sub_domain, const Mesh &mesh, bool check_midpoint = true) const

Set subdomain markers (bool) for given subdomain

Parameters:
  • sub_domains – (MeshValueCollection<bool>) The subdomain markers
  • sub_domain – (bool) The subdomain number
  • mesh – (Mesh ) The mesh.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshValueCollection<double> &sub_domains, double sub_domain, const Mesh &mesh, bool check_midpoint = true) const

Set subdomain markers (double) for given subdomain number

Parameters:
  • sub_domains – (MeshValueCollection<double>) The subdomain markers.
  • sub_domain – (double) The subdomain number
  • mesh – (Mesh ) The mesh.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshValueCollection<int> &sub_domains, int sub_domain, const Mesh &mesh, bool check_midpoint = true) const

Set subdomain markers (int) for given subdomain number

Parameters:
  • sub_domains – (MeshValueCollection<int>) The subdomain markers
  • sub_domain – (int) The subdomain number
  • mesh – (Mesh ) The mesh.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark(MeshValueCollection<std::size_t> &sub_domains, std::size_t sub_domain, const Mesh &mesh, bool check_midpoint = true) const

Set subdomain markers (std::size_t) for given subdomain number

Parameters:
  • sub_domains – (MeshValueCollection<std::size_t>) The subdomain markers.
  • sub_domain – (std::size_t) The subdomain number.
  • mesh – (Mesh ) The mesh.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark_cells(Mesh &mesh, std::size_t sub_domain, bool check_midpoint = true) const

Set subdomain markers (std::size_t) on cells for given subdomain number

Parameters:
  • mesh – (Mesh ) The mesh to be marked.
  • sub_domain – (std::size_t) The subdomain number.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::mark_facets(Mesh &mesh, std::size_t sub_domain, bool check_midpoint = true) const

Set subdomain markers (std::size_t) on facets for given subdomain number

Parameters:
  • mesh – (Mesh ) The mesh to be marked.
  • sub_domain – (std::size_t) The subdomain number.
  • check_midpoint – (bool) Flag for whether midpoint of cell should be checked (default).
void dolfin::SubDomain::set_property(std::string name, double value)

Property setter

Parameters:
  • name
  • value
void dolfin::SubDomain::snap(Array<double> &x) const

Snap coordinate to boundary of subdomain

Parameters:x – (Array<double>) The coordinates.
dolfin::SubDomain::~SubDomain()

Destructor.

SubMesh

C++ documentation for SubMesh from dolfin/mesh/SubMesh.h:

class dolfin::SubMesh : public dolfin::Mesh

A SubMesh is a mesh defined as a subset of a given mesh. It provides a convenient way to create matching meshes for multiphysics applications by creating meshes for subdomains as subsets of a single global mesh. A mapping from the vertices of the sub mesh to the vertices of the parent mesh is stored as the mesh data named “parent_vertex_indices”.

dolfin::SubMesh::SubMesh(const Mesh &mesh, const MeshFunction<std::size_t> &sub_domains, std::size_t sub_domain)

Create subset of given mesh marked by mesh function.

Parameters:
  • mesh
  • sub_domains
  • sub_domain
dolfin::SubMesh::SubMesh(const Mesh &mesh, const SubDomain &sub_domain)

Create subset of given mesh marked by sub domain.

Parameters:
  • mesh
  • sub_domain
dolfin::SubMesh::SubMesh(const Mesh &mesh, std::size_t sub_domain)

Create subset of given mesh from stored MeshValueCollection .

Parameters:
  • mesh
  • sub_domain
void dolfin::SubMesh::init(const Mesh &mesh, const std::vector<std::size_t> &sub_domains, std::size_t sub_domain)

Create sub mesh.

Parameters:
  • mesh
  • sub_domains
  • sub_domain
dolfin::SubMesh::~SubMesh()

Destructor.

SubsetIterator

C++ documentation for SubsetIterator from dolfin/mesh/SubsetIterator.h:

class dolfin::SubsetIterator

A SubsetIterator is similar to a MeshEntityIterator but iterates over a specified subset of the range of entities as specified by a MeshFunction that labels the entities.

dolfin::SubsetIterator::SubsetIterator(const MeshFunction<std::size_t> &labels, std::size_t label)

Create iterator for given mesh function. The iterator visits all entities that match the given label.

Parameters:
  • labels
  • label
dolfin::SubsetIterator::SubsetIterator(const SubsetIterator &subset_iter)

Copy Constructor.

Parameters:subset_iter
bool dolfin::SubsetIterator::end() const

Check if iterator has reached the end.

SubsetIterator dolfin::SubsetIterator::end_iterator()

Beyond end iterator.

std::vector<std::size_t>::iterator dolfin::SubsetIterator::it
bool dolfin::SubsetIterator::operator!=(const SubsetIterator &sub_iter) const

Comparison operator.

Parameters:sub_iter
MeshEntity &dolfin::SubsetIterator::operator*()

Dereference operator.

SubsetIterator &dolfin::SubsetIterator::operator++()

Step to next mesh entity (prefix increment)

SubsetIterator &dolfin::SubsetIterator::operator--()

Step back to previous mesh entity (prefix decrement)

MeshEntity *dolfin::SubsetIterator::operator->()

Member access operator.

bool dolfin::SubsetIterator::operator==(const SubsetIterator &sub_iter) const

Comparison operator.

Parameters:sub_iter
void dolfin::SubsetIterator::set_end()
std::vector<std::size_t> &dolfin::SubsetIterator::subset
dolfin::SubsetIterator::~SubsetIterator()

Destructor.

TetrahedronCell

C++ documentation for TetrahedronCell from dolfin/mesh/TetrahedronCell.h:

class dolfin::TetrahedronCell

This class implements functionality for tetrahedral cell meshes.

dolfin::TetrahedronCell::TetrahedronCell()

Specify cell type and facet type.

Point dolfin::TetrahedronCell::cell_normal(const Cell &cell) const

Compute normal to given cell (viewed as embedded in 4D ...)

Parameters:cell
double dolfin::TetrahedronCell::circumradius(const MeshEntity &tetrahedron) const

Compute circumradius of tetrahedron.

Parameters:tetrahedron
bool dolfin::TetrahedronCell::collides(const Cell &cell, const MeshEntity &entity) const

Check whether given entity collides with cell.

Parameters:
  • cell
  • entity
bool dolfin::TetrahedronCell::collides(const Cell &cell, const Point &point) const

Check whether given point collides with cell.

Parameters:
  • cell
  • point
void dolfin::TetrahedronCell::create_entities(boost::multi_array<unsigned int, 2> &e, std::size_t dim, const unsigned int *v) const

Create entities e of given topological dimension from vertices v.

Parameters:
  • e
  • dim
  • v
std::string dolfin::TetrahedronCell::description(bool plural) const

Return description of cell type.

Parameters:plural
std::size_t dolfin::TetrahedronCell::dim() const

Return topological dimension of cell.

double dolfin::TetrahedronCell::facet_area(const Cell &cell, std::size_t facet) const

Compute the area/length of given facet with respect to the cell.

Parameters:
  • cell
  • facet
std::size_t dolfin::TetrahedronCell::find_edge(std::size_t i, const Cell &cell) const
Parameters:
  • i
  • cell
bool dolfin::TetrahedronCell::is_simplex() const

Check if cell is a simplex.

Point dolfin::TetrahedronCell::normal(const Cell &cell, std::size_t facet) const

Compute normal of given facet with respect to the cell.

Parameters:
  • cell
  • facet
double dolfin::TetrahedronCell::normal(const Cell &cell, std::size_t facet, std::size_t i) const

Compute component i of normal of given facet with respect to the cell

Parameters:
  • cell
  • facet
  • i
std::size_t dolfin::TetrahedronCell::num_entities(std::size_t dim) const

Return number of entities of given topological dimension.

Parameters:dim
std::size_t dolfin::TetrahedronCell::num_vertices(std::size_t dim) const

Return number of vertices for entity of given topological dimension.

Parameters:dim
void dolfin::TetrahedronCell::order(Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Order entities locally.

Parameters:
  • cell
  • local_to_global_vertex_indices
std::size_t dolfin::TetrahedronCell::orientation(const Cell &cell) const

Return orientation of the cell.

Parameters:cell
bool dolfin::TetrahedronCell::point_outside_of_plane(const Point &point, const Point &A, const Point &B, const Point &C, const Point &D) const
Parameters:
  • point
  • A
  • B
  • C
  • D
double dolfin::TetrahedronCell::squared_distance(const Cell &cell, const Point &point) const

Compute squared distance to given point.

Parameters:
  • cell
  • point
double dolfin::TetrahedronCell::volume(const MeshEntity &tetrahedron) const

Compute volume of tetrahedron.

Parameters:tetrahedron
std::vector<std::int8_t> dolfin::TetrahedronCell::vtk_mapping() const

Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.

TopologyComputation

C++ documentation for TopologyComputation from dolfin/mesh/TopologyComputation.h:

class dolfin::TopologyComputation

This class implements a set of basic algorithms that automate the computation of mesh entities and connectivity.

void dolfin::TopologyComputation::compute_connectivity(Mesh &mesh, std::size_t d0, std::size_t d1)

Compute connectivity for given pair of topological dimensions.

Parameters:
  • mesh
  • d0
  • d1
std::size_t dolfin::TopologyComputation::compute_entities(Mesh &mesh, std::size_t dim)

Compute mesh entities of given topological dimension, and connectivity cell-to-enity (tdim, dim)

Parameters:
  • mesh
  • dim
std::int32_t dolfin::TopologyComputation::compute_entities_by_key_matching(Mesh &mesh, int dim)
Parameters:
  • mesh
  • dim
std::size_t dolfin::TopologyComputation::compute_entities_old(Mesh &mesh, std::size_t dim)

Compute mesh entities of given topological dimension. Note: this function will be replaced by the new ‘compute_entities’ function, which is considerably faster, especially for poorly ordered mesh.

Parameters:
  • mesh
  • dim
void dolfin::TopologyComputation::compute_from_intersection(Mesh &mesh, std::size_t d0, std::size_t d1, std::size_t d)
Parameters:
  • mesh
  • d0
  • d1
  • d
void dolfin::TopologyComputation::compute_from_map(Mesh &mesh, std::size_t d0, std::size_t d1)
Parameters:
  • mesh
  • d0
  • d1
void dolfin::TopologyComputation::compute_from_transpose(Mesh &mesh, std::size_t d0, std::size_t d1)
Parameters:
  • mesh
  • d0
  • d1

TriangleCell

C++ documentation for TriangleCell from dolfin/mesh/TriangleCell.h:

class dolfin::TriangleCell

This class implements functionality for triangular meshes.

dolfin::TriangleCell::TriangleCell()

Specify cell type and facet type.

Point dolfin::TriangleCell::cell_normal(const Cell &cell) const

Compute normal to given cell (viewed as embedded in 3D)

Parameters:cell
double dolfin::TriangleCell::circumradius(const MeshEntity &triangle) const

Compute diameter of triangle.

Parameters:triangle
bool dolfin::TriangleCell::collides(const Cell &cell, const MeshEntity &entity) const

Check whether given entity collides with cell.

Parameters:
  • cell
  • entity
bool dolfin::TriangleCell::collides(const Cell &cell, const Point &point) const

Check whether given point collides with cell.

Parameters:
  • cell
  • point
void dolfin::TriangleCell::create_entities(boost::multi_array<unsigned int, 2> &e, std::size_t dim, const unsigned int *v) const

Create entities e of given topological dimension from vertices v.

Parameters:
  • e
  • dim
  • v
std::string dolfin::TriangleCell::description(bool plural) const

Return description of cell type.

Parameters:plural
std::size_t dolfin::TriangleCell::dim() const

Return topological dimension of cell.

double dolfin::TriangleCell::facet_area(const Cell &cell, std::size_t facet) const

Compute the area/length of given facet with respect to the cell.

Parameters:
  • cell
  • facet
std::size_t dolfin::TriangleCell::find_edge(std::size_t i, const Cell &cell) const
Parameters:
  • i
  • cell
bool dolfin::TriangleCell::is_simplex() const

Check if cell is a simplex.

Point dolfin::TriangleCell::normal(const Cell &cell, std::size_t facet) const

Compute of given facet with respect to the cell.

Parameters:
  • cell
  • facet
double dolfin::TriangleCell::normal(const Cell &cell, std::size_t facet, std::size_t i) const

Compute component i of normal of given facet with respect to the cell.

Parameters:
  • cell
  • facet
  • i
std::size_t dolfin::TriangleCell::num_entities(std::size_t dim) const

Return number of entities of given topological dimension.

Parameters:dim
std::size_t dolfin::TriangleCell::num_vertices(std::size_t dim) const

Return number of vertices for entity of given topological dimension.

Parameters:dim
void dolfin::TriangleCell::order(Cell &cell, const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Order entities locally.

Parameters:
  • cell
  • local_to_global_vertex_indices
std::size_t dolfin::TriangleCell::orientation(const Cell &cell) const

Return orientation of the cell.

Parameters:cell
double dolfin::TriangleCell::squared_distance(const Cell &cell, const Point &point) const

Compute squared distance to given point (3D enabled)

Parameters:
  • cell
  • point
double dolfin::TriangleCell::squared_distance(const Point &point, const Point &a, const Point &b, const Point &c)

Compute squared distance to given point. This version takes the three vertex coordinates as 3D points. This makes it possible to reuse this function for computing the (squared) distance to a tetrahedron.

Parameters:
  • point
  • a
  • b
  • c
double dolfin::TriangleCell::volume(const MeshEntity &triangle) const

Compute (generalized) volume (area) of triangle.

Parameters:triangle
std::vector<std::int8_t> dolfin::TriangleCell::vtk_mapping() const

Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.

Vertex

C++ documentation for Vertex from dolfin/mesh/Vertex.h:

class dolfin::Vertex

A Vertex is a MeshEntity of topological dimension 0.

dolfin::Vertex::Vertex(MeshEntity &entity)

Create vertex from mesh entity.

Parameters:entity
dolfin::Vertex::Vertex(const Mesh &mesh, std::size_t index)

Create vertex on given mesh.

Parameters:
  • mesh
  • index
Point dolfin::Vertex::point() const

Return vertex coordinates as a 3D point value.

const double *dolfin::Vertex::x() const

Return array of vertex coordinates (const version)

double dolfin::Vertex::x(std::size_t i) const

Return value of vertex coordinate i.

Parameters:i
dolfin::Vertex::~Vertex()

Destructor.

VertexFunction

C++ documentation for VertexFunction from dolfin/mesh/Vertex.h:

class dolfin::VertexFunction : public dolfin::MeshFunction<T>, dolfin::VertexFunction<T>

A VertexFunction is a MeshFunction of topological dimension 0.

dolfin::VertexFunction::VertexFunction(std::shared_ptr<const Mesh> mesh)

Constructor on Mesh .

Parameters:mesh
dolfin::VertexFunction::VertexFunction(std::shared_ptr<const Mesh> mesh, const T &value)

Constructor on Mesh and value.

Parameters:
  • mesh
  • value