// Copyright (C) 2012, 2014 David Maxwell // // This file is part of PISM. // // PISM is free software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // PISM is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License // along with PISM; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "IP_H1NormFunctional.hh" PetscErrorCode IP_H1NormFunctional2S::valueAt(IceModelVec2S &x, double *OUTPUT) { PetscErrorCode ierr; // The value of the objective double value = 0; double **x_a; double x_e[FEQuadrature::Nk]; double x_q[FEQuadrature::Nq], dxdx_q[FEQuadrature::Nq], dxdy_q[FEQuadrature::Nq]; ierr = x.get_array(x_a); CHKERRQ(ierr); // Jacobian times weights for quadrature. double JxW[FEQuadrature::Nq]; m_quadrature.getWeightedJacobian(JxW); DirichletData dirichletBC; ierr = dirichletBC.init(m_dirichletIndices); CHKERRQ(ierr); // Loop through all LOCAL elements. int xs = m_element_index.lxs, xm = m_element_index.lxm, ys = m_element_index.lys, ym = m_element_index.lym; for (int i=xs; i