Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model 2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IP_L2NormFunctional.hh
Go to the documentation of this file.
1// Copyright (C) 2012, 2014, 2015, 2022, 2024 David Maxwell and Constantine Khroulev
2//
3// This file is part of PISM.
4//
5// PISM is free software; you can redistribute it and/or modify it under the
6// terms of the GNU General Public License as published by the Free Software
7// Foundation; either version 3 of the License, or (at your option) any later
8// version.
9//
10// PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13// details.
14//
15// You should have received a copy of the GNU General Public License
16// along with PISM; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19#ifndef IP_L2NORMFUNCTIONAL_HH_BSVF8BMQ
20#define IP_L2NORMFUNCTIONAL_HH_BSVF8BMQ
21
22#include "pism/util/array/Scalar.hh"
23#include "pism/util/array/Vector.hh"
24
25#include "pism/inverse/functional/IPFunctional.hh"
26
27namespace pism {
28namespace inverse {
29
30//! Implements a functional corresponding to (the square of) an \f$L^2\f$ norm of a scalar valued function.
31/*! The functional is, in continuous terms
32 \f[
33 J(f) = \int_{\Omega} f^2 \; dA
34 \f]
35 where \f$\Omega\f$ is the square domain. Numerically it is implemented using
36 Q1 finite elements.
37*/
38class IP_L2NormFunctional2S : public IPInnerProductFunctional<array::Scalar> {
39public:
40 IP_L2NormFunctional2S(std::shared_ptr<const Grid> grid) : IPInnerProductFunctional<array::Scalar>(grid) {};
42
43 virtual void valueAt(array::Scalar &x, double *OUTPUT);
44 virtual void dot(array::Scalar &a, array::Scalar &b, double *v);
45 virtual void gradientAt(array::Scalar &x, array::Scalar &gradient);
46
47private:
50};
51
52//! Implements a functional corresponding to (the square of) an \f$L^2\f$ norm of a vector valued function.
53/*! The functional is, in continuous terms
54 \f[
55 J(f) = \int_{\Omega} f^2 \; dA
56 \f]
57 where \f$\Omega\f$ is the square domain. Numerically it is implemented using
58 Q1 finite elements.
59*/
60class IP_L2NormFunctional2V : public IPInnerProductFunctional<array::Vector> {
61public:
62 IP_L2NormFunctional2V(std::shared_ptr<const Grid> grid) : IPInnerProductFunctional<array::Vector>(grid) {};
64
65 virtual void valueAt(array::Vector &x, double *v);
66 virtual void dot(array::Vector &a, array::Vector &b, double *v);
67 virtual void gradientAt(array::Vector &x, array::Vector &gradient);
68
69private:
72};
73
74} // end of namespace inverse
75} // end of namespace pism
76
77#endif /* end of include guard: IP_L2NORMFUNCTIONAL_HH_BSVF8BMQ */
Abstract base class for IPFunctionals arising from an inner product.
virtual void valueAt(array::Scalar &x, double *OUTPUT)
IP_L2NormFunctional2S(std::shared_ptr< const Grid > grid)
virtual void gradientAt(array::Scalar &x, array::Scalar &gradient)
virtual void dot(array::Scalar &a, array::Scalar &b, double *v)
Computes the inner product .
IP_L2NormFunctional2S & operator=(IP_L2NormFunctional2S const &)
IP_L2NormFunctional2S(IP_L2NormFunctional2S const &)
Implements a functional corresponding to (the square of) an norm of a scalar valued function.
virtual void gradientAt(array::Vector &x, array::Vector &gradient)
virtual void valueAt(array::Vector &x, double *v)
virtual void dot(array::Vector &a, array::Vector &b, double *v)
Computes the inner product .
IP_L2NormFunctional2V(IP_L2NormFunctional2V const &)
IP_L2NormFunctional2V(std::shared_ptr< const Grid > grid)
IP_L2NormFunctional2V & operator=(IP_L2NormFunctional2V const &)
Implements a functional corresponding to (the square of) an norm of a vector valued function.