Cell.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class Cell

Parent class(es)

A Cell is a MeshEntity of topological codimension 0.

Cell()

Create empty cell

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

Create cell on given mesh with given index

Arguments
mesh (Mesh)
The mesh.
index (std::size_t)
The index.
CellType::Type type() const

Return type of cell

std::size_t num_vertices() const

Return number of vertices of cell

std::size_t 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 orientation(const Point &up) const

Compute orientation of cell relative to given ‘up’ direction

Arguments
up (Point)
The direction defined as ‘up’
Returns
std::size_t
Orientation of the cell (0 is ‘same’, 1 is ‘opposite’)
double volume() const

Compute (generalized) volume of cell

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

output:

0.5
double h() const

Compute greatest distance between any two vertices

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

output:

1.41421
double circumradius() const

Compute circumradius of cell

Returns
double
The circumradius of the cell.
Example
UnitSquareMesh mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.circumradius());

output:

0.707106
double inradius() const

Compute inradius of cell

Returns
double
Radius of the sphere inscribed in the cell.
Example
UnitSquareMesh mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.inradius());

output:

0.29289
double 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

Returns
double
topological_dimension * inradius / circumradius
Example
UnitSquareMesh mesh(1, 1);
Cell cell(mesh, 0);
info("%g", cell.radius_ratio());

output:

0.828427
double squared_distance(const Point &point) const

Compute squared distance to given point.

Arguments
point (Point)
The point.
Returns
double
The squared distance to the point.
double distance(const Point &point) const

Compute distance to given point.

Arguments
point (Point)
The point.
Returns
double
The distance to the point.
double normal(std::size_t facet, std::size_t i) const

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

Arguments
facet (std::size_t)
Index of facet.
i (std::size_t)
Component.
Returns
double
Component i of the normal of the facet.
Point normal(std::size_t facet) const

Compute normal of given facet with respect to the cell

Arguments
facet (std::size_t)
Index of facet.
Returns
Point
Normal of the facet.
Point cell_normal() const

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

Returns
Point
Normal of the cell
double facet_area(std::size_t facet) const

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

Arguments
facet (std::size_t)
Index of the facet.
Returns
double
Area/length of the facet.
void order(const std::vector<std::int64_t> &local_to_global_vertex_indices)

Order entities locally

Arguments
global_vertex_indices (_std::vector<std::int64_t>_)
The global vertex indices.
bool ordered(const std::vector<std::int64_t> &local_to_global_vertex_indices) const

Check if entities are ordered

Arguments
global_vertex_indices (_std::vector<std::size_t>)
The global vertex indices.
Returns
bool
True iff ordered.
bool contains(const Point &point) const

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

Arguments
point (Point)
The point to be checked.
Returns
bool
True iff point is contained in cell.
bool collides(const Point &point) const

Check whether given point collides with cell

Arguments
point (Point)
The point to be checked.
Returns
bool
True iff point collides with cell.
bool collides(const MeshEntity &entity) const

Check whether given entity collides with cell

Arguments
entity (MeshEntity)
The cell to be checked.
Returns
bool
True iff entity collides with cell.
std::vector<double> triangulate_intersection(const MeshEntity &entity) const

Compute triangulation of intersection with given entity

Arguments
entity (MeshEntity)
The entity with which to intersect.
Returns
std::vector<double>
A flattened array of simplices of dimension num_simplices x num_vertices x gdim = num_simplices x (tdim + 1) x gdim
void get_coordinate_dofs(std::vector<double> &coordinates) const

Get cell coordinate dofs (not vertex coordinates)

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

Get cell vertex coordinates (not coordinate dofs)

void get_cell_data(ufc::cell &ufc_cell, int local_facet = -1) const

Fill UFC cell with miscellaneous data

void get_cell_topology(ufc::cell &ufc_cell) const

Fill UFC cell with topology data

class CellFunction

Parent class(es)

  • MeshFunction

A CellFunction is a MeshFunction of topological codimension 0.