19 #include "pism/inverse/functional/IPFunctional.hh"
20 #include "pism/util/Grid.hh"
21 #include "pism/util/array/Vector.hh"
22 #include "pism/util/array/Scalar.hh"
23 #include "pism/util/error_handling.hh"
30 double h = PETSC_SQRT_MACHINE_EPSILON;
41 const int i = p.i(), j = p.j();
57 gradient(i,j) = (Fh-F0)/h;
67 double h = PETSC_SQRT_MACHINE_EPSILON;
78 const int i = p.i(), j = p.j();
94 gradient(i,j).u = (Fh-F0)/h;
110 gradient(i,j).v = (Fh-F0)/h;
PointsWithGhosts points(unsigned int stencil_width=0) const
Describes the PISM grid and the distribution of data across processors.
void failed()
Indicates a failure of a parallel section.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
std::shared_ptr< const Grid > grid() const
void update_ghosts()
Updates ghost points.
virtual void valueAt(IMVecType &x, double *OUTPUT)=0
Computes the value of the functional at the vector x.
void gradientFD(IPFunctional< array::Scalar > &f, array::Scalar &x, array::Scalar &gradient)
Computes finite difference approximations of a IPFunctional<array::Scalar> gradient.