9#include <kernel/cubature/scalar/driver_factory.hpp>
10#include <kernel/cubature/rule.hpp>
16 template<
typename ScalarDriver_>
23 template<
typename Weight_,
typename Coord_,
typename Po
int_>
28 int num_points = scalar_rule.get_num_points();
29#ifdef FEAT_CUBATURE_SCALAR_PREFIX
34 for(
int i(0); i < num_points; ++i)
36 rule.get_weight(i) = scalar_rule.get_weight(i) * Weight_(0.5);
37 rule.get_coord(i, 0) = (scalar_rule.get_coord(i) + Coord_(1)) * Coord_(0.5);
41 template<
typename Weight_,
typename Coord_,
typename Po
int_>
46#ifdef FEAT_CUBATURE_SCALAR_PREFIX
48 String::size_type k = name.find_first_of(
':');
53 String head(name.substr(0, k));
54 String tail(name.substr(k + 1));
61 ScalarRuleType scalar_rule;
62 if(!ScalarFactoryType::create(scalar_rule, tail.
trim()))
66 ScalarRuleType scalar_rule;
67 if(!ScalarFactoryType::create(scalar_rule, name))
72 create(rule, scalar_rule);
78#ifdef FEAT_CUBATURE_SCALAR_PREFIX
79 return "scalar:" + ScalarFactoryType::name();
81 return ScalarFactoryType::name();
85 template<
typename Functor_>
86 static void alias(Functor_& functor)
88#ifdef FEAT_CUBATURE_SCALAR_PREFIX
89 AliasScalarPrefixFunctor<Functor_> prefix_functor(functor);
90 ScalarFactoryType::alias(prefix_functor);
92 ScalarFactoryType::alias(functor);
98#ifdef FEAT_CUBATURE_SCALAR_PREFIX
99 template<
typename Functor_>
100 class AliasScalarPrefixFunctor
106 explicit AliasScalarPrefixFunctor(Functor_& functor) :
111 void alias(
const String& name)
113 _functor.alias(
"scalar:" + name);
116 void alias(
const String& name,
int num_points)
118 _functor.alias(
"scalar:" + name, num_points);
126 typename ScalarDriver_,
127 bool variadic_ = ScalarDriver_::variadic>
130 template<
typename ScalarDriver_>
138 static constexpr bool variadic =
false;
139 static constexpr int num_points = ScalarFactoryType::num_points;
146 using BaseClass::create;
148 template<
typename Weight_,
typename Coord_,
typename Po
int_>
153 ScalarFactoryType::create(scalar_rule);
156 create(rule, scalar_rule);
160 template<
typename ScalarDriver_>
168 static constexpr bool variadic =
true;
169 static constexpr int min_points = ScalarFactoryType::min_points;
170 static constexpr int max_points = ScalarFactoryType::max_points;
177 _num_points(num_points)
181 using BaseClass::create;
183 template<
typename Weight_,
typename Coord_,
typename Po
int_>
186 create(rule, _num_points);
189 template<
typename Weight_,
typename Coord_,
typename Po
int_>
194 ScalarFactoryType::create(scalar_rule, num_points);
197 create(rule, scalar_rule);
Cubature Rule class template.
Scalar Cubature Driver-Factory class template.
Scalar Cubature Rule class template.
String class implementation.
int compare_no_case(const String &other) const
Compares two strings without regard to case.
String trim(const String &charset) const
Trims the string.
Simplex shape tag struct template.