9#include <kernel/analytic/function.hpp>
23 template<
typename DataType_>
37 static DataType_
eval(DataType_ x);
48 static DataType_
eval(DataType_ x, DataType_ y);
59 static DataType_
eval(DataType_ x, DataType_ y, DataType_ z);
70 static DataType_
der_x(DataType_ x);
81 static DataType_
der_x(DataType_ x, DataType_ y);
92 static DataType_
der_x(DataType_ x, DataType_ y, DataType_ z);
103 static DataType_
der_y(DataType_ x);
114 static DataType_
der_y(DataType_ x, DataType_ y);
125 static DataType_
der_y(DataType_ x, DataType_ y, DataType_ z);
136 static DataType_
der_z(DataType_ x);
147 static DataType_
der_z(DataType_ x, DataType_ y);
158 static DataType_
der_z(DataType_ x, DataType_ y, DataType_ z);
180 static DataType_
der_xx(DataType_ x, DataType_ y);
191 static DataType_
der_xx(DataType_ x, DataType_ y, DataType_ z);
213 static DataType_
der_yy(DataType_ x, DataType_ y);
224 static DataType_
der_yy(DataType_ x, DataType_ y, DataType_ z);
246 static DataType_
der_zz(DataType_ x, DataType_ y);
257 static DataType_
der_zz(DataType_ x, DataType_ y, DataType_ z);
268 static DataType_
der_xy(DataType_ x, DataType_ y);
279 static DataType_
der_xy(DataType_ x, DataType_ y, DataType_ z);
290 static DataType_
der_yx(DataType_ x, DataType_ y);
301 static DataType_
der_yx(DataType_ x, DataType_ y, DataType_ z);
312 static DataType_
der_xz(DataType_ x, DataType_ y, DataType_ z);
323 static DataType_
der_zx(DataType_ x, DataType_ y, DataType_ z);
334 static DataType_
der_yz(DataType_ x, DataType_ y, DataType_ z);
345 static DataType_
der_zy(DataType_ x, DataType_ y, DataType_ z);
353 template<
typename>
class Function_,
357 struct StaticFunctionWrapper;
360 template<
template<
typename>
class Function_,
typename DataType_>
361 struct StaticFunctionWrapper<Function_, DataType_, 1, true>
363 template<
typename Value_,
typename Po
int_>
364 static void eval(Value_& v,
const Point_& x)
366 v = Function_<DataType_>::eval(x[0]);
369 template<
typename Value_,
typename Po
int_>
370 static void grad(Value_& v,
const Point_& x)
372 v[0] = Function_<DataType_>::der_x(x[0]);
375 template<
typename Value_,
typename Po
int_>
376 static void hess(Value_& v,
const Point_& x)
378 v[0][0] = Function_<DataType_>::der_xx(x[0]);
383 template<
template<
typename>
class Function_,
typename DataType_>
384 struct StaticFunctionWrapper<Function_, DataType_, 2, true>
386 template<
typename Value_,
typename Po
int_>
387 static void eval(Value_& v,
const Point_& x)
389 v = Function_<DataType_>::eval(x[0], x[1]);
392 template<
typename Value_,
typename Po
int_>
393 static void grad(Value_& v,
const Point_& x)
395 v[0] = Function_<DataType_>::der_x(x[0], x[1]);
396 v[1] = Function_<DataType_>::der_y(x[0], x[1]);
399 template<
typename Value_,
typename Po
int_>
400 static void hess(Value_& v,
const Point_& x)
402 v[0][0] = Function_<DataType_>::der_xx(x[0], x[1]);
403 v[0][1] = Function_<DataType_>::der_xy(x[0], x[1]);
404 v[1][0] = Function_<DataType_>::der_yx(x[0], x[1]);
405 v[1][1] = Function_<DataType_>::der_yy(x[0], x[1]);
410 template<
template<
typename>
class Function_,
typename DataType_>
411 struct StaticFunctionWrapper<Function_, DataType_, 3, true>
413 template<
typename Value_,
typename Po
int_>
414 static void eval(Value_& v,
const Point_& x)
416 v = Function_<DataType_>::eval(x[0], x[1],x[2]);
419 template<
typename Value_,
typename Po
int_>
420 static void grad(Value_& v,
const Point_& x)
422 v[0] = Function_<DataType_>::der_x(x[0], x[1], x[2]);
423 v[1] = Function_<DataType_>::der_y(x[0], x[1], x[2]);
424 v[2] = Function_<DataType_>::der_z(x[0], x[1], x[2]);
427 template<
typename Value_,
typename Po
int_>
428 static void hess(Value_& v,
const Point_& x)
430 v[0][0] = Function_<DataType_>::der_xx(x[0], x[1], x[2]);
431 v[0][1] = Function_<DataType_>::der_xy(x[0], x[1], x[2]);
432 v[0][2] = Function_<DataType_>::der_xz(x[0], x[1], x[2]);
433 v[1][0] = Function_<DataType_>::der_yx(x[0], x[1], x[2]);
434 v[1][1] = Function_<DataType_>::der_yy(x[0], x[1], x[2]);
435 v[1][2] = Function_<DataType_>::der_yz(x[0], x[1], x[2]);
436 v[2][0] = Function_<DataType_>::der_zx(x[0], x[1], x[2]);
437 v[2][1] = Function_<DataType_>::der_zy(x[0], x[1], x[2]);
438 v[2][2] = Function_<DataType_>::der_zz(x[0], x[1], x[2]);
469 template<
typename>
class Function_,
470 bool can_value_ =
true,
471 bool can_grad_ =
false,
472 bool can_hess_ =
false>
477 static_assert((1 <= domain_dim_) && (domain_dim_ <= 3),
"invalid domain dimension");
485 static constexpr bool can_value = can_value_;
486 static constexpr bool can_grad = can_grad_;
487 static constexpr bool can_hess = can_hess_;
491 StaticWrapperFunction(StaticWrapperFunction&&) {}
494 template<
typename Traits_>
519 Intern::StaticFunctionWrapper<Function_, DataType, domain_dim, can_value_>::eval(val, point);
526 Intern::StaticFunctionWrapper<Function_, DataType, domain_dim, can_grad_>::grad(
grad, point);
533 Intern::StaticFunctionWrapper<Function_, DataType, domain_dim, can_hess_>::hess(
hess, point);
Analytic Function Evaluator base-class template.
Analytic Function interface.
Analytic static function interface class template.
static DataType_ der_xy(DataType_ x, DataType_ y)
Evaluates the second order xy-derivative.
static DataType_ der_y(DataType_ x)
Evaluates the first order y-derivative.
static DataType_ der_zz(DataType_ x, DataType_ y)
Evaluates the second order zz-derivative.
static DataType_ der_zy(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order zy-derivative.
static DataType_ eval(DataType_ x, DataType_ y)
Evaluates the function value.
static DataType_ der_x(DataType_ x, DataType_ y)
Evaluates the first order x-derivative.
static DataType_ der_z(DataType_ x, DataType_ y, DataType_ z)
Evaluates the first order z-derivative.
static DataType_ der_yx(DataType_ x, DataType_ y)
Evaluates the second order yx-derivative.
static DataType_ der_y(DataType_ x, DataType_ y)
Evaluates the first order y-derivative.
static DataType_ der_xx(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order xx-derivative.
static DataType_ eval(DataType_ x, DataType_ y, DataType_ z)
Evaluates the function value.
static DataType_ der_yy(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order yy-derivative.
static DataType_ der_x(DataType_ x, DataType_ y, DataType_ z)
Evaluates the first order x-derivative.
static DataType_ der_z(DataType_ x, DataType_ y)
Evaluates the first order z-derivative.
static DataType_ der_xx(DataType_ x, DataType_ y)
Evaluates the second order xx-derivative.
static DataType_ der_y(DataType_ x, DataType_ y, DataType_ z)
Evaluates the first order y-derivative.
static DataType_ der_zz(DataType_ x)
Evaluates the second order zz-derivative.
static DataType_ der_z(DataType_ x)
Evaluates the first order z-derivative.
static DataType_ der_xz(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order xz-derivative.
static DataType_ der_yx(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order yx-derivative.
static DataType_ der_xy(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order xy-derivative.
static DataType_ eval(DataType_ x)
Evaluates the function value.
static DataType_ der_yy(DataType_ x)
Evaluates the second order yy-derivative.
static DataType_ der_zz(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order zz-derivative.
static DataType_ der_yz(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order yz-derivative.
static DataType_ der_xx(DataType_ x)
Evaluates the second order xx-derivative.
static DataType_ der_yy(DataType_ x, DataType_ y)
Evaluates the second order yy-derivative.
static DataType_ der_zx(DataType_ x, DataType_ y, DataType_ z)
Evaluates the second order zx-derivative.
static DataType_ der_x(DataType_ x)
Evaluates the first order x-derivative.
Analytic Function Evaluator base-class template.
Traits_::PointType PointType
domain point type
Evaluator(const StaticWrapperFunction &)
Constructor.
Traits_::HessianType HessianType
hessian type
Traits_::DataType DataType
coefficient data type
Traits_::GradientType GradientType
gradient type
Traits_::ValueType ValueType
value type
StaticFunction wrapper class template for Analytic::Function interface.
static constexpr int domain_dim
our domain dimension
Analytic::Image::Scalar ImageType
this is always a scalar function
@ value
specifies whether the space should supply basis function values
@ hess
specifies whether the space should supply basis function hessians
@ grad
specifies whether the space should supply basis function gradients
Scalar Function Image tag class.