Skip to content

Commit

Permalink
Implement gradient for SplineFunction. (idaholab#3312)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Jul 1, 2014
1 parent 8a967aa commit f027adf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions framework/include/functions/SplineFunction.h
Expand Up @@ -33,6 +33,8 @@ class SplineFunction : public Function
virtual ~SplineFunction();

virtual Real value(Real t, const Point & p);
virtual RealGradient gradient(Real t, const Point & p);

virtual Real derivative(const Point & p);
virtual Real secondDerivative(const Point & p);

Expand Down
8 changes: 8 additions & 0 deletions framework/src/functions/SplineFunction.C
Expand Up @@ -45,6 +45,14 @@ SplineFunction::value(Real /*t*/, const Point & p)
return _ipol.sample(p(0));
}

RealGradient
SplineFunction::gradient(Real /*t*/, const Point & p)
{
RealGradient grad(0.0);
grad(0) = derivative(p);
return grad;
}

Real
SplineFunction::derivative(const Point & p)
{
Expand Down

0 comments on commit f027adf

Please sign in to comment.