Loading...
Searching...
No Matches
basis_raw.h
Go to the documentation of this file.
#ifndef _RHEO_BASIS_RAW_H
#define _RHEO_BASIS_RAW_H
#include "rheolef/reference_element.h"
#include "rheolef/point.h"
#include "rheolef/tensor.h"
#include "rheolef/smart_pointer.h"
#include "rheolef/space_constant.h"
#include "rheolef/compiler_eigen.h"
#include "rheolef/rheostream.h"
namespace rheolef {
// ---------------------------------------------------
// rep
// ---------------------------------------------------
template<class T>
class basis_raw_rep {
public:
typedef reference_element::size_type size_type;
typedef T value_type;
typedef space_constant::valued_type valued_type;
basis_raw_rep (std::string name = "");
void reset (std::string& name);
virtual ~basis_raw_rep() {}
// accessors:
virtual std::string family_name() const = 0;
virtual size_type degree() const { return _degree; }
std::string name() const { return family_name() + std::to_string(degree()); }
virtual size_type ndof (reference_element hat_K) const = 0;
virtual bool is_hierarchical() const { return false; }
virtual valued_type valued_tag() const { return space_constant::scalar; }
const std::string& valued() const { return space_constant::valued_name (valued_tag()); }
// evaluate:
virtual void evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<T,Eigen::Dynamic,1>& value) const = 0;
// evaluate the gradient:
virtual void grad_evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& value) const = 0;
void put (std::ostream& os, reference_element hat_K) const;
static basis_raw_rep* make_ptr (std::string name);
// internals:
void _clear() const;
protected:
void _initialize_guard (reference_element hat_K) const;
virtual void _initialize (reference_element hat_K) const = 0;
// data:
size_type _degree;
mutable std::array<bool,
reference_element::max_variant> _have_initialize;
};
// ----------------------------------------------------------------------------
// inlined
// ----------------------------------------------------------------------------
template <class T>
inline
void
basis_raw_rep<T>::_initialize_guard (reference_element hat_K) const
{
if (_have_initialize [hat_K.variant()]) return;
_have_initialize [hat_K.variant()] = true;
_initialize (hat_K);
}
template<class T>
inline
void
basis_raw_rep<T>::_clear() const
{
_have_initialize.fill (false);
}
// ---------------------------------------------------
// interface class
// ---------------------------------------------------
template<class T>
class basis_raw_basic : public smart_pointer<basis_raw_rep<T> > {
public:
// typedefs:
typedef basis_raw_rep<T> rep;
typedef smart_pointer<rep> base;
typedef typename rep::size_type size_type;
typedef typename rep::value_type value_type;
typedef typename rep::valued_type valued_type;
// allocators:
basis_raw_basic (std::string name = "");
void reset (std::string& name);
// accessors:
std::string family_name() const;
size_type degree() const;
std::string name() const;
size_type ndof (reference_element hat_K) const;
bool is_hierarchical() const;
valued_type valued_tag() const;
const std::string& valued() const;
void evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<T,Eigen::Dynamic,1>& value) const;
// evaluate the gradient:
void grad_evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& value) const; // scalar-valued
// output:
void put (std::ostream& os, reference_element hat_K) const;
protected:
// internals:
void _clear() const;
};
typedef basis_raw_basic<Float> basis_raw;
//>basis:
// -----------------------------------------------------------
// inlined
// -----------------------------------------------------------
template<class T>
inline
basis_raw_basic<T>::basis_raw_basic(std::string name)
: base()
{
reset (name);
}
template<class T>
inline
void
basis_raw_basic<T>::_clear() const
{
return base::data()._clear();
}
template<class T>
inline
std::string
basis_raw_basic<T>::family_name() const
{
return base::data().family_name();
}
template<class T>
inline
typename basis_raw_basic<T>::size_type
basis_raw_basic<T>::degree() const
{
return base::data().degree();
}
template<class T>
inline
std::string
basis_raw_basic<T>::name() const
{
return base::data().name();
}
template<class T>
inline
typename basis_raw_basic<T>::size_type
basis_raw_basic<T>::ndof (reference_element hat_K) const
{
return base::data().ndof (hat_K);
}
template<class T>
inline
bool
basis_raw_basic<T>::is_hierarchical() const
{
return base::data().is_hierarchical();
}
template<class T>
inline
typename basis_raw_basic<T>::valued_type
basis_raw_basic<T>::valued_tag() const
{
return base::data().valued_tag();
}
template<class T>
inline
const std::string&
basis_raw_basic<T>::valued() const
{
return base::data().valued();
}
template<class T>
inline
void
basis_raw_basic<T>::evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<T,Eigen::Dynamic,1>& value) const
{
return base::data().evaluate (hat_K, hat_x, value);
}
template<class T>
inline
void
basis_raw_basic<T>::grad_evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& value) const
{
base::data().grad_evaluate (hat_K, hat_x, value);
}
template<class T>
inline
void
basis_raw_basic<T>::put (std::ostream& os, reference_element hat_K) const
{
base::data().put (os, hat_K);
}
}// namespace rheolef
#endif // _RHEO_BASIS_RAW_H
rheolef::basis_raw_basic
Definition basis_raw.h:107
rheolef::basis_raw_basic::name
std::string name() const
Definition basis_raw.h:191
rheolef::basis_raw_basic::valued_tag
valued_type valued_tag() const
Definition basis_raw.h:212
rheolef::basis_raw_basic::value_type
rep::value_type value_type
Definition basis_raw.h:115
rheolef::basis_raw_basic::ndof
size_type ndof(reference_element hat_K) const
Definition basis_raw.h:198
rheolef::basis_raw_basic::evaluate
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &value) const
Definition basis_raw.h:226
rheolef::basis_raw_basic::valued_type
rep::valued_type valued_type
Definition basis_raw.h:116
rheolef::basis_raw_basic::base
smart_pointer< rep > base
Definition basis_raw.h:113
rheolef::basis_raw_basic::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.h:236
rheolef::basis_raw_basic::degree
size_type degree() const
Definition basis_raw.h:184
rheolef::basis_raw_basic::put
void put(std::ostream &os, reference_element hat_K) const
Definition basis_raw.h:246
rheolef::basis_raw_basic::is_hierarchical
bool is_hierarchical() const
Definition basis_raw.h:205
rheolef::basis_raw_basic::size_type
rep::size_type size_type
Definition basis_raw.h:114
rheolef::basis_raw_basic::valued
const std::string & valued() const
Definition basis_raw.h:219
rheolef::basis_raw_basic::family_name
std::string family_name() const
Definition basis_raw.h:177
rheolef::basis_raw_basic::rep
basis_raw_rep< T > rep
Definition basis_raw.h:112
rheolef::basis_raw_basic::basis_raw_basic
basis_raw_basic(std::string name="")
Definition basis_raw.h:162
rheolef::basis_raw_basic::reset
void reset(std::string &name)
Definition basis_get.cc:150
rheolef::basis_raw_basic::_clear
void _clear() const
Definition basis_raw.h:170
rheolef::basis_raw_rep
Definition basis_raw.h:36
rheolef::basis_raw_rep::_have_initialize
std::array< bool, reference_element::max_variant > _have_initialize
Definition basis_raw.h:82
rheolef::basis_raw_rep::ndof
virtual size_type ndof(reference_element hat_K) const =0
rheolef::basis_raw_rep::family_name
virtual std::string family_name() const =0
rheolef::basis_raw_rep::name
std::string name() const
Definition basis_raw.h:49
rheolef::basis_raw_rep::value_type
T value_type
Definition basis_raw.h:39
rheolef::basis_raw_rep::valued_tag
virtual valued_type valued_tag() const
Definition basis_raw.h:52
rheolef::basis_raw_rep::degree
virtual size_type degree() const
Definition basis_raw.h:48
rheolef::basis_raw_rep::size_type
reference_element::size_type size_type
Definition basis_raw.h:38
rheolef::basis_raw_rep::valued_type
space_constant::valued_type valued_type
Definition basis_raw.h:40
rheolef::basis_raw_rep::make_ptr
static basis_raw_rep * make_ptr(std::string name)
Definition basis_raw_list.cc:31
rheolef::basis_raw_rep::grad_evaluate
virtual void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &value) const =0
rheolef::basis_raw_rep::_degree
size_type _degree
Definition basis_raw.h:80
rheolef::basis_raw_rep::evaluate
virtual void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &value) const =0
rheolef::basis_raw_rep::~basis_raw_rep
virtual ~basis_raw_rep()
Definition basis_raw.h:44
rheolef::basis_raw_rep::is_hierarchical
virtual bool is_hierarchical() const
Definition basis_raw.h:51
rheolef::basis_raw_rep::put
void put(std::ostream &os, reference_element hat_K) const
Definition basis_raw_visu_gnuplot.cc:30
rheolef::basis_raw_rep::valued
const std::string & valued() const
Definition basis_raw.h:53
rheolef::basis_raw_rep::reset
void reset(std::string &name)
rheolef::basis_raw_rep::_clear
void _clear() const
Definition basis_raw.h:99
rheolef::basis_raw_rep::_initialize_guard
void _initialize_guard(reference_element hat_K) const
Definition basis_raw.h:90
rheolef::basis_raw_rep::_initialize
virtual void _initialize(reference_element hat_K) const =0
rheolef::point_basic
Definition point.h:86
rheolef::reference_element
see the reference_element page for the full documentation
Definition reference_element.h:66
rheolef::reference_element::max_variant
static const variant_type max_variant
Definition reference_element.h:82
rheolef::reference_element::variant
variant_type variant() const
Definition reference_element.h:99
rheolef::reference_element::size_type
std::vector< int >::size_type size_type
Definition reference_element.h:71
rheolef::smart_pointer
see the smart_pointer page for the full documentation
Definition smart_pointer.h:351
rheolef::basis_raw
basis_raw_basic< Float > basis_raw
Definition basis_raw.h:155
T
Expr1::float_type T
Definition field_expr.h:230
rheolef::space_constant::valued_type
valued_type
Definition space_constant.h:133
rheolef::space_constant::scalar
@ scalar
Definition space_constant.h:134
rheolef::space_constant::valued_name
const std::string & valued_name(valued_type valued_tag)
Definition space_constant.cc:43
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39