Rheolef  7.2
an efficient C++ finite element environment
basis_raw_dubiner.cc
Go to the documentation of this file.
1 #include "basis_raw_dubiner.h"
22 #include "basis_ordering.icc"
23 #include "dubiner.icc"
24 
25 namespace rheolef {
26 using namespace std;
27 
28 // =========================================================================
29 // basis raw dubiner members
30 // =========================================================================
31 template<class T>
33 {
34 }
35 template<class T>
37  : basis_raw_rep<T> (name),
38  _inod2ideg(),
39  _value_ad()
40 {
41  if ((name.length()) > 0 && (name[0] == 'D')) {
42  // TODO: check also that name fits "Dk" where is an k integer
43  base::_degree = atoi(name.c_str()+1);
44  } else if (name.length() > 0) { // missing 'D' !
45  error_macro ("invalid polynomial name `"<<name<<"' for the Dk raw polynomial set");
46  } else {
47  // empty name : default cstor
48  base::_degree = 0;
49  }
50 }
51 template<class T>
54 {
55  return reference_element::n_node (hat_K.variant(), base::_degree);
56 }
57 template<class T>
58 void
60 {
61  build_inod2ideg (hat_K, base::_degree, _inod2ideg[hat_K.variant()]);
62  _value_ad [hat_K.variant()].resize (ndof(hat_K));
63 }
64 // evaluation of all basis functions at hat_x:
65 template<class T>
66 void
68  reference_element hat_K,
69  const point_basic<T>& hat_x,
70  Eigen::Matrix<T,Eigen::Dynamic,1>& value) const
71 {
72  base::_initialize_guard (hat_K);
73  eval_dubiner_basis (hat_x, hat_K, base::_degree, _inod2ideg[hat_K.variant()], value);
74 }
75 template<class T>
76 void
78  reference_element hat_K,
79  const point_basic<T>& hat_x,
80  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& value) const
81 {
82  base::_initialize_guard (hat_K);
83  std::vector<ad3_basic<T> >& value_ad = _value_ad [hat_K.variant()];
84  point_basic<ad3_basic<T> > hat_x_ad = ad3::point (hat_x);
85  eval_dubiner_basis (hat_x_ad, hat_K, base::_degree, _inod2ideg[hat_K.variant()], value_ad);
86  size_t loc_ndof = value_ad.size();
87  value.resize(loc_ndof);
88  for (size_t loc_idof = 0; loc_idof < loc_ndof; loc_idof++) {
89  value[loc_idof] = value_ad[loc_idof].grad();
90  }
91 }
92 // ----------------------------------------------------------------------------
93 // instanciation in library
94 // ----------------------------------------------------------------------------
95 #define _RHEOLEF_instanciation(T) \
96 template class basis_raw_dubiner<T>;
97 
99 
100 }// namespace rheolef
see the Float page for the full documentation
basis_raw_dubiner(std::string name)
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &value) const
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &value) const
size_type ndof(reference_element hat_K) const
void _initialize(reference_element hat_K) const
std::string name() const
Definition: basis_raw.h:49
see the reference_element page for the full documentation
variant_type variant() const
static size_type n_node(variant_type variant, size_type order)
rheolef::std value
#define error_macro(message)
Definition: dis_macros.h:49
Expr1::float_type T
Definition: field_expr.h:230
size_type ndof(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
This file is part of Rheolef.
_RHEOLEF_instanciation(Float, sequential, std::allocator< Float >) _RHEOLEF_instanciation(Float