193#include "rheolef/reference_element.h"
194#include "rheolef/reference_element_face_transformation.h"
195#include "rheolef/point.h"
196#include "rheolef/tensor.h"
197#include "rheolef/persistent_table.h"
198#include "rheolef/space_constant.h"
199#include "rheolef/basis_raw.h"
200#include "rheolef/basis_option.h"
201#include "rheolef/piola_fem.h"
202#include <unordered_map>
206template<
class T>
class basis_basic;
294 Eigen::Matrix<size_type,Eigen::Dynamic,1>&
loc_idof)
const;
297 virtual const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
vdm (
reference_element hat_K)
const;
309#define _RHEOLEF_evaluate(MEMBER,VALUED,VALUE) \
313 reference_element hat_K, \
314 const point_basic<T>& hat_x, \
315 Eigen::Matrix<VALUE,Eigen::Dynamic,1>& value) const \
317 error_macro ("basis \""<<name()<<"\": " \
318 << VALUED << "-valued " << #MEMBER \
319 << "() member not implemented"); \
332#undef _RHEOLEF_evaluate
334#define _RHEOLEF_evaluate_on_side(VALUED,VALUE) \
338 reference_element tilde_K, \
339 const side_information_type& sid, \
340 const point_basic<T>& hat_x, \
341 Eigen::Matrix<VALUE,Eigen::Dynamic,1>& value) const \
343 error_macro ("basis \""<<name()<<"\": " \
344 << VALUED << "-valued evaluate_on_side() member not implemented"); \
349#undef _RHEOLEF_evaluate_on_side
351#define _RHEOLEF_compute_dofs(VALUED,VALUE) \
355 reference_element hat_K, \
356 const Eigen::Matrix<VALUE,Eigen::Dynamic,1>& f_xnod, \
357 Eigen::Matrix<T,Eigen::Dynamic,1>& dof) const \
359 error_macro ("basis \"" << name() << "\": " \
360 << VALUED << "-valued _compute_dofs() member not implemented"); \
366#undef _RHEOLEF_compute_dofs
426 mutable std::array<
bool,
452const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&
455 error_macro (
"basis \""<<name()<<
"\": hat_node() member not implemented");
456 static const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1> _dummy;
461const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
464 error_macro (
"basis \""<<name()<<
"\": vdm() member not implemented");
465 static const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> _dummy;
470const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
473 error_macro (
"basis \""<<name()<<
"\": inv_vdm() member not implemented");
474 static const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> _dummy;
485 error_macro (
"basis \""<<name()<<
"\": local_ndof_on_side() member not implemented");
return 0;
493 Eigen::Matrix<size_type,Eigen::Dynamic,1>& loc_idof)
const
495 error_macro (
"basis \""<<name()<<
"\": local_idof_on_side() member not implemented");
514template <
class T,
class Function>
517 is_scalar<typename function_traits<Function>::result_type>::value
524 Eigen::Matrix<T,Eigen::Dynamic,1>& dof)
528 "interpolate: incompatible scalar-valued function and "<<b.valued()<<
"-valued basis");
529 const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& hat_node = b.hat_node (hat_K);
531 Eigen::Matrix<T,Eigen::Dynamic,1> f_xnod (hat_node.size());
532 for (
size_type loc_inod = 0, loc_nnod = hat_node.size(); loc_inod < loc_nnod; ++loc_inod) {
533 f_xnod [loc_inod] =
f (hat_node [loc_inod]);
535 b._compute_dofs (hat_K, f_xnod, dof);
537template <
class T,
class Function>
540 is_point<typename function_traits<Function>::result_type>::value
547 Eigen::Matrix<T,Eigen::Dynamic,1>& dof)
551 "interpolate: incompatible vector-valued function and "<<b.valued()<<
"-valued basis");
552 const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& hat_node = b.hat_node (hat_K);
554 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1> f_xnod (hat_node.size());
555 for (
size_type loc_inod = 0, loc_nnod = hat_node.size(); loc_inod < loc_nnod; ++loc_inod) {
556 f_xnod [loc_inod] =
f (hat_node [loc_inod]);
558 b._compute_dofs (hat_K, f_xnod, dof);
589 std::string
name()
const;
603 const std::string&
valued()
const;
613 Eigen::Matrix<size_type,Eigen::Dynamic,1>& loc_idof)
const;
626 template<
class Value>
630 Eigen::Matrix<Value,Eigen::Dynamic,1>& value)
const;
633 template<
class Value>
638 Eigen::Matrix<Value,Eigen::Dynamic,1>& value)
const;
641 template<
class Value>
645 Eigen::Matrix<Value,Eigen::Dynamic,1>& value)
const;
651 template <
class Function>
655 Eigen::Matrix<T,Eigen::Dynamic,1>& dofs)
const;
657 template <
class Value>
660 const Eigen::Matrix<Value,Eigen::Dynamic,1>& f_xnod,
661 Eigen::Matrix<T,Eigen::Dynamic,1>& dof)
const;
702 return base::data()._clear();
709 return base::data().family_name();
716 return base::data().family_index();
723 return base::data().name();
730 return base::data().degree();
737 return base::data().ndof (hat_K);
744 return base::data().nnod (hat_K);
751 return base::data().option();
765 return base::data().is_discontinuous();
772 return base::data().is_nodal();
779 return base::data().have_continuous_feature();
786 return base::data().have_compact_support_inside_element();
793 return base::data().size();
800 return base::data().is_hierarchical();
807 error_macro (
"basis \""<<name()<<
"\": invalid basis indexation [i_comp]");
815 return base::data().operator[] (i_comp);
829 return base::data().valued_tag();
836 return base::data().get_piola_fem();
843 return base::data().valued();
850 return base::data().ndof_on_subgeo (map_dim, subgeo_variant);
857 return base::data().nnod_on_subgeo (map_dim, subgeo_variant);
864 return base::data().first_idof_by_dimension (hat_K, dim);
871 return base::data().first_inod_by_dimension (hat_K, dim);
878 return base::data().ndof_on_subgeo_internal (map_dim, subgeo_variant);
885 return base::data().nnod_on_subgeo_internal (map_dim, subgeo_variant);
892 return base::data().first_idof_by_dimension_internal (hat_K, dim);
899 return base::data().first_inod_by_dimension_internal (hat_K, dim);
903const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
906 return base::data().vdm(hat_K);
910const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
913 return base::data().inv_vdm(hat_K);
922 Eigen::Matrix<Value,Eigen::Dynamic,1>& value)
const
924 base::data().evaluate (hat_K, hat_x, value);
934 Eigen::Matrix<Value,Eigen::Dynamic,1>& value)
const
936 base::data().evaluate_on_side (tilde_K, sid, hat_x, value);
945 Eigen::Matrix<Value,Eigen::Dynamic,1>& value)
const
947 base::data().grad_evaluate (hat_K, hat_x, value);
950template <
class Function>
956 Eigen::Matrix<T,Eigen::Dynamic,1>& dof)
const
966 const Eigen::Matrix<Value,Eigen::Dynamic,1>& f_xnod,
967 Eigen::Matrix<T,Eigen::Dynamic,1>& dof)
const
969 base::data()._compute_dofs (hat_K, f_xnod, dof);
973const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&
976 return base::data().hat_node (hat_K);
983 base::data().put (os, hat_K);
990 base::data().put_hat_node (os, hat_K);
999 return base::data().local_ndof_on_side (hat_K, sid);
1007 Eigen::Matrix<size_type,Eigen::Dynamic,1>& loc_idof)
const
1009 base::data().local_idof_on_side (hat_K, sid, loc_idof);
1019 base::data().put_hat_node_on_side (os, hat_K, sid);
#define _RHEOLEF_evaluate_on_side(VALUED, VALUE)
#define _RHEOLEF_compute_dofs(VALUED, VALUE)
#define _RHEOLEF_evaluate(MEMBER, VALUED, VALUE)
field::size_type size_type
bool is_continuous() const
const piola_fem< T > & get_piola_fem() const
size_type ndof(reference_element hat_K) const
bool have_compact_support_inside_element() const
void compute_dofs(reference_element hat_K, const Eigen::Matrix< Value, Eigen::Dynamic, 1 > &f_xnod, Eigen::Matrix< T, Eigen::Dynamic, 1 > &dof) const
rep::value_type value_type
bool have_continuous_feature() const
void evaluate_on_side(reference_element tilde_K, const side_information_type &sid, const point_basic< T > &hat_x, Eigen::Matrix< Value, Eigen::Dynamic, 1 > &value) const
bool is_discontinuous() const
size_type nnod(reference_element hat_K) const
size_type local_ndof_on_side(reference_element hat_K, const side_information_type &sid) const
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & vdm(reference_element hat_K) const
size_type nnod_on_subgeo_internal(size_type map_dim, size_type subgeo_variant) const
size_type family_index() const
void local_idof_on_side(reference_element hat_K, const side_information_type &sid, Eigen::Matrix< size_type, Eigen::Dynamic, 1 > &loc_idof) const
const basis_option & option() const
valued_type valued_tag() const
bool is_initialized() const
void put_hat_node_on_side(std::ostream &os, reference_element hat_K, const side_information_type &sid) const
size_type first_inod_by_dimension(reference_element hat_K, size_type dim) const
basis_basic(std::string name="")
size_type first_idof_by_dimension_internal(reference_element hat_K, size_type dim) const
size_type first_inod_by_dimension_internal(reference_element hat_K, size_type dim) const
rep::valued_type valued_type
void compute_dof(reference_element hat_K, const Function &f, Eigen::Matrix< T, Eigen::Dynamic, 1 > &dofs) const
void put(std::ostream &os, reference_element hat_K) const
size_type first_idof_by_dimension(reference_element hat_K, size_type dim) const
void put_hat_node(std::ostream &os, reference_element hat_K) const
bool is_hierarchical() const
const Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > & hat_node(reference_element hat_K) const
const basis_basic< T > & operator[](size_type i_comp) const
size_type nnod_on_subgeo(size_type map_dim, size_type subgeo_variant) const
const std::string & valued() const
smart_pointer_nocopy< rep > base
std::string family_name() const
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< Value, Eigen::Dynamic, 1 > &value) const
size_type ndof_on_subgeo_internal(size_type map_dim, size_type subgeo_variant) const
void reset_family_index(size_type k)
bool have_index_parameter() const
size_type ndof_on_subgeo(size_type map_dim, size_type subgeo_variant) const
void reset(std::string &name)
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< Value, Eigen::Dynamic, 1 > &value) const
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & inv_vdm(reference_element hat_K) const
see the basis_option page for the full documentation
bool is_continuous() const
bool is_continuous() const
std::array< std::array< size_type,reference_element::max_variant >,4 > _nnod_on_subgeo
std::array< std::array< size_type,reference_element::max_variant >,4 > _ndof_on_subgeo_internal
virtual size_type local_ndof_on_side(reference_element hat_K, const side_information_type &sid) const
std::array< std::array< size_type,5 >,reference_element::max_variant > _first_idof_by_dimension
const piola_fem< T > & get_piola_fem() const
size_type ndof(reference_element hat_K) const
virtual std::string family_name() const =0
virtual bool have_continuous_feature() const
_RHEOLEF_evaluate(evaluate,"scalar", T) _RHEOLEF_evaluate(evaluate
std::array< std::array< size_type,5 >,reference_element::max_variant > _first_inod_by_dimension
virtual size_type size() const
size_type ndof_internal(reference_element hat_K) const
virtual bool have_index_parameter() const
virtual void _initialize_data(reference_element hat_K) const =0
virtual valued_type valued_tag() const
bool is_discontinuous() const
std::array< std::array< size_type,5 >,reference_element::max_variant > _first_idof_by_dimension_internal
size_type first_inod_by_dimension_internal(reference_element hat_K, size_type dim) const
size_type nnod_internal(reference_element hat_K) const
size_type ndof_on_subgeo_internal(size_type map_dim, size_type subgeo_variant) const
size_type first_idof_by_dimension_internal(reference_element hat_K, size_type dim) const
virtual const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & vdm(reference_element hat_K) const
static void _helper_make_discontinuous_ndof_on_subgeo(bool is_continuous, const std::array< std::array< size_type, reference_element::max_variant >, 4 > &nxxx_on_subgeo_internal, std::array< std::array< size_type, reference_element::max_variant >, 4 > &nxxx_on_subgeo)
reference_element::size_type size_type
virtual void local_idof_on_side(reference_element hat_K, const side_information_type &sid, Eigen::Matrix< size_type, Eigen::Dynamic, 1 > &loc_idof) const
piola_fem< T > _piola_fem
const basis_option & option() const
void _initialize_data_guard(reference_element hat_K) const
std::array< bool, reference_element::max_variant > _have_initialize_data
space_constant::valued_type valued_type
void put_hat_node_on_side(std::ostream &os, reference_element hat_K, const side_information_type &sid) const
size_type first_idof_by_dimension(reference_element hat_K, size_type dim) const
virtual bool is_nodal() const =0
std::array< std::array< size_type,reference_element::max_variant >,4 > _ndof_on_subgeo
size_type nnod_on_subgeo(size_type map_dim, size_type subgeo_variant) const
point_basic< T > tensor3_basic< T > scalar
virtual bool have_compact_support_inside_element() const
point_basic< T > virtual _RHEOLEF_compute_dofs("tensor", tensor_basic< T >) void put(std void put_scalar_valued(std::ostream &os, reference_element hat_K) const
size_type nnod(reference_element hat_K) const
size_type ndof_on_subgeo(size_type map_dim, size_type subgeo_variant) const
size_type first_inod_by_dimension(reference_element hat_K, size_type dim) const
static std::string standard_naming(std::string family_name, size_t degree, const basis_option &sopt)
static basis_rep * make_ptr(const std::string &name)
void put_hat_node(std::ostream &os, reference_element hat_K) const
size_type nnod_on_subgeo_internal(size_type map_dim, size_type subgeo_variant) const
virtual size_type family_index() const
virtual const Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > & hat_node(reference_element hat_K) const
std::array< std::array< size_type,5 >,reference_element::max_variant > _first_inod_by_dimension_internal
virtual const class basis_basic< T > & operator[](size_type i_comp) const
virtual void put_vector_valued(std::ostream &os, reference_element hat_K) const
_RHEOLEF_evaluate_on_side("scalar", T) _RHEOLEF_evaluate_on_side("vector"
virtual bool is_hierarchical() const
const std::string & valued() const
virtual void _initialize_cstor_sizes() const =0
std::array< std::array< size_type,reference_element::max_variant >,4 > _nnod_on_subgeo_internal
virtual size_type degree() const =0
_RHEOLEF_compute_dofs("scalar", T) _RHEOLEF_compute_dofs("vector"
virtual const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & inv_vdm(reference_element hat_K) const
static void _helper_initialize_first_ixxx_by_dimension_from_nxxx_on_subgeo(const std::array< std::array< size_type, reference_element::max_variant >, 4 > &_nxxx_on_subgeo, std::array< std::array< size_type, 5 >, reference_element::max_variant > &_first_ixxx_by_dimension)
see the persistent_table page for the full documentation
see the reference_element page for the full documentation
static const variant_type max_variant
size_type dimension() const
variant_type variant() const
std::vector< int >::size_type size_type
basis_basic< Float > basis
see the tensor3 page for the full documentation
see the tensor4 page for the full documentation
see the tensor page for the full documentation
#define error_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
std::enable_if< is_scalar< typenamefunction_traits< Function >::result_type >::value, void >::type compute_dof(const basis_rep< T > &b, reference_element hat_K, const Function &f, Eigen::Matrix< T, Eigen::Dynamic, 1 > &dof)
const std::string & valued_name(valued_type valued_tag)
This file is part of Rheolef.
void put(std::ostream &out, std::string name, const tiny_matrix< T > &a)
void evaluate(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const