dolfin/generation

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

Classes

BoxMesh

C++ documentation for BoxMesh from dolfin/generation/BoxMesh.h:

class dolfin::BoxMesh : public dolfin::Mesh

Tetrahedral mesh of the 3D rectangular prism spanned by two points p0 and p1. Given the number of cells (nx, ny, nz) in each direction, the total number of tetrahedra will be 6*nx*ny*nz and the total number of vertices will be (nx + 1)*(ny + 1)*(nz + 1).

dolfin::BoxMesh::BoxMesh(MPI_Comm comm, const Point &p0, const Point &p1, std::size_t nx, std::size_t ny, std::size_t nz)

Deprecated Create a uniform finite element Mesh over the rectangular prism spanned by the two _Point_s p0 and p1. The order of the two points is not important in terms of minimum and maximum coordinates.

// Mesh with 8 cells in each direction on the
// set [-1,2] x [-1,2] x [-1,2].
Point p0(-1, -1, -1);
Point p1(2, 2, 2);
BoxMesh mesh(MPI_COMM_WORLD, p0, p1, 8, 8, 8);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • p0 – (Point ) First point.
  • p1 – (Point ) Second point.
  • nx – (double) Number of cells in x-direction.
  • ny – (double) Number of cells in y-direction.
  • nz – (double) Number of cells in z-direction.
dolfin::BoxMesh::BoxMesh(const Point &p0, const Point &p1, std::size_t nx, std::size_t ny, std::size_t nz)

Deprecated Create a uniform finite element Mesh over the rectangular prism spanned by the two _Point_s p0 and p1. The order of the two points is not important in terms of minimum and maximum coordinates.

// Mesh with 8 cells in each direction on the
// set [-1,2] x [-1,2] x [-1,2].
Point p0(-1, -1, -1);
Point p1(2, 2, 2);
BoxMesh mesh(p0, p1, 8, 8, 8);
Parameters:
  • p0 – (Point ) First point.
  • p1 – (Point ) Second point.
  • nx – (double) Number of cells in x-direction.
  • ny – (double) Number of cells in y-direction.
  • nz – (double) Number of cells in z-direction.
void dolfin::BoxMesh::build_hex(Mesh &mesh, std::array<std::size_t, 3> n)
Parameters:
  • mesh
  • n
void dolfin::BoxMesh::build_tet(Mesh &mesh, const std::array<Point, 2> &p, std::array<std::size_t, 3> n)
Parameters:
  • mesh
  • p
  • n
Mesh dolfin::BoxMesh::create(MPI_Comm comm, const std::array<Point, 2> &p, std::array<std::size_t, 3> n, CellType::Type cell_type)

Create a uniform finite element Mesh over the rectangular prism spanned by the two _Point_s p0 and p1. The order of the two points is not important in terms of minimum and maximum coordinates.

// Mesh with 8 cells in each direction on the
// set [-1,2] x [-1,2] x [-1,2].
Point p0(-1, -1, -1);
Point p1(2, 2, 2);
auto mesh = BoxMesh::create({p0, p1}, {8, 8, 8});
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • p – (std::array<Point , 2>) Points of box.
  • n – (std::array<double, 3> ) Number of cells in each direction.
  • cell_type – Tetrahedron or hexahedron
Mesh dolfin::BoxMesh::create(const std::array<Point, 2> &p, std::array<std::size_t, 3> n, CellType::Type cell_type)

Create a uniform finite element Mesh over the rectangular prism spanned by the two _Point_s p0 and p1. The order of the two points is not important in terms of minimum and maximum coordinates.

// Mesh with 8 cells in each direction on the
// set [-1,2] x [-1,2] x [-1,2].
Point p0(-1, -1, -1);
Point p1(2, 2, 2);
auto mesh = BoxMesh::create({p0, p1}, {8, 8, 8});
Parameters:
  • p – (std::array<Point , 2>) Points of box.
  • n – (std::array<double, 3> ) Number of cells in each direction.
  • cell_type – Tetrahedron or Hexahedron

IntervalMesh

C++ documentation for IntervalMesh from dolfin/generation/IntervalMesh.h:

class dolfin::IntervalMesh : public dolfin::Mesh

Interval mesh of the 1D line [a,b]. Given the number of cells (n) in the axial direction, the total number of intervals will be n and the total number of vertices will be (n + 1).

dolfin::IntervalMesh::IntervalMesh(MPI_Comm comm, std::size_t n, double a, double b)

Constructor

// Create a mesh of 25 cells in the interval [-1,1]
IntervalMesh mesh(MPI_COMM_WORLD, 25, -1.0, 1.0);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • n – (std::size_t) The number of cells.
  • a – (double) The minimum point (inclusive).
  • b – (double) The maximum point (inclusive).
dolfin::IntervalMesh::IntervalMesh(std::size_t n, double a, double b)

Constructor

// Create a mesh of 25 cells in the interval [-1,1]
IntervalMesh mesh(25, -1.0, 1.0);
Parameters:
  • n – (std::size_t) The number of cells.
  • a – (double) The minimum point (inclusive).
  • b – (double) The maximum point (inclusive).
void dolfin::IntervalMesh::build(Mesh &mesh, std::size_t n, std::array<double, 2> x)
Parameters:
  • mesh
  • n
  • x
Mesh dolfin::IntervalMesh::create(MPI_Comm comm, std::size_t n, std::array<double, 2> x)

Factory

// Create a mesh of 25 cells in the interval [-1,1]
IntervalMesh mesh(MPI_COMM_WORLD, 25, -1.0, 1.0);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • n – (std::size_t) The number of cells.
  • x – (std::array<double, 2>) The end points
Mesh dolfin::IntervalMesh::create(std::size_t n, std::array<double, 2> x)

Factory

// Create a mesh of 25 cells in the interval [-1,1]
auto mesh = IntervalMesh::create(25, {-1.0, 1.0});
Parameters:
  • n – (std::size_t) The number of cells.
  • x – (std::array<double, 2>) The end points

RectangleMesh

C++ documentation for RectangleMesh from dolfin/generation/RectangleMesh.h:

class dolfin::RectangleMesh : public dolfin::Mesh

Triangular mesh of the 2D rectangle spanned by two points p0 and p1. Given the number of cells (nx, ny) in each direction, the total number of triangles will be 2*nx*ny and the total number of vertices will be (nx + 1)*(ny + 1).

dolfin::RectangleMesh::RectangleMesh(MPI_Comm comm, const Point &p0, const Point &p1, std::size_t nx, std::size_t ny, std::string diagonal = "right")
// Mesh with 8 cells in each direction on the
// set [-1,2] x [-1,2]
Point p0(-1, -1);
Point p1(2, 2);
RectangleMesh mesh(MPI_COMM_WORLD, p0, p1, 8, 8);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • p0 – (Point ) First point.
  • p1 – (Point ) Second point.
  • nx – (double) Number of cells in \(x\) -direction.
  • ny – (double) Number of cells in \(y\) -direction.
  • diagonal – (string) Direction of diagonals: “left”, “right”, “left/right”, “crossed”
dolfin::RectangleMesh::RectangleMesh(const Point &p0, const Point &p1, std::size_t nx, std::size_t ny, std::string diagonal = "right")
// Mesh with 8 cells in each direction on the
// set [-1,2] x [-1,2]
Point p0(-1, -1);
Point p1(2, 2);
RectangleMesh mesh(p0, p1, 8, 8);
Parameters:
  • p0 – (Point ) First point.
  • p1 – (Point ) Second point.
  • nx – (double) Number of cells in \(x\) -direction.
  • ny – (double) Number of cells in \(y\) -direction.
  • diagonal – (string) Direction of diagonals: “left”, “right”, “left/right”, “crossed”
void dolfin::RectangleMesh::build_quad(Mesh &mesh, const std::array<Point, 2> &p, std::array<std::size_t, 2> n)
Parameters:
  • mesh
  • p
  • n
void dolfin::RectangleMesh::build_tri(Mesh &mesh, const std::array<Point, 2> &p, std::array<std::size_t, 2> n, std::string diagonal = "right")
Parameters:
  • mesh
  • p
  • n
  • diagonal
Mesh dolfin::RectangleMesh::create(MPI_Comm comm, const std::array<Point, 2> &p, std::array<std::size_t, 2> n, CellType::Type cell_type, std::string diagonal = "right")
// Mesh with 8 cells in each direction on the
// set [-1,2] x [-1,2]
Point p0(-1, -1);
Point p1(2, 2);
auto mesh = RectangleMesh::create(MPI_COMM_WORLD, {p0, p1}, {8, 8});
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • p – (std::array<Point , 2>) Vertex points.
  • n – (std::array<std::size_t, 2>) Number of cells in each direction
  • cell_type – (dolfin::CellType::Type ) Cell type
  • diagonal – (string) Direction of diagonals: “left”, “right”, “left/right”, “crossed”
Mesh dolfin::RectangleMesh::create(const std::array<Point, 2> &p, std::array<std::size_t, 2> n, CellType::Type cell_type, std::string diagonal = "right")
// Mesh with 8 cell edges in each direction on the
// set [-1,2] x [-1,2]
Point p0(-1, -1);
Point p1(2, 2);
auto Mesh = RectangleMesh::create({p0, p1}, {8, 8});
Parameters:
  • p – (std::array<Point , 2>) Vertex points.
  • n – (std::array<std::size_t, 2>) Number of cells in each direction
  • cell_type – (dolfin::CellType::Type ) Cell type
  • diagonal – (string) Direction of diagonals: “left”, “right”, “left/right”, “crossed”

SphericalShellMesh

C++ documentation for SphericalShellMesh from dolfin/generation/SphericalShellMesh.h:

class dolfin::SphericalShellMesh

Spherical shell approximation, icosahedral mesh, with degree=1 or degree=2

void dolfin::SphericalShellMesh::build(Mesh &mesh, std::size_t degree)
Parameters:
  • mesh
  • degree
Mesh dolfin::SphericalShellMesh::create(MPI_Comm comm, std::size_t degree)

Create a spherical shell manifold for testing.

Parameters:
  • comm
  • degree

UnitCubeMesh

C++ documentation for UnitCubeMesh from dolfin/generation/UnitCubeMesh.h:

class dolfin::UnitCubeMesh : public dolfin::BoxMesh

Tetrahedral/hexahedral mesh of the 3D unit cube [0,1] x [0,1] x [0,1]. Given the number of cells (nx, ny, nz) in each direction, the total number of tetrahedra will be 6*nx*ny*nz and the total number of vertices will be (nx + 1)*(ny + 1)*(nz + 1).

dolfin::UnitCubeMesh::UnitCubeMesh(MPI_Comm comm, std::size_t nx, std::size_t ny, std::size_t nz)

Create a uniform finite element Mesh over the unit cube [0,1] x [0,1] x [0,1].

UnitCubeMesh mesh(MPI_COMM_WORLD, 32, 32, 32);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • nx – (std::size_t) Number of cells in \(x\) direction.
  • ny – (std::size_t) Number of cells in \(y\) direction.
  • nz – (std::size_t) Number of cells in \(z\) direction.
dolfin::UnitCubeMesh::UnitCubeMesh(std::size_t nx, std::size_t ny, std::size_t nz)

Create a uniform finite element Mesh over the unit cube [0,1] x [0,1] x [0,1].

UnitCubeMesh mesh(32, 32, 32);
Parameters:
  • nx – (std::size_t) Number of cells in \(x\) direction.
  • ny – (std::size_t) Number of cells in \(y\) direction.
  • nz – (std::size_t) Number of cells in \(z\) direction.
Mesh dolfin::UnitCubeMesh::create(MPI_Comm comm, std::array<std::size_t, 3> n, CellType::Type cell_type)

Create a uniform finite element Mesh over the unit cube [0,1] x [0,1] x [0,1].

auto mesh = UnitCubeMesh::create(MPI_COMM_WORLD, {32, 32, 32}, CellType::Type::hexahedron);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • n – (std::aray<std::size_t, 3>) Number of cells in each direction.
  • cell_type – Tetrahedron or hexahedron
Mesh dolfin::UnitCubeMesh::create(MPI_Comm comm, std::size_t nx, std::size_t ny, std::size_t nz, CellType::Type cell_type)
Parameters:
  • comm
  • nx
  • ny
  • nz
  • cell_type
Mesh dolfin::UnitCubeMesh::create(std::array<std::size_t, 3> n, CellType::Type cell_type)

Create a uniform finite element Mesh over the unit cube [0,1] x [0,1] x [0,1].

Parameters:
  • n – (std::array<std::size_t, 3>) Number of cells in each direction.
  • cell_type – Tetrahedron or hexahedron :: auto mesh = UnitCubeMesh::create(32, 32, 32, CellType::Type::tetrahedron);
Mesh dolfin::UnitCubeMesh::create(std::size_t nx, std::size_t ny, std::size_t nz, CellType::Type cell_type)
Parameters:
  • nx
  • ny
  • nz
  • cell_type

UnitDiscMesh

C++ documentation for UnitDiscMesh from dolfin/generation/UnitDiscMesh.h:

class dolfin::UnitDiscMesh

A unit disc mesh in 2D or 3D geometry.

void dolfin::UnitDiscMesh::build(Mesh &mesh, std::size_t n, std::size_t degree, std::size_t gdim)
Parameters:
  • mesh
  • n
  • degree
  • gdim
Mesh dolfin::UnitDiscMesh::create(MPI_Comm comm, std::size_t n, std::size_t degree, std::size_t gdim)

Create a unit disc mesh in 2D or 3D geometry with n steps, and given degree polynomial mesh

Parameters:
  • comm
  • n
  • degree
  • gdim

UnitIntervalMesh

C++ documentation for UnitIntervalMesh from dolfin/generation/UnitIntervalMesh.h:

class dolfin::UnitIntervalMesh : public dolfin::IntervalMesh

A mesh of the unit interval (0, 1) with a given number of cells (nx) in the axial direction. The total number of intervals will be nx and the total number of vertices will be (nx + 1).

dolfin::UnitIntervalMesh::UnitIntervalMesh(MPI_Comm comm, std::size_t nx)

Constructor

// Create a mesh of 25 cells in the interval [0,1]
UnitIntervalMesh mesh(MPI_COMM_WORLD, 25);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • nx – (std::size_t) The number of cells.
dolfin::UnitIntervalMesh::UnitIntervalMesh(std::size_t nx)

Constructor

// Create a mesh of 25 cells in the interval [0,1]
UnitIntervalMesh mesh(25);
Parameters:nx – (std::size_t) The number of cells.
Mesh dolfin::UnitIntervalMesh::create(MPI_Comm comm, std::size_t n)

Factory

// Create a mesh of 25 cells in the interval [0,1]
auto mesh = UnitIntervalMesh::create(MPI_COMM_WORLD, 25);
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • n – (std::size_t) The number of cells.
Mesh dolfin::UnitIntervalMesh::create(std::size_t n)

Factory

// Create a mesh of 25 cells in the interval [0,1]
auto mesh = UnitIntervalMesh::create(25);
Parameters:n – (std::size_t) The number of cells.

UnitSquareMesh

C++ documentation for UnitSquareMesh from dolfin/generation/UnitSquareMesh.h:

class dolfin::UnitSquareMesh : public dolfin::RectangleMesh

Triangular/quadrilateral mesh of the 2D unit square [0,1] x [0,1]. Given the number of cells (nx, ny) in each direction, the total number of triangles will be 2*nx*ny and the total number of vertices will be (nx + 1)*(ny + 1). std::string diagonal (“left”, “right”, “right/left”, “left/right”, or “crossed”) indicates the direction of the diagonals.

dolfin::UnitSquareMesh::UnitSquareMesh(MPI_Comm comm, std::size_t nx, std::size_t ny, std::string diagonal = "right")

Create a uniform finite element Mesh over the unit square [0,1] x [0,1].

UnitSquareMesh mesh1(MPI_COMM_WORLD, 32, 32);
UnitSquareMesh mesh2(MPI_COMM_WORLD, 32, 32, "crossed");
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • nx – (std::size_t) Number of cells in horizontal direction.
  • ny – (std::size_t) Number of cells in vertical direction.
  • diagonal – (std::string) Optional argument: A std::string indicating the direction of the diagonals.
dolfin::UnitSquareMesh::UnitSquareMesh(std::size_t nx, std::size_t ny, std::string diagonal = "right")

Create a uniform finite element Mesh over the unit square [0,1] x [0,1].

UnitSquareMesh mesh1(32, 32);
UnitSquareMesh mesh2(32, 32, "crossed");
Parameters:
  • nx – (std::size_t) Number of cells in horizontal direction.
  • ny – (std::size_t) Number of cells in vertical direction.
  • diagonal – (std::string) Optional argument: A std::string indicating the direction of the diagonals.
Mesh dolfin::UnitSquareMesh::create(MPI_Comm comm, std::array<std::size_t, 2> n, CellType::Type cell_type, std::string diagonal = "right")

Create a uniform finite element Mesh over the unit square [0,1] x [0,1].

auto mesh1 = UnitSquareMesh::create(MPI_COMM_WORLD, 32, 32);
auto mesh2 = UnitSquareMesh::create(MPI_COMM_WORLD, 32, 32, "crossed");
Parameters:
  • comm – (MPI_Comm) MPI communicator
  • n – (std:::array<std::size_t, 2>) Number of cells in each direction.
  • cell_type – Triangle or quadrilateral.
  • diagonal – (std::string) Optional argument: A std::string indicating the direction of the diagonals.
Mesh dolfin::UnitSquareMesh::create(MPI_Comm comm, std::size_t nx, std::size_t ny, CellType::Type cell_type, std::string diagonal = "right")
Parameters:
  • comm
  • nx
  • ny
  • cell_type
  • diagonal
Mesh dolfin::UnitSquareMesh::create(std::array<std::size_t, 2> n, CellType::Type cell_type, std::string diagonal = "right")

Create a uniform finite element Mesh over the unit square [0,1] x [0,1].

auto mesh1 = UnitSquareMesh::create(32, 32);
auto mesh2 = UnitSquareMesh::create(32, 32, "crossed");
Parameters:
  • n – (std:::array<std::size_t, 2>) Number of cells in each direction.
  • cell_type – Triangle or quadrilateral
  • diagonal – (std::string) Optional argument: A std::string indicating the direction of the diagonals.
Mesh dolfin::UnitSquareMesh::create(std::size_t nx, std::size_t ny, CellType::Type cell_type, std::string diagonal = "right")
Parameters:
  • nx
  • ny
  • cell_type
  • diagonal

UnitTetrahedronMesh

C++ documentation for UnitTetrahedronMesh from dolfin/generation/UnitTetrahedronMesh.h:

class dolfin::UnitTetrahedronMesh

A mesh consisting of a single tetrahedron with vertices at (0, 0, 0) (1, 0, 0) (0, 1, 0) (0, 0, 1) This class is useful for testing.

Mesh dolfin::UnitTetrahedronMesh::create()

Create mesh of unit tetrahedron.

UnitTriangleMesh

C++ documentation for UnitTriangleMesh from dolfin/generation/UnitTriangleMesh.h:

class dolfin::UnitTriangleMesh

A mesh consisting of a single triangle with vertices at (0, 0) (1, 0) (0, 1) This class is useful for testing.

Mesh dolfin::UnitTriangleMesh::create()

Create mesh of unit triangle.