DOLFIN
DOLFIN C++ interface
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfin
generation
RectangleMesh.h
1
// Copyright (C) 2005-2017 Anders Logg and Garth N. Wells
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 __RECTANGLE_MESH_H
19
#define __RECTANGLE_MESH_H
20
21
#include <array>
22
#include <string>
23
#include <dolfin/common/MPI.h>
24
#include <dolfin/log/log.h>
25
#include <dolfin/mesh/CellType.h>
26
#include <dolfin/mesh/Mesh.h>
27
28
namespace
dolfin
29
{
30
35
36
class
RectangleMesh
:
public
Mesh
37
{
38
public
:
39
57
static
Mesh
create
(
const
std::array<Point, 2>& p,
58
std::array<std::size_t, 2> n,
59
CellType::Type
cell_type,
60
std::string diagonal=
"right"
)
61
{
return
create
(MPI_COMM_WORLD, p, n, cell_type, diagonal); }
62
82
static
Mesh
create
(MPI_Comm comm,
const
std::array<Point, 2>& p,
83
std::array<std::size_t, 2> n,
84
CellType::Type
cell_type,
85
std::string diagonal=
"right"
)
86
{
87
Mesh
mesh(comm);
88
if
(cell_type == CellType::Type::triangle)
89
build_tri(mesh, p, n, diagonal);
90
else
if
(cell_type == CellType::Type::quadrilateral)
91
build_quad(mesh, p, n);
92
else
93
{
94
dolfin_error
(
"RectangleMesh.h"
,
95
"generate rectangle mesh"
,
96
"Wrong cell type '%d'"
, cell_type);
97
}
98
99
return
mesh;
100
}
101
102
// Deprecated
122
RectangleMesh
(
const
Point
& p0,
const
Point
& p1,
123
std::size_t nx, std::size_t ny,
124
std::string diagonal=
"right"
);
125
126
// Deprecated
148
RectangleMesh
(MPI_Comm comm,
149
const
Point
& p0,
const
Point
& p1,
150
std::size_t nx, std::size_t ny,
151
std::string diagonal=
"right"
);
152
153
private
:
154
155
// Build mesh
156
static
void
build_tri(
Mesh
& mesh,
const
std::array<Point, 2>& p,
157
std::array<std::size_t, 2> n,
158
std::string diagonal=
"right"
);
159
160
161
static
void
build_quad(
Mesh
& mesh,
const
std::array<Point, 2>& p,
162
std::array<std::size_t, 2> n);
163
};
164
165
}
166
167
#endif
dolfin::CellType::Type
Type
Enum for different cell types.
Definition
CellType.h:51
dolfin::Mesh
Definition
Mesh.h:83
dolfin::Mesh::Mesh
Mesh()
Create empty mesh.
Definition
Mesh.cpp:58
dolfin::Point
Definition
Point.h:41
dolfin::RectangleMesh::create
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
dolfin::RectangleMesh::create
static Mesh 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")
Definition
RectangleMesh.h:82
dolfin::RectangleMesh::RectangleMesh
RectangleMesh(const Point &p0, const Point &p1, std::size_t nx, std::size_t ny, std::string diagonal="right")
Definition
RectangleMesh.cpp:30
dolfin
Definition
adapt.h:30
dolfin::dolfin_error
void dolfin_error(std::string location, std::string task, std::string reason,...)
Definition
log.cpp:129
Generated by
1.17.0