9 #ifndef CONCEPTS_LAMBDAFORMULA
10 #define CONCEPTS_LAMBDAFORMULA
12 #if __cplusplus >= 201103L
15 #include "elementFormula.hh"
17 #include <type_traits>
19 #if defined(__clang__)
39 template<
int CoordDim>
43 template<
int CoordDim>
46 template<
int Dim>
struct CoordinateTag {};
48 template<
int ParamDim,
int Dim>
50 CoordinateParamT<ParamDim> p,
51 CoordinateTag<ParamDim>,
57 CoordinateParamT<1> p,
61 CoordinateParamT<2> p,
65 CoordinateParamT<3> p,
76 template<
class Derived,
class F>
80 return static_cast<const Derived*
>(
this)->
template impl_<1>(elm,p,t);
83 return static_cast<const Derived*
>(
this)->
template impl_<2>(elm,p,t);
86 return static_cast<const Derived*
>(
this)->
template impl_<3>(elm,p,t);
96 template<
class Derived,
class F>
99 F operator() (detail::CoordinateParamT<1> p,
const Real t=0.)
const {
100 return static_cast<const Derived*
>(
this)->
template impl_<1>(p,t);
102 F operator() (detail::CoordinateParamT<2> p,
const Real t=0.)
const {
103 return static_cast<const Derived*
>(
this)->
template impl_<2>(p,t);
105 F operator() (detail::CoordinateParamT<3> p,
const Real t=0.)
const {
106 return static_cast<const Derived*
>(
this)->
template impl_<3>(p,t);
117 template<
int Dim,
class F = concepts::Real>
118 class LambdaFormula :
119 public BaseLambdaFormula<LambdaFormula<Dim,F>,F> {
122 using FuncT = std::function<F(detail::CoordinateParamT<Dim>)>;
124 template<
class FuncParamT>
125 LambdaFormula(
const FuncParamT& func) : func_(func) {}
127 LambdaFormula* clone()
const {
128 return new LambdaFormula(*
this);
134 template<
int ParamDim>
135 F impl_ (detail::CoordinateParamT<ParamDim> p,
const Real t)
const
139 friend class BaseLambdaFormula<LambdaFormula<Dim,F>,F>;
148 template<
int Dim,
class F = concepts::Real>
149 class LambdaElementFormula :
150 public BaseLambdaElementFormula<LambdaElementFormula<Dim,F>,F> {
153 using FuncT = std::function<F(
155 detail::CoordinateParamT<Dim>)>;
157 template<
class FuncParamT>
158 LambdaElementFormula(
const FuncParamT& func) : func_(func) {}
160 LambdaElementFormula* clone()
const {
161 return new LambdaElementFormula(*
this);
167 template<
int ParamDim>
169 detail::CoordinateParamT<ParamDim> p,
176 friend class BaseLambdaElementFormula<LambdaElementFormula<Dim,F>,F>;
180 #endif // __cplusplus >= 201103L
182 #endif // CONCEPTS_LAMBDAFORMULA