Cell

class dolfin.cpp.mesh.Cell(*args)

Bases: dolfin.cpp.mesh.MeshEntity

A Cell is a MeshEntity of topological codimension 0.

Create cell on given mesh with given index

Parameters:
  • Mesh & mesh (const) – The mesh.
  • index (std::size_t) – The index.
cell_normal()

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

Return type:Point
Returns:Point Normal of the cell
circumradius()

Compute circumradius of cell

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

Check whether given point collides with cell

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

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

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

Compute distance to given point.

Parameters:Point & point (const) – The point.
Return type:double
Returns:double The distance to the point.
facet_area()

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

Parameters:facet (std::size_t) – Index of the facet.
Return type:double
Returns:double Area/length of the facet.
get_cell_data()

Fill UFC cell with miscellaneous data.

Parameters:
  • & ufc_cell (ufc::cell) –
  • local_facet (int) –
Return type:

void

get_cell_topology()

Fill UFC cell with topology data.

Parameters:& ufc_cell (ufc::cell) –
Return type:void
get_coordinate_dofs()

Get cell coordinate dofs (not vertex coordinates)

Parameters:double > & coordinates (std::vector<) –
Return type:void
get_vertex_coordinates()

Get cell vertex coordinates (not coordinate dofs)

Parameters:double > & coordinates (std::vector<) –
Return type:void
h()

Compute greatest distance between any two vertices

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

Compute inradius of cell

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

Compute triangulation of intersection with given entity

Parameters:MeshEntity & entity (const) – The entity with which to intersect.
Return type:std::vector< Point >
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
normal()

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

Parameters:
  • facet (std::size_t) – Index of facet.
  • i (std::size_t) – Component.
Return type:

double

Returns:

double Component i of the normal of the facet.

num_vertices()

Return number of vertices of cell.

Return type:std::size_t
order()

Order entities locally

Parameters:std::vector< std::int64_t > & local_to_global_vertex_indices (const) – The global vertex indices.
Return type:void
ordered()

Check if entities are ordered

Parameters:std::vector< std::int64_t > & local_to_global_vertex_indices (const) – The global vertex indices.
Return type:bool
Returns:bool True iff ordered.
orientation()

Compute orientation of cell

Return type:std::size_t
Returns:std::size_t Orientation of the cell (0 is ‘up’/’right’, 1 is ‘down’/’left’)
radius_ratio()

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());
Return type:double
Returns:double topological_dimension * inradius / circumradius
squared_distance()

Compute squared distance to given point.

Parameters:Point & point (const) – The point.
Return type:double
Returns:double The squared distance to the point.
thisown

The membership flag

type()

Return type of cell.

Return type:CellType::Type
volume()

Compute (generalized) volume of cell

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