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;
40 for (
auto p = grid.points(); p; p.next()) {
41 const int i = p.i(), j = p.j();
57 gradient(i,j) = (Fh-F0)/h;
67 double h = PETSC_SQRT_MACHINE_EPSILON;
77 for (
auto p = grid.points(); p; p.next()) {
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;
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.
Abstract base class for functions from ice model vectors to .
void gradientFD(IPFunctional< array::Scalar > &f, array::Scalar &x, array::Scalar &gradient)
Computes finite difference approximations of a IPFunctional<array::Scalar> gradient.