9#include <kernel/cubature/rule.hpp>
20 bool variadic_ = Driver_::variadic>
21 class DriverFactoryAliasMapper;
44 template<
typename>
class Driver_,
46 bool variadic_ = Driver_<Shape_>::variadic>
55 template<
typename>
class Driver_,
60 typedef Driver_<Shape_> DriverType;
61 typedef Shape_ ShapeType;
62 static constexpr bool variadic =
false;
63 static constexpr int num_points = DriverType::num_points;
79 template<
typename Weight_,
typename Coord_,
typename Po
int_>
83 DriverType::fill(rule);
103 template<
typename Weight_,
typename Coord_,
typename Po
int_>
107 Intern::DriverFactoryAliasMapper<DriverType> mapper(name);
108 DriverType::alias(mapper);
109 String mapped_name(mapper.name());
124 return DriverType::name();
130 template<
typename Functor_>
131 static void alias(Functor_& functor)
133 DriverType::alias(functor);
143 template<
typename>
class Driver_,
148 typedef Driver_<Shape_> DriverType;
149 typedef Shape_ ShapeType;
150 static constexpr bool variadic =
true;
151 static constexpr int min_points = DriverType::min_points;
152 static constexpr int max_points = DriverType::max_points;
159 _num_points(num_points)
161 XASSERT(num_points >= DriverType::min_points);
162 XASSERT(num_points <= DriverType::max_points);
171 template<
typename Weight_,
typename Coord_,
typename Po
int_>
174 return create(rule, _num_points);
186 template<
typename Weight_,
typename Coord_,
typename Po
int_>
189 if((num_points < DriverType::min_points) || (num_points > DriverType::max_points))
193 (DriverType::name() +
":" +
stringify(num_points)));
194 DriverType::fill(rule, num_points);
214 template<
typename Weight_,
typename Coord_,
typename Po
int_>
218 Intern::DriverFactoryAliasMapper<DriverType> mapper(name);
219 DriverType::alias(mapper);
220 String mapped_name(mapper.name());
223 String::size_type k = mapped_name.find_first_of(
':');
224 if(k == mapped_name.npos)
228 String head(mapped_name.substr(0, k));
229 String tail(mapped_name.substr(k + 1));
241 return create(rule, num_points);
249 return DriverType::name();
255 template<
typename Functor_>
256 static void alias(Functor_& functor)
258 DriverType::alias(functor);
265 template<
typename Driver_>
266 class DriverFactoryAliasMapper<Driver_, false>
273 explicit DriverFactoryAliasMapper(
const String& name_in) :
279 void alias(
const String& alias_name)
285 _name = Driver_::name();
297 template<
typename Driver_>
298 class DriverFactoryAliasMapper<Driver_, true>
305 explicit DriverFactoryAliasMapper(
const String& name_in) :
311 void alias(
const String& alias_name,
int num_points)
315 if(_name.compare_no_case(alias_name) == 0)
317 _name = Driver_::name() +
":" +
stringify(num_points);
#define XASSERT(expr)
Assertion macro definition.
static bool create(Rule< Shape_, Weight_, Coord_, Point_ > &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.
static bool create(Rule< Shape_, Weight_, Coord_, Point_ > &rule)
Creates the cubature rule.
static String name()
Returns the name of the cubature rule.
static bool create(Rule< Shape_, Weight_, Coord_, Point_ > &rule, const String &name)
Creates the cubature rule from a string.
static bool create(Rule< Shape_, Weight_, Coord_, Point_ > &rule, int num_points)
Creates the cubature rule.
bool create(Rule< Shape_, Weight_, Coord_, Point_ > &rule)
Creates the cubature rule.
static void alias(Functor_ &functor)
Calls the driver's alias function.
Scalar Cubature Driver-Factory class template.
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.