21#include "rheolef/quadrature.h"
22#include "rheolef/reference_element_face_transformation.h"
23#include "rheolef/rheostream.h"
41quadrature_option::family_type
42family_name2type (
string name)
44 for (
size_t i = 0; i < quadrature_option::max_family; ++i) {
45 if (static_family_name[i] == name) {
46 return (quadrature_option::family_type) (i);
49 error_macro (
"unexpected quadrature family name `" << name <<
"'");
50 return quadrature_option::max_family;
53quadrature_option::set_family (
string name)
55 set_family (family_name2type (name));
58quadrature_option::get_family_name()
const
61 "unexpected quadrature family number = " << _family);
62 return static_family_name[_family];
65quadrature_option::name()
const
67 if (get_family() == default_family && get_order() == default_order) {
70 return get_family_name() +
"(" + std::to_string(get_order()) +
")";
73 return get_family_name() +
"(" + std::to_string(
long(get_order())) +
")";
77quadrature_option::reset (
const std::string& name)
81 set_family (default_family);
82 set_order (default_order);
86 string family =
name.substr (0, i);
89 "invalid quadrature name \""<<name<<
"\"; expect e.g. \"gauss(3)\"");
90 string order_str =
name.substr (i1, l1);
91 for (
size_type i = 0; i < order_str.size(); ++i) {
93 check_macro (std::isdigit(order_str[i]) || order_str[i] ==
'-',
94 "invalid quadrature name \""<<name<<
"\"; expect e.g. \"gauss(3)\"");
117 fatal_macro (
"quadrature formula on element type `"
118 << hat_K.
name() <<
"' are not yet implemented.");
128 node[q] = base::operator[](q).x;
150 : _options (q._options),
152 _initialized (q._initialized)
167 return _options.name();
174 _quad[K_type].initialize (hat_K, _options);
175 _initialized [K_type] =
true;
181 if (!_initialized [hat_K.
variant()]) _initialize (hat_K);
182 _quad [hat_K.
variant()].get_nodes (node);
189 if (!_initialized [K_type]) _initialize (hat_K);
190 return _quad[K_type].begin();
197 if (!_initialized [K_type]) _initialize (hat_K);
198 return _quad[K_type].end();
205 if (!_initialized [K_type]) _initialize (hat_K);
206 return _quad[K_type].size();
213 if (!_initialized [K_type]) _initialize (hat_K);
214 return _quad[K_type][q];
220 out << setprecision (numeric_limits<T>::digits10)
222 for (
size_t r = 0; r < x.size(); r++)
223 out << x[r].x <<
"\t" << x[r].w << endl;
230 out <<
"quadrature" << endl
236 out <<
"reference_element " << hat_K.
name() << endl
239 out <<
"end_quadrature" << endl;
248 if (_options.name() !=
"") {
266 return base::data().get_options();
286 quadrature_option qopt = get_options();
287 qopt.set_order (order);
294 quadrature_option qopt = get_options();
295 qopt.set_family (ft);
301#define _RHEOLEF_instanciation(T) \
302template class quadrature_on_geo<Float>; \
303template class quadrature_rep<Float>; \
304template class quadrature<T>; \
305template ostream& operator<< (ostream&, const quadrature_on_geo<T>&); \
306template ostream& operator<< (ostream&, const quadrature_rep<T>&);
#define _RHEOLEF_instanciation(T, M, A)
field::size_type size_type
see the Float page for the full documentation
see the integrate_option page for the full documentation
see the persistent_table page for the full documentation
void initialize(reference_element hat_K, quadrature_option opt)
base::size_type size_type
void get_nodes(Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &node) const
std::vector< weighted_point< T > >::const_iterator const_iterator
const quadrature_rep & operator=(const quadrature_rep< T > &q)
const_iterator begin(reference_element hat_K) const
quadrature_on_geo< T >::size_type size_type
std::array< quadrature_on_geo< T >, reference_element::max_variant > _quad
const_iterator end(reference_element hat_K) const
void get_nodes(reference_element hat_K, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &node) const
std::vector< bool > _initialized
size_type size(reference_element hat_K) const
const weighted_point< T > & operator()(reference_element hat_K, size_type q) const
quadrature_option _options
void _initialize(reference_element hat_K) const
quadrature_rep(quadrature_option opt=quadrature_option())
void reset(const std::string &name)
void set_family(family_type ft)
void set_order(size_type order)
rep::family_type family_type
quadrature(const std::string &name="")
const quadrature_option & get_options() const
see the reference_element page for the full documentation
static const variant_type H
static const variant_type q
static const variant_type e
static const variant_type max_variant
static const variant_type p
variant_type variant() const
static const variant_type T
static const variant_type P
static const variant_type t
see the smart_pointer page for the full documentation
static const char * static_family_name[quadrature_option::max_family+1]
#define error_macro(message)
#define fatal_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
std::ostream & operator<<(std::ostream &os, const catchmark &m)
void load(idiststream &in, Float &p, field &uh)