basis_raw_dubiner.cc
Go to the documentation of this file.
#include "basis_raw_dubiner.h"
#include "basis_ordering.icc"
#include "dubiner.icc"
namespace rheolef {
using namespace std;
// =========================================================================
// basis raw dubiner members
// =========================================================================
template<class T>
basis_raw_dubiner<T>::~basis_raw_dubiner()
{
}
template<class T>
basis_raw_dubiner<T>::basis_raw_dubiner (std::string name)
: basis_raw_rep<T> (name),
_inod2ideg(),
_value_ad()
{
if ((name.length()) > 0 && (name[0] == 'D')) {
// TODO: check also that name fits "Dk" where is an k integer
base::_degree = atoi(name.c_str()+1);
} else if (name.length() > 0) { // missing 'D' !
error_macro ("invalid polynomial name `"<<name<<"' for the Dk raw polynomial set");
} else {
// empty name : default cstor
base::_degree = 0;
}
}
template<class T>
typename basis_raw_dubiner<T>::size_type
basis_raw_dubiner<T>::ndof (reference_element hat_K) const
{
return reference_element::n_node (hat_K.variant(), base::_degree);
}
template<class T>
void
basis_raw_dubiner<T>::_initialize (reference_element hat_K) const
{
build_inod2ideg (hat_K, base::_degree, _inod2ideg[hat_K.variant()]);
_value_ad [hat_K.variant()].resize (ndof(hat_K));
}
// evaluation of all basis functions at hat_x:
template<class T>
void
basis_raw_dubiner<T>::evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<T,Eigen::Dynamic,1>& value) const
{
base::_initialize_guard (hat_K);
eval_dubiner_basis (hat_x, hat_K, base::_degree, _inod2ideg[hat_K.variant()], value);
}
template<class T>
void
basis_raw_dubiner<T>::grad_evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& value) const
{
base::_initialize_guard (hat_K);
std::vector<ad3_basic<T> >& value_ad = _value_ad [hat_K.variant()];
point_basic<ad3_basic<T> > hat_x_ad = ad3::point (hat_x);
eval_dubiner_basis (hat_x_ad, hat_K, base::_degree, _inod2ideg[hat_K.variant()], value_ad);
size_t loc_ndof = value_ad.size();
value.resize(loc_ndof);
for (size_t loc_idof = 0; loc_idof < loc_ndof; loc_idof++) {
value[loc_idof] = value_ad[loc_idof].grad();
}
}
// ----------------------------------------------------------------------------
// instanciation in library
// ----------------------------------------------------------------------------
#define _RHEOLEF_instanciation(T) \
template class basis_raw_dubiner<T>;
_RHEOLEF_instanciation(Float)
}// 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
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:218