19 #include "pism/inverse/functional/IP_L2NormFunctional.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/pism_utilities.hh"
47 for (
int j = ys; j < ys + ym; j++) {
48 for (
int i = xs; i < xs + xm; i++) {
56 for (
unsigned int q = 0; q < Nq; q++) {
58 const double x_qq = x_q[q];
87 for (
int j = ys; j < ys + ym; j++) {
88 for (
int i = xs; i < xs + xm; i++) {
98 for (
unsigned int q = 0; q < Nq; q++) {
100 value += W*a_q[q]*b_q[q];
118 double gradient_e[Nk];
129 for (
int j = ys; j < ys + ym; j++) {
130 for (
int i = xs; i < xs + xm; i++) {
141 for (
unsigned int k = 0;
k < Nk;
k++) {
145 for (
unsigned int q = 0; q < Nq; q++) {
147 const double x_qq = x_q[q];
148 for (
unsigned int k = 0;
k < Nk;
k++) {
176 for (
int j = ys; j < ys + ym; j++) {
177 for (
int i = xs; i < xs + xm; i++) {
185 for (
unsigned int q = 0; q < Nq; q++) {
188 value += W*(x_qq.
u*x_qq.
u + x_qq.
v*x_qq.
v);
216 for (
int j = ys; j < ys + ym; j++) {
217 for (
int i = xs; i < xs + xm; i++) {
227 for (
unsigned int q = 0; q < Nq; q++) {
229 value += W*(a_q[q].
u*b_q[q].
u + a_q[q].
v*b_q[q].
v);
258 for (
int j = ys; j < ys + ym; j++) {
259 for (
int i = xs; i < xs + xm; i++) {
270 for (
unsigned int k = 0;
k < Nk;
k++) {
275 for (
unsigned int q = 0; q < Nq; q++) {
278 for (
unsigned int k = 0;
k < Nk;
k++) {
280 gradient_e[
k].
u += gcommon*x_qq.
u;
281 gradient_e[
k].
v += gcommon*x_qq.
v;
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void set(double c)
Result: v[j] <- c for all j.
void evaluate(const T *x, T *vals, T *dx, T *dy)
Given nodal values, compute the values and partial derivatives at the quadrature points.
void reset(int i, int j)
Initialize the Element to element (i, j) for the purposes of inserting into global residual and Jacob...
void add_contribution(const T *local, T **y_global) const
Add the values of element-local contributions y to the global vector y_global.
void nodal_values(const array::Scalar &x_global, int *result) const
Get nodal values of an integer mask.
int xm
total number of elements to loop over in the x-direction.
int lym
total number local elements in y direction.
int lxm
total number local elements in x direction.
int lxs
x-index of the first local element.
int ym
total number of elements to loop over in the y-direction.
int ys
y-coordinate of the first element to loop over.
int lys
y-index of the first local element.
int xs
x-coordinate of the first element to loop over.
const Germ & chi(unsigned int q, unsigned int k) const
int n_pts() const
Number of quadrature points.
double weight(unsigned int q) const
Weight of the quadrature point q
fem::Q1Element2 m_element
fem::ElementIterator m_element_index
std::shared_ptr< const Grid > m_grid
virtual void valueAt(array::Scalar &x, double *OUTPUT)
Computes the value of the functional at the vector x.
virtual void gradientAt(array::Scalar &x, array::Scalar &gradient)
Computes the gradient of the functional at the vector x.
virtual void dot(array::Scalar &a, array::Scalar &b, double *v)
Computes the inner product .
virtual void gradientAt(array::Vector &x, array::Vector &gradient)
Computes the gradient of the functional at the vector x.
virtual void valueAt(array::Vector &x, double *v)
Computes the value of the functional at the vector x.
virtual void dot(array::Vector &a, array::Vector &b, double *v)
Computes the inner product .
const unsigned int MAX_QUADRATURE_SIZE
void GlobalSum(MPI_Comm comm, double *local, double *result, int count)
double val
Function value.