9#include <kernel/cubature/scalar/rule.hpp>
22 bool variadic_ = Driver_::variadic>
23 class DriverFactoryAliasMapper;
44 bool variadic_ = Driver_::variadic>
52 template<
typename Driver_>
56 typedef Driver_ DriverType;
58 static constexpr bool variadic =
false;
59 static constexpr bool tensorize = DriverType::tensorize;
60 static constexpr int num_points = DriverType::num_points;
76 template<
typename Weight_,
typename Coord_>
81 DriverType::fill(rule);
101 template<
typename Weight_,
typename Coord_>
105 Intern::DriverFactoryAliasMapper<DriverType> mapper(name);
106 DriverType::alias(mapper);
107 String mapped_name(mapper.name());
122 return DriverType::name();
128 template<
typename Functor_>
129 static void alias(Functor_& functor)
131 DriverType::alias(functor);
140 template<
typename Driver_>
144 typedef Driver_ DriverType;
146 static constexpr bool variadic =
true;
147 static constexpr bool tensorize = DriverType::tensorize;
148 static constexpr int min_points = DriverType::min_points;
149 static constexpr int max_points = DriverType::max_points;
156 _num_points(num_points)
158 XASSERT(num_points >= DriverType::min_points);
159 XASSERT(num_points <= DriverType::max_points);
168 template<
typename Weight_,
typename Coord_>
171 return create(rule, _num_points);
183 template<
typename Weight_,
typename Coord_>
186 if((num_points < DriverType::min_points) || (num_points > DriverType::max_points))
190 DriverType::fill(rule, num_points);
210 template<
typename Weight_,
typename Coord_>
214 Intern::DriverFactoryAliasMapper<DriverType> mapper(name_in);
215 DriverType::alias(mapper);
216 String mapped_name(mapper.name());
219 String::size_type k = mapped_name.find_first_of(
':');
220 if(k == mapped_name.npos)
224 String head(mapped_name.substr(0, k));
225 String tail(mapped_name.substr(k + 1));
237 return create(rule, num_points);
245 return DriverType::name();
251 template<
typename Functor_>
252 static void alias(Functor_& functor)
254 DriverType::alias(functor);
261 template<
typename Driver_>
262 class DriverFactoryAliasMapper<Driver_, false>
269 explicit DriverFactoryAliasMapper(
const String& name_in) :
275 void alias(
const String& alias_name)
281 _name = Driver_::name();
293 template<
typename Driver_>
294 class DriverFactoryAliasMapper<Driver_, true>
301 explicit DriverFactoryAliasMapper(
const String& name_in) :
307 void alias(
const String& alias_name,
int num_points)
311 if(_name.compare_no_case(alias_name) == 0)
313 _name = Driver_::name() +
":" +
stringify(num_points);
#define XASSERT(expr)
Assertion macro definition.
static bool create(Rule< Weight_, Coord_ > &rule)
Creates the cubature rule.
static bool create(Rule< Weight_, Coord_ > &rule, const String &name)
Creates the cubature rule from a string.
static void alias(Functor_ &functor)
Calls the driver's alias function.
static String name()
Returns the name of the cubature rule.
bool create(Rule< Weight_, Coord_ > &rule)
Creates the cubature rule.
static bool create(Rule< Weight_, Coord_ > &rule, int num_points)
Creates the cubature rule.
static void alias(Functor_ &functor)
Calls the driver's alias function.
static bool create(Rule< Weight_, Coord_ > &rule, const String &name_in)
Creates the cubature rule from a string.
static String name()
Returns the name of the cubature rule.
Scalar Cubature Driver-Factory class template.
Scalar Cubature Rule class template.
String class implementation.
bool parse(T_ &t) const
Parses the string and stores its value in the provided variable.
int compare_no_case(const String &other) const
Compares two strings without regard to case.
String trim(const String &charset) const
Trims the string.
String stringify(const T_ &item)
Converts an item into a String.