Rheolef  7.1
an efficient C++ finite element environment
piola_on_pointset.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_PIOLA_ON_POINTSET_H
2 #define _RHEOLEF_PIOLA_ON_POINTSET_H
23 //
24 // evaluate the Piola transformation on a full pointset,
25 // e.g. a quadrature node set or an interpolation node set:
26 //
27 // F : hat_K ---> K
28 // hat_x +--> x = F(hat_x)
29 //
30 #include "rheolef/geo.h"
31 #include "rheolef/piola.h"
32 #include "rheolef/basis_on_pointset.h"
33 #include "rheolef/integrate_option.h"
34 namespace rheolef {
35 
36 // ----------------------------------------------------------------------------
37 // representation
38 // ----------------------------------------------------------------------------
39 template<class T>
41 public:
43 
44 // allocators:
45 
47 
48 // modifiers:
49 
50  void initialize (
51  const basis_basic<T>& piola_basis,
52  const quadrature<T>& quad,
53  const integrate_option& iopt);
54 
55  void initialize (
56  const basis_basic<T>& piola_basis,
57  const basis_basic<T>& nodal_basis,
58  const integrate_option& iopt);
59 
60 // accessors:
61 
63  bool has_quadrature() const { return _bops.has_quadrature(); }
64  const quadrature<T>& get_quadrature() const { return _bops.get_quadrature(); }
65  const basis_basic<T>& get_nodal_basis() const { return _bops.get_nodal_basis(); }
66  bool ignore_sys_coord() const { return _ignore_sys_coord; }
67 
68  template<class M>
69  const Eigen::Matrix<piola<T>,Eigen::Dynamic,1>&
70  get_piola (const geo_basic<T,M>& omega, const geo_element& K) const;
71 
72  template<class M>
73  const Eigen::Matrix<T,Eigen::Dynamic,1>&
74  get_weight (const geo_basic<T,M>& omega, const geo_element& K) const;
75 
76 protected:
77 // internal:
78 
79  template<class M>
80  void _update (const geo_basic<T,M>& omega, const geo_element& K) const;
81 
82 // data:
83 
86 
87 // working area:
88 
89  mutable std::array<
90  std::string
92  mutable std::array<
93  size_type
95 
96  mutable std::vector<size_type> _dis_inod_K;
97 
98  mutable std::array<
99  Eigen::Matrix<piola<T>,Eigen::Dynamic,1>
101 
102  mutable std::array<
103  Eigen::Matrix<T,Eigen::Dynamic,1>
105 };
106 template<class T>
107 inline
109  : _bops(),
110  _ignore_sys_coord(false),
111  _last_visited_geo(),
112  _last_visited_dis_ie(),
113  _dis_inod_K(),
114  _piola(),
115  _weight()
116 {
117  _last_visited_geo.fill ("");
118  _last_visited_dis_ie.fill (std::numeric_limits<size_type>::max());
119 }
120 template<class T>
121 template<class M>
122 inline
123 const Eigen::Matrix<piola<T>,Eigen::Dynamic,1>&
125 {
126  _update (omega, K);
127  return _piola [K.variant()];
128 }
129 template<class T>
130 template<class M>
131 inline
132 const Eigen::Matrix<T,Eigen::Dynamic,1>&
134 {
135  _update (omega, K);
136  return _weight [K.variant()];
137 }
138 // ----------------------------------------------------------------------------
139 // interface
140 // ----------------------------------------------------------------------------
141 template<class T>
142 class piola_on_pointset: public smart_pointer<piola_on_pointset_rep<T> > {
143 public:
146  typedef typename rep::size_type size_type;
147 
148 // allocators:
149 
151 
152 // modifiers:
153 
154  void initialize (
155  const basis_basic<T>& piola_basis,
156  const quadrature<T>& quad,
157  const integrate_option& iopt);
158 
159  void initialize (
160  const basis_basic<T>& piola_basis,
161  const basis_basic<T>& nodal_basis,
162  const integrate_option& iopt);
163 
164 // accessors:
165 
167  bool has_quadrature() const;
170 
171  template<class M>
172  const Eigen::Matrix<piola<T>,Eigen::Dynamic,1>&
173  get_piola (const geo_basic<T,M>& omega, const geo_element& K) const;
174 
175  template<class M>
176  const Eigen::Matrix<T,Eigen::Dynamic,1>&
177  get_weight (const geo_basic<T,M>& omega, const geo_element& K) const;
178 
179  bool ignore_sys_coord() const { return base::data().ignore_sys_coord(); }
180 };
181 template<class T>
182 inline
184  : base(new_macro(rep))
185 {
186 }
187 template<class T>
188 inline
189 void
191  const basis_basic<T>& piola_basis,
192  const quadrature<T>& quad,
193  const integrate_option& iopt)
194 {
195  base::data().initialize (piola_basis, quad, iopt);
196 }
197 template<class T>
198 inline
199 void
201  const basis_basic<T>& piola_basis,
202  const basis_basic<T>& nodal_basis,
203  const integrate_option& iopt)
204 {
205  base::data().initialize (piola_basis, nodal_basis, iopt);
206 }
207 template<class T>
208 inline
211 {
212  return base::data().get_basis_on_pointset();
213 }
214 template<class T>
215 inline
216 bool
218 {
219  return base::data().has_quadrature();
220 }
221 template<class T>
222 inline
223 const quadrature<T>&
225 {
226  return base::data().get_quadrature();
227 }
228 template<class T>
229 inline
230 const basis_basic<T>&
232 {
233  return base::data().get_nodal_basis();
234 }
235 template<class T>
236 template<class M>
237 inline
238 const Eigen::Matrix<piola<T>,Eigen::Dynamic,1>&
240 {
241  return base::data().get_piola (omega, K);
242 }
243 template<class T>
244 template<class M>
245 inline
246 const Eigen::Matrix<T,Eigen::Dynamic,1>&
248 {
249  return base::data().get_weight (omega, K);
250 }
251 
252 }// namespace rheolef
253 #endif // _RHEOLEF_PIOLA_ON_POINTSET_H
see the geo_element page for the full documentation
Definition: geo_element.h:102
variant_type variant() const
Definition: geo_element.h:161
see the integrate_option page for the full documentation
basis_on_pointset< T > _bops
const basis_on_pointset< T > & get_basis_on_pointset() const
std::array< Eigen::Matrix< T, Eigen::Dynamic, 1 >,reference_element::max_variant > _weight
const quadrature< T > & get_quadrature() const
reference_element::size_type size_type
void initialize(const basis_basic< T > &piola_basis, const quadrature< T > &quad, const integrate_option &iopt)
void _update(const geo_basic< T, M > &omega, const geo_element &K) const
std::array< size_type,reference_element::max_variant > _last_visited_dis_ie
std::array< std::string,reference_element::max_variant > _last_visited_geo
const Eigen::Matrix< piola< T >, Eigen::Dynamic, 1 > & get_piola(const geo_basic< T, M > &omega, const geo_element &K) const
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & get_weight(const geo_basic< T, M > &omega, const geo_element &K) const
std::array< Eigen::Matrix< piola< T >, Eigen::Dynamic, 1 >,reference_element::max_variant > _piola
const basis_basic< T > & get_nodal_basis() const
std::vector< size_type > _dis_inod_K
void initialize(const basis_basic< T > &piola_basis, const basis_basic< T > &nodal_basis, const integrate_option &iopt)
void initialize(const basis_basic< T > &piola_basis, const quadrature< T > &quad, const integrate_option &iopt)
smart_pointer< rep > base
const quadrature< T > & get_quadrature() const
const basis_basic< T > & get_nodal_basis() const
piola_on_pointset_rep< T > rep
const basis_on_pointset< T > & get_basis_on_pointset() const
const Eigen::Matrix< piola< T >, Eigen::Dynamic, 1 > & get_piola(const geo_basic< T, M > &omega, const geo_element &K) const
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & get_weight(const geo_basic< T, M > &omega, const geo_element &K) const
static const variant_type max_variant
std::vector< int >::size_type size_type
see the smart_pointer page for the full documentation
This file is part of Rheolef.