Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
basis_raw_dubiner.cc
Go to the documentation of this file.
1
21#include "basis_raw_dubiner.h"
22#include "basis_ordering.icc"
23#include "dubiner.icc"
24
25namespace rheolef {
26using namespace std;
27
28// =========================================================================
29// basis raw dubiner members
30// =========================================================================
31template<class T>
35template<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}
51template<class T>
54{
55 return reference_element::n_node (hat_K.variant(), base::_degree);
56}
57template<class T>
58void
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:
65template<class T>
66void
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}
75template<class T>
76void
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) \
96template class basis_raw_dubiner<T>;
97
99
100}// namespace rheolef
#define _RHEOLEF_instanciation(T, M, A)
Definition asr.cc:223
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)
#define error_macro(message)
Definition dis_macros.h:49
Expr1::float_type T
Definition field_expr.h:230
This file is part of Rheolef.
STL namespace.