HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
BoundaryConditions.hpp
Go to the documentation of this file.
1 // Class to provide description of boundary conditions
2 //
3 //
4 // Author: Jerome Droniou (jerome.droniou@monash.edu)
5 //
6 
7 /*
8  *
9  * This library was developed around HHO methods, although some parts of it have a more
10  * general purpose. If you use this code or part of it in a scientific publication,
11  * please mention the following book as a reference for the underlying principles
12  * of HHO schemes:
13  *
14  * The Hybrid High-Order Method for Polytopal Meshes: Design, Analysis, and Applications.
15  * D. A. Di Pietro and J. Droniou. 2019, 516p.
16  * url: https://hal.archives-ouvertes.fr/hal-02151813.
17  *
18  */
19 
20 
21 #ifndef _BOUNDARY_CONDITIONS_HPP
22 #define _BOUNDARY_CONDITIONS_HPP
23 
24 #include <iostream>
25 #include <string>
26 #include <mesh.hpp>
27 
28 using namespace HArDCore2D;
29 
35 // ----------------------------------------------------------------------------
36 // Class definition
37 // ----------------------------------------------------------------------------
38 
46 
47 public:
50  const std::string bc_id,
51  Mesh& mesh
52  );
53 
55  const std::string type(
56  const Edge& edge
57  ) const ;
65  const std::string type(
66  const Vertex& vertex
67  ) const ;
68 
70  inline const size_t n_dir_edges() const {
71  return m_n_dir_edges;
72  };
73 
75  inline const size_t n_dir_vertices() const {
76  return m_n_dir_vertices;
77  };
78 
80  inline const std::string name() const {
81  if (m_bc_id == "D"){
82  return "Dirichlet";
83  }else if (m_bc_id == "N"){
84  return "Neumann";
85  }else if (m_bc_id == "M0"){
86  return "Mixed #0";
87  }
88  std::cout << "Unknown boundary conditions: " << m_bc_id << "\n";
89  exit(1);
90  };
91 
93  void reorder_edges(const std::string pos = "end");
94 
96  void reorder_vertices(const std::string pos = "end");
97 
98 private:
99  // Parameters: id of boundary condition, reference to mesh
100  const std::string m_bc_id;
101  Mesh& m_mesh;
102 
103  // Number of Dirichlet edges and vertices
104  size_t m_n_dir_edges;
105  size_t m_n_dir_vertices;
106 
107 };
108 
109 
111 
112 #endif //_BOUNDARY_CONDITION_HPP
The BoundaryConditions class provides definition of boundary conditions.
Definition: BoundaryConditions.hpp:45
const size_t n_dir_vertices() const
Returns the number of Dirichlet vertices.
Definition: BoundaryConditions.hpp:75
const std::string name() const
Returns the complete name of the boundary condition.
Definition: BoundaryConditions.hpp:80
const size_t n_dir_edges() const
Returns the number of Dirichlet edges.
Definition: BoundaryConditions.hpp:70
Definition: Mesh2D.hpp:26
std::string bc_id
Definition: HHO_DiffAdvecReac.hpp:44
Polytope< 1 > Edge
A Face is a Polytope with object_dim = DIMENSION - 1.
Definition: Polytope2D.hpp:147
Polytope< 0 > Vertex
An Edge is a Polytope with object_dim = 1.
Definition: Polytope2D.hpp:144
Definition: ddr-klplate.hpp:27