21 template <
typename T=real_t>
22 class gsFunctionWithDerivatives :
public gsFunction<T>
25 const gsFunction<T> *m_values;
26 const gsFunction<T> *m_derivs;
27 const gsFunction<T> *m_deriv2;
30 typedef memory::shared_ptr< gsFunctionWithDerivatives > Ptr;
33 typedef memory::unique_ptr< gsFunctionWithDerivatives > uPtr;
35 gsFunctionWithDerivatives()
41 gsFunctionWithDerivatives(
const gsFunction<T> &func,
const gsFunction<T> &deriv)
46 GISMO_ASSERT(checkDimensions(),
"Dimensions do not fit");
49 gsFunctionWithDerivatives(
const gsFunction<T> &func,
50 const gsFunction<T> &deriv,
51 const gsFunction<T> &deriv2)
56 GISMO_ASSERT(checkDimensions(),
"Dimensions do not fit");
59 void eval_into(
const gsMatrix<T> &u, gsMatrix<T> &result)
const
62 m_values->eval_into(u,result);
65 void deriv_into(
const gsMatrix<T> &u, gsMatrix<T> &result)
const
68 m_derivs->eval_into(u,result);
71 void deriv2_into(
const gsMatrix<T> &u, gsMatrix<T> &result)
const
74 m_deriv2->eval_into(u,result);
77 gsMatrix<T> laplacian(
const gsMatrix<T> &u)
const
80 deriv2_into(u,secDer);
81 return secDer.topRows(m_values->domainDim()).colwise().sum();
84 const gsFunction<T> & getDeriv ()
const
88 const gsFunction<T> & getDeriv2 ()
const
93 const gsFunctionWithDerivatives & piece(
const index_t)
const
99 GISMO_UPTR_FUNCTION_NO_IMPLEMENTATION(gsFunction<T>, clone)
103 return m_values->targetDim();
107 return m_values->domainDim();
127 gsFunctionWithDerivatives(
const gsFunctionWithDerivatives<T> &func);
129 bool checkDimensions()
133 const short_t parDim=m_values->domainDim();
134 const short_t tarDim=m_values->targetDim();
138 ok = ok && m_derivs->domainDim() == parDim;
139 ok = ok && m_derivs->targetDim() == parDim*tarDim;
143 ok = ok && m_deriv2->domainDim() == parDim;
144 ok = ok && m_deriv2->targetDim() == (parDim+1)*parDim*tarDim/2;
#define short_t
Definition: gsConfig.h:35
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Provides declaration of Function abstract interface.