DOLFIN
DOLFIN C++ interface
Public Member Functions | Friends | List of all members
dolfin::MeshEditor Class Reference

#include <MeshEditor.h>

Public Member Functions

 MeshEditor ()
 Constructor.
 
 ~MeshEditor ()
 Destructor.
 
void open (Mesh &mesh, CellType::Type type, std::size_t tdim, std::size_t gdim, std::size_t degree=1)
 
void open (Mesh &mesh, std::string type, std::size_t tdim, std::size_t gdim, std::size_t degree=1)
 
void init_vertices (std::size_t num_vertices)
 
void init_entities ()
 
void init_vertices_global (std::size_t num_local_vertices, std::size_t num_global_vertices)
 
void init_cells (std::size_t num_cells)
 
void init_cells_global (std::size_t num_local_cells, std::size_t num_global_cells)
 
void add_vertex (std::size_t index, const Point &p)
 
void add_vertex (std::size_t index, const std::vector< double > &x)
 
void add_vertex (std::size_t index, double x)
 
void add_vertex (std::size_t index, double x, double y)
 
void add_vertex (std::size_t index, double x, double y, double z)
 
void add_vertex_global (std::size_t local_index, std::size_t global_index, const Point &p)
 
void add_vertex_global (std::size_t local_index, std::size_t global_index, const std::vector< double > &x)
 
void 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.
 
void add_cell (std::size_t c, std::size_t v0, std::size_t v1)
 
void add_cell (std::size_t c, std::size_t v0, std::size_t v1, std::size_t v2)
 
void add_cell (std::size_t c, std::size_t v0, std::size_t v1, std::size_t v2, std::size_t v3)
 
void add_cell (std::size_t c, const std::vector< std::size_t > &v)
 
template<typename T >
void add_cell (std::size_t c, const T &v)
 
template<typename T >
void add_cell (std::size_t local_index, std::size_t global_index, const T &v)
 
void close (bool order=true)
 

Friends

class TetrahedronCell
 

Detailed Description

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

Member Function Documentation

◆ add_cell() [1/6]

void 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).

◆ add_cell() [2/6]

void 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).

◆ add_cell() [3/6]

void 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).

◆ add_cell() [4/6]

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

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)

◆ add_cell() [5/6]

template<typename T >
void dolfin::MeshEditor::add_cell ( std::size_t  c,
const T &  v 
)
inline

Add cell with given vertices

Parameters
c(std::size_t) The cell (index).
v(typename T) The vertex indices (local indices)

◆ add_cell() [6/6]

template<typename T >
void dolfin::MeshEditor::add_cell ( std::size_t  local_index,
std::size_t  global_index,
const T &  v 
)
inline

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)

◆ add_vertex() [1/5]

void 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.

◆ add_vertex() [2/5]

void 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.

◆ add_vertex() [3/5]

void 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.

◆ add_vertex() [4/5]

void 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.

◆ add_vertex() [5/5]

void 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.

◆ add_vertex_global() [1/2]

void 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.

◆ add_vertex_global() [2/2]

void 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.

◆ close()

void MeshEditor::close ( bool  order = true)

Close mesh, finish editing, and order entities locally

Parameters
order(bool) Order entities locally if true. Default values is true.
MeshEditor editor;
editor.open(mesh, 2, 2);
...
editor.close()

◆ init_cells()

void dolfin::MeshEditor::init_cells ( std::size_t  num_cells)
inline

Specify number of cells (serial version)

Parameters
num_cells(std::size_t) The number of cells.
Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_cells(8);

◆ init_cells_global()

void MeshEditor::init_cells_global ( std::size_t  num_local_cells,
std::size_t  num_global_cells 
)

Specify number of cells (distributed version)

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.
Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_cells(2, 6);

◆ init_entities()

void 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.

◆ init_vertices()

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

Specify number of vertices (serial version)

Parameters
num_vertices(std::size_t) The number of vertices.
Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_vertices(9);

◆ init_vertices_global()

void MeshEditor::init_vertices_global ( std::size_t  num_local_vertices,
std::size_t  num_global_vertices 
)

Specify number of vertices (distributed version)

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.
Mesh mesh;
MeshEditor editor;
editor.open(mesh, 2, 2);
editor.init_vertices(4, 8);

◆ open() [1/2]

void 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.

◆ open() [2/2]

void 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.

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