MeshEditor

class dolfin.cpp.mesh.MeshEditor

Bases: object

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

Friends: TetrahedronCell.

Constructor.

add_cell()

Add cell with given vertices (3D)

Parameters:
  • c (std::size_t) – (std::size_t) The cell (index).
  • v0 (std::size_t) – (std::vector<std::size_t>) The first vertex (local index).
  • v1 (std::size_t) – (std::vector<std::size_t>) The second vertex (local index).
  • v2 (std::size_t) – (std::vector<std::size_t>) The third vertex (local index).
  • v3 (std::size_t) – (std::vector<std::size_t>) The fourth vertex (local index).
Return type:

void

add_entity_point()

Add a point in a given entity of dimension entity_dim.

Parameters:
  • entity_dim (std::size_t) –
  • order (std::size_t) –
  • index (std::size_t) –
  • Point & p (const) –
Return type:

void

add_vertex()

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

Parameters:
  • index (std::size_t) – (std::size_t) The vertex (index).
  • x (double) – (double) The x-coordinate.
  • y (double) – (double) The y-coordinate.
Return type:

void

add_vertex_global()

Add vertex v at given point p

Parameters:
  • local_index (std::size_t) – (std::size_t) The vertex (local index).
  • global_index (std::size_t) – (std::size_t) The vertex (global_index).
  • Point & p (const) – (Point ) The point.
Return type:

void

close()

Close mesh, finish editing, and order entities locally

MeshEditor editor;
editor.open(mesh, 2, 2);
...
editor.close()
Parameters:order (bool) – (bool) Order entities locally if true. Default values is true.
Return type:void
init_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) – (std::size_t) The number of cells.
Return type:void
init_cells_global()

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) – (std::size_t) The number of local cells.
  • num_global_cells (std::size_t) – (std::size_t) The number of cells in distributed mesh.
Return type:

void

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.

Return type:void
init_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) – (std::size_t) The number of vertices.
Return type:void
init_vertices_global()

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) – (std::size_t) The number of vertices on this process.
  • num_global_vertices (std::size_t) – (std::size_t) The number of vertices in distributed mesh.
Return type:

void

open()

Open mesh of given cell type, topological and geometrical dimension

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

void

thisown

The membership flag