Rheolef  7.1
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
rheolef::space_numbering::ndof
size_type ndof(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
Definition: space_numbering.cc:28
rheolef::reference_element::n_node
static size_type n_node(variant_type variant, size_type order)
Definition: reference_element.cc:201
rheolef::point_basic
Definition: point.h:87
rheolef::basis_raw_dubiner::basis_raw_dubiner
basis_raw_dubiner(std::string name)
Definition: basis_raw_dubiner.cc:36
rheolef::basis_raw_dubiner::size_type
base::size_type size_type
Definition: basis_raw_dubiner.h:41
basis_raw_dubiner.h
rheolef::_RHEOLEF_instanciation
_RHEOLEF_instanciation(Float, sequential, std::allocator< Float >) _RHEOLEF_instanciation(Float
rheolef::value
rheolef::std value
rheolef::basis_raw_dubiner::ndof
size_type ndof(reference_element hat_K) const
Definition: basis_raw_dubiner.cc:53
dubiner.icc
rheolef::basis_raw_dubiner::_initialize
void _initialize(reference_element hat_K) const
Definition: basis_raw_dubiner.cc:59
rheolef::reference_element
see the reference_element page for the full documentation
Definition: reference_element.h:66
rheolef::basis_raw_dubiner::evaluate
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &value) const
Definition: basis_raw_dubiner.cc:67
rheolef::reference_element::variant
variant_type variant() const
Definition: reference_element.h:99
rheolef::basis_raw_dubiner::grad_evaluate
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &value) const
Definition: basis_raw_dubiner.cc:77
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
error_macro
#define error_macro(message)
Definition: dis_macros.h:49
rheolef::basis_raw_rep
Definition: basis_raw.h:36
Float
see the Float page for the full documentation
rheolef::basis_raw_rep::_degree
size_type _degree
Definition: basis_raw.h:80
mkgeo_contraction.name
string name
Definition: mkgeo_contraction.sh:133
basis_ordering.icc
rheolef::basis_raw_dubiner::~basis_raw_dubiner
~basis_raw_dubiner()
Definition: basis_raw_dubiner.cc:32
rheolef::basis_raw_rep::name
std::string name() const
Definition: basis_raw.h:49
T
Expr1::float_type T
Definition: field_expr.h:261