DOLFIN
DOLFIN C++ interface
UnitCubeMesh.h
1// Copyright (C) 2005-2015 Anders Logg
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17
18#ifndef __UNIT_CUBE_MESH_H
19#define __UNIT_CUBE_MESH_H
20
21#include <array>
22#include <cstddef>
23#include <dolfin/common/MPI.h>
24#include <dolfin/mesh/CellType.h>
25#include "BoxMesh.h"
26
27namespace dolfin
28{
29
34
35 class UnitCubeMesh : public BoxMesh
36 {
37 public:
38
50 static Mesh create(std::array<std::size_t, 3> n, CellType::Type cell_type)
51 { return create(MPI_COMM_WORLD, n, cell_type); }
52
66 static Mesh create(MPI_Comm comm, std::array<std::size_t, 3> n, CellType::Type cell_type)
67 { return BoxMesh::create(comm, {{Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0)}}, n, cell_type); }
68
69 // Temporary - part of pybind11 transition and will be
70 // removed. Avoid using.
71 static Mesh create(std::size_t nx, std::size_t ny, std::size_t nz,
72 CellType::Type cell_type)
73 { return create({{nx, ny, nz}}, cell_type); }
74
75 // Temporary - part of pybind11 transition and will be
76 // removed. Avoid using.
77 static Mesh create(MPI_Comm comm, std::size_t nx, std::size_t ny, std::size_t nz,
78 CellType::Type cell_type)
79 { return create({{nx, ny, nz}}, cell_type); }
80
95 UnitCubeMesh(std::size_t nx, std::size_t ny, std::size_t nz)
96 : UnitCubeMesh(MPI_COMM_WORLD, nx, ny, nz) {}
97
113 UnitCubeMesh(MPI_Comm comm, std::size_t nx, std::size_t ny, std::size_t nz)
114 : BoxMesh(comm, Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0), nx, ny, nz) {}
115
116 };
117
118}
119
120#endif
Definition: BoxMesh.h:36
static Mesh create(const std::array< Point, 2 > &p, std::array< std::size_t, 3 > n, CellType::Type cell_type)
Definition: BoxMesh.h:58
Type
Enum for different cell types.
Definition: CellType.h:51
Definition: Mesh.h:84
Mesh()
Create empty mesh.
Definition: Mesh.cpp:59
Definition: Point.h:41
Definition: UnitCubeMesh.h:36
static Mesh create(MPI_Comm comm, std::array< std::size_t, 3 > n, CellType::Type cell_type)
Definition: UnitCubeMesh.h:66
UnitCubeMesh(std::size_t nx, std::size_t ny, std::size_t nz)
Definition: UnitCubeMesh.h:95
UnitCubeMesh(MPI_Comm comm, std::size_t nx, std::size_t ny, std::size_t nz)
Definition: UnitCubeMesh.h:113
static Mesh create(std::array< std::size_t, 3 > n, CellType::Type cell_type)
Definition: UnitCubeMesh.h:50
Definition: adapt.h:30