DOLFIN
DOLFIN C++ interface
UnitSquareMesh.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 // Modified by Mikael Mortensen, 2014
19 //
20 // First added: 2005-12-02
21 // Last changed: 2018-02-09
22 
23 #ifndef __UNIT_SQUARE_MESH_H
24 #define __UNIT_SQUARE_MESH_H
25 
26 #include <array>
27 #include <string>
28 #include <dolfin/mesh/CellType.h>
29 #include "RectangleMesh.h"
30 
31 namespace dolfin
32 {
33 
41 
43  {
44  public:
45 
62  static Mesh create(std::array<std::size_t, 2> n,
63  CellType::Type cell_type,
64  std::string diagonal="right")
65  {
66  return RectangleMesh::create({{Point(0.0, 0.0), Point(1.0, 1.0)}}, n,
67  cell_type, diagonal);
68  }
69 
70  // Temporary - part of pybind11 transition and will be
71  // removed. Avoid using.
72  static Mesh create(std::size_t nx, std::size_t ny, CellType::Type cell_type,
73  std::string diagonal="right")
74  {
75  return RectangleMesh::create({{Point(0.0, 0.0), Point(1.0, 1.0)}}, {{nx, ny}},
76  cell_type, diagonal);
77  }
78 
79  // Temporary - part of pybind11 transition and will be
80  // removed. Avoid using.
81  static Mesh create(MPI_Comm comm, std::size_t nx, std::size_t ny,
82  CellType::Type cell_type,
83  std::string diagonal="right")
84  {
85  return RectangleMesh::create(comm, {{Point(0.0, 0.0), Point(1.0, 1.0)}}, {{nx, ny}},
86  cell_type, diagonal);
87  }
88 
107  static Mesh create(MPI_Comm comm, std::array<std::size_t, 2> n,
108  CellType::Type cell_type,
109  std::string diagonal="right")
110  { return RectangleMesh::create(comm, {{Point(0.0, 0.0), Point(1.0, 1.0)}}, n,
111  cell_type, diagonal); }
112 
129  UnitSquareMesh(std::size_t nx, std::size_t ny, std::string diagonal="right")
130  : UnitSquareMesh(MPI_COMM_WORLD, nx, ny, diagonal) {}
131 
150  UnitSquareMesh(MPI_Comm comm, std::size_t nx, std::size_t ny,
151  std::string diagonal="right")
152  : RectangleMesh(comm, Point(0.0, 0.0), Point(1.0, 1.0), nx, ny, diagonal) {}
153 
154  };
155 
156 }
157 
158 #endif
UnitSquareMesh(std::size_t nx, std::size_t ny, std::string diagonal="right")
Definition: UnitSquareMesh.h:129
static Mesh create(const std::array< Point, 2 > &p, std::array< std::size_t, 2 > n, CellType::Type cell_type, std::string diagonal="right")
Definition: RectangleMesh.h:57
Definition: adapt.h:29
Definition: Point.h:40
Definition: UnitSquareMesh.h:42
Type
Enum for different cell types.
Definition: CellType.h:51
UnitSquareMesh(MPI_Comm comm, std::size_t nx, std::size_t ny, std::string diagonal="right")
Definition: UnitSquareMesh.h:150
static Mesh create(MPI_Comm comm, std::array< std::size_t, 2 > n, CellType::Type cell_type, std::string diagonal="right")
Definition: UnitSquareMesh.h:107
Definition: RectangleMesh.h:36
static Mesh create(std::array< std::size_t, 2 > n, CellType::Type cell_type, std::string diagonal="right")
Definition: UnitSquareMesh.h:62
Definition: Mesh.h:82