21#ifndef _BOUNDARY_CONDITIONS_HPP
22#define _BOUNDARY_CONDITIONS_HPP
56 bool is_in(
const VectorRd & x)
const;
58 inline bool is_in(
const Vertex & V)
const {
return is_in(V.coords()); };
60 template<
typename MeshEntity>
62 for (
auto V : E.get_vertices()){
63 if (!
is_in(*V) )
return false;
73 template<
typename MeshEntity>
75 for (
auto V : E.get_vertices()){
92 for (
size_t i=0;
i<
nodes.size();
i++){
105 bool is_in(
const VectorRd & x)
const;
107 inline bool is_in(
const Vertex & V)
const {
return is_in(V.coords()); };
109 template<
typename MeshEntity>
111 for (
auto V : E.get_vertices()){
112 if (!
is_in(*V) )
return false;
124const Hull lower_bottom_corner_x_zero({VectorRd(0.,0.,0.), VectorRd(0.,.25,0.), VectorRd(0.,.25,.25), VectorRd(0.,0.,.25)},
VectorRd(1., 0., 0.));
125const Hull lower_bottom_corner_x_one({VectorRd(1.,0.,0.), VectorRd(1.,.25,0.), VectorRd(1.,.25,.25), VectorRd(1.,0.,.25)},
VectorRd(1., 0., 0.));
134 const std::string
bc_id,
139 const std::string
type(
149 const std::string
type(
154 const std::string
type(
161 return m_n_dir_faces;
166 return m_n_dir_edges;
171 return m_n_dir_vertices;
175 inline const std::string
id() {
return m_bc_id; };
178 inline const std::string
name()
const {
181 }
else if (m_bc_id ==
"N"){
183 }
else if (m_bc_id ==
"M0"){
184 return "Mixed #0 (Dirichlet at x=0, Neumann elsewhere)";
185 }
else if (m_bc_id ==
"M1"){
186 return "Mixed #1 (Dirichlet at x=0 a small rectangle, Neumann elsewhere)";
187 }
else if (m_bc_id ==
"M2"){
188 return "Mixed #2 (Dirichlet between planes x=.25 and x=.5, Neumann elsewhere)";
190 std::cout <<
"Unknown boundary conditions: " << m_bc_id <<
"\n";
206 const std::string m_bc_id;
210 size_t m_n_dir_faces;
211 size_t m_n_dir_edges;
212 size_t m_n_dir_vertices;
const Hull lower_bottom_corner_x_zero({VectorRd(0., 0., 0.), VectorRd(0.,.25, 0.), VectorRd(0.,.25,.25), VectorRd(0., 0.,.25)}, VectorRd(1., 0., 0.))
const Plane plane_x_quarter(VectorRd(.25, 0., 0.), VectorRd(1., 0., 0.))
const Plane plane_x_zero(VectorRd::Zero(), VectorRd(1., 0., 0.))
const Plane plane_x_half(VectorRd(.5, 0., 0.), VectorRd(1., 0., 0.))
const Hull lower_bottom_corner_x_one({VectorRd(1., 0., 0.), VectorRd(1.,.25, 0.), VectorRd(1.,.25,.25), VectorRd(1., 0.,.25)}, VectorRd(1., 0., 0.))
The BoundaryConditions class provides definition of boundary conditions.
Definition BoundaryConditions.hpp:129
const std::string type(const Face &face) const
Test the boundary condition of an face.
Definition BoundaryConditions.cpp:81
const size_t n_dir_vertices() const
Returns the number of Dirichlet vertices.
Definition BoundaryConditions.hpp:170
void reorder_vertices(const std::string pos="end")
Re-order vertices of the mesh to put the Dirichlet vertices at the position "pos" (=end or start)
Definition BoundaryConditions.cpp:241
void reorder_edges(const std::string pos="end")
Re-order edges of the mesh to put the Dirichlet edges at the position "pos" (=end or start)
Definition BoundaryConditions.cpp:195
const std::string name() const
Returns the complete name of the boundary condition.
Definition BoundaryConditions.hpp:178
void reorder_faces(const std::string pos="end")
Re-order faces of the mesh to put the Dirichlet faces at the position "pos" (=end or start)
Definition BoundaryConditions.cpp:149
const size_t n_dir_edges() const
Returns the number of Dirichlet edges.
Definition BoundaryConditions.hpp:165
const std::string id()
Returns the identifier of the BC.
Definition BoundaryConditions.hpp:175
const size_t n_dir_faces() const
Returns the number of Dirichlet faces.
Definition BoundaryConditions.hpp:160
Class to describe a mesh.
Definition MeshND.hpp:17
@ Matrix
Definition basis.hpp:67
std::string bc_id
Definition HHO_DiffAdvecReac.hpp:44
Definition ddr-magnetostatics.hpp:41
MeshND::VectorRd< 2 > VectorRd
Definition Mesh2D.hpp:14
Structure to define a flat convex hull (nodes and normal) and check if a mesh entity is inside.
Definition BoundaryConditions.hpp:84
VectorRd center
"Center" of the hull
Definition BoundaryConditions.hpp:101
bool is_in(const MeshEntity &E) const
Check if a mesh entity is in the convex hull.
Definition BoundaryConditions.hpp:110
VectorRd apex
A point outside the plane of the convex hull (in the direction of normal)
Definition BoundaryConditions.hpp:102
bool is_in(const Vertex &V) const
Check if a vertex is in the convex hull.
Definition BoundaryConditions.hpp:107
VectorRd normal
Normal to the planar convex hull.
Definition BoundaryConditions.hpp:100
Hull(const std::vector< VectorRd > &nodes, const VectorRd &normal)
Constructor.
Definition BoundaryConditions.hpp:86
std::vector< VectorRd > nodes
Nodes defining the planar convex hull.
Definition BoundaryConditions.hpp:99
bool is_in(const VectorRd &x) const
Check if a point is in the convex hull.
Definition BoundaryConditions.cpp:26
Structure to define a plane (by a point and a normal) and check position of a mesh entity with respec...
Definition BoundaryConditions.hpp:43
bool is_on_side(const MeshEntity &E, const double &side) const
Check if a mesh entity is on one side of the plane (side=+/-1 depending on the normal to the plane)
Definition BoundaryConditions.hpp:74
bool is_in(const MeshEntity &E) const
Check if a mesh entity is inside the plane.
Definition BoundaryConditions.hpp:61
bool is_on_side(const Vertex &V, const double &side) const
Check if a vertex is on one side of the plane (side=+/-1 depending on the normal to the plane)
Definition BoundaryConditions.hpp:71
VectorRd normal
Normal to the plane.
Definition BoundaryConditions.hpp:53
bool is_in(const Vertex &V) const
Check if a vertex is inside the plane.
Definition BoundaryConditions.hpp:58
bool is_on_side(const VectorRd &x, const double &side) const
Check if a point is on one side of the plane (side=+/-1 depending on the normal to the plane)
Definition BoundaryConditions.cpp:21
bool is_in(const VectorRd &x) const
Check if a point is inside the plane.
Definition BoundaryConditions.cpp:17
VectorRd point
One point on the plane.
Definition BoundaryConditions.hpp:52
Plane(const VectorRd &point, const VectorRd &normal)
Constructor.
Definition BoundaryConditions.hpp:45