NiHu  2.0
domain.hpp
Go to the documentation of this file.
1 // This file is a part of NiHu, a C++ BEM template library.
2 //
3 // Copyright (C) 2012-2019 Peter Fiala <fiala@hit.bme.hu>
4 // Copyright (C) 2012-2019 Peter Rucz <rucz@hit.bme.hu>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
22 
23 #ifndef DOMAIN_HPP_INCLUDED
24 #define DOMAIN_HPP_INCLUDED
25 
26 #include "space.hpp"
27 
28 #include <array>
29 #include <string>
30 
31 namespace NiHu
32 {
33 
34 namespace domain_traits
35 {
37  template <class Derived>
38  struct space_type;
39 
41  template <class Derived>
42  struct num_corners;
43 
45  template <class Derived>
46  struct num_edges;
47 
49  template <class Derived>
50  struct volume;
51 
53  template <class Derived>
54  struct id
55  {
56  enum {
58  };
59  };
60 
62  template <class Derived>
63  struct name
64  {
65  static std::string const value;
66  };
67 } // end of namespace domain_traits
68 
70 template <class Derived>
72 {
73 public:
75  typedef Derived type;
78  enum {
86  dimension = space_t::dimension
87  };
89  typedef typename space_t::scalar_t scalar_t;
91  typedef typename space_t::location_t xi_t;
93  typedef std::array<xi_t, num_corners> corners_t;
95  typedef unsigned domain_edge_t[2];
98 
100  static xi_t const &get_center()
101  {
102  return Derived::get_center_impl();
103  }
104 
106  static corners_t const &get_corners()
107  {
108  return Derived::get_corners_impl();
109  }
110 
112  static xi_t const &get_corner(unsigned idx)
113  {
114  return get_corners()[idx];
115  }
116 
118  static edges_t const &get_edges()
119  {
120  return Derived::get_edges_impl();
121  }
122 
124  static domain_edge_t const &get_edge(unsigned idx)
125  {
126  return get_edges()[idx];
127  }
128 
130  static constexpr scalar_t get_volume()
131  {
133  }
134 
136  static std::string const &get_name()
137  {
139  }
140 
142  static constexpr unsigned get_id()
143  {
144  return id;
145  }
146 
147  static xi_t constrain_inside(xi_t const &xi)
148  {
149  return Derived::constrain_inside_impl(xi);
150  }
151 }; // end of class domain_base
152 
153 } // end of namesapce NiHu
154 
155 #endif
156 
NiHu::domain_base::dimension
@ dimension
space dimensions
Definition: domain.hpp:86
space.hpp
declaration of class NiHu::space
NiHu::domain_base::get_edges
static const edges_t & get_edges()
return edges of the domain
Definition: domain.hpp:118
NiHu::domain_base::get_name
static const std::string & get_name()
return domain name
Definition: domain.hpp:136
NiHu::domain_traits::num_edges
defines the number of edges
Definition: domain.hpp:46
NiHu::domain_base::get_center
static const xi_t & get_center()
return domain center
Definition: domain.hpp:100
NiHu::domain_base::space_t
domain_traits::space_type< Derived >::type space_t
the space type as nested typedef
Definition: domain.hpp:77
NiHu::domain_base::get_id
static constexpr unsigned get_id()
return domain id
Definition: domain.hpp:142
NiHu::domain_base::num_corners
@ num_corners
number of domain corners
Definition: domain.hpp:80
NiHu::domain_base::scalar_t
space_t::scalar_t scalar_t
coordinate scalar type
Definition: domain.hpp:89
NiHu::domain_base
Polygonal subset of the space. All elements are defined on a domain.
Definition: domain.hpp:71
NiHu::domain_base::num_edges
@ num_edges
number of domain edges
Definition: domain.hpp:82
NiHu::domain_base::type
Derived type
self-returning
Definition: domain.hpp:75
NiHu::domain_base::get_corner
static const xi_t & get_corner(unsigned idx)
return specified corner of domain
Definition: domain.hpp:112
NiHu::domain_traits::id
Assigns an id to the domain.
Definition: domain.hpp:54
NiHu::domain_traits::num_corners
defines the number of domain corners
Definition: domain.hpp:42
NiHu::domain_traits::name
Assigns a textual id the domain.
Definition: domain.hpp:63
NiHu::domain_base::get_volume
static constexpr scalar_t get_volume()
return domain volume
Definition: domain.hpp:130
NiHu::domain_traits::volume
Defines the domain's size (volume)
Definition: domain.hpp:50
NiHu::domain_traits::space_type
assigns a coordinate space to the domain
Definition: domain.hpp:38
NiHu::domain_base::id
@ id
domain id as nested enum
Definition: domain.hpp:84
NiHu::domain_base::xi_t
space_t::location_t xi_t
coordinate vector type
Definition: domain.hpp:91
NiHu::domain_base::edges_t
domain_edge_t edges_t[num_edges]
type of edges array
Definition: domain.hpp:97
NiHu::domain_base::corners_t
std::array< xi_t, num_corners > corners_t
type of corners array
Definition: domain.hpp:93
NiHu::domain_base::domain_edge_t
unsigned domain_edge_t[2]
type of a domain edge
Definition: domain.hpp:95
NiHu::domain_base::get_corners
static const corners_t & get_corners()
return begin address of domain corners' array
Definition: domain.hpp:106
NiHu::domain_base::get_edge
static const domain_edge_t & get_edge(unsigned idx)
return specified edge of domain
Definition: domain.hpp:124