tIP_L2NormFunctional.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tIP_L2NormFunctional.hh (2800B)
---
1 // Copyright (C) 2012, 2014, 2015 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 "IPFunctional.hh"
23
24 namespace pism {
25 namespace inverse {
26
27 //! Implements a functional corresponding to (the square of) an \f$L^2\f$ norm of a scalar valued function.
28 /*! The functional is, in continuous terms
29 \f[
30 J(f) = \int_{\Omega} f^2 \; dA
31 \f]
32 where \f$\Omega\f$ is the square domain. Numerically it is implemented using
33 Q1 finite elements.
34 */
35 class IP_L2NormFunctional2S : public IPInnerProductFunctional<IceModelVec2S> {
36 public:
37 IP_L2NormFunctional2S(IceGrid::ConstPtr grid) : IPInnerProductFunctional<IceModelVec2S>(grid) {};
38 virtual ~IP_L2NormFunctional2S() {};
39
40 virtual void valueAt(IceModelVec2S &x, double *OUTPUT);
41 virtual void dot(IceModelVec2S &a, IceModelVec2S &b, double *v);
42 virtual void gradientAt(IceModelVec2S &x, IceModelVec2S &gradient);
43
44 private:
45 IP_L2NormFunctional2S(IP_L2NormFunctional2S const &);
46 IP_L2NormFunctional2S & operator=(IP_L2NormFunctional2S const &);
47 };
48
49 //! Implements a functional corresponding to (the square of) an \f$L^2\f$ norm of a vector valued function.
50 /*! The functional is, in continuous terms
51 \f[
52 J(f) = \int_{\Omega} f^2 \; dA
53 \f]
54 where \f$\Omega\f$ is the square domain. Numerically it is implemented using
55 Q1 finite elements.
56 */
57 class IP_L2NormFunctional2V : public IPInnerProductFunctional<IceModelVec2V> {
58 public:
59 IP_L2NormFunctional2V(IceGrid::ConstPtr grid) : IPInnerProductFunctional<IceModelVec2V>(grid) {};
60 virtual ~IP_L2NormFunctional2V() {};
61
62 virtual void valueAt(IceModelVec2V &x, double *v);
63 virtual void dot(IceModelVec2V &a, IceModelVec2V &b, double *v);
64 virtual void gradientAt(IceModelVec2V &x, IceModelVec2V &gradient);
65
66 private:
67 IP_L2NormFunctional2V(IP_L2NormFunctional2V const &);
68 IP_L2NormFunctional2V & operator=(IP_L2NormFunctional2V const &);
69 };
70
71 } // end of namespace inverse
72 } // end of namespace pism
73
74 #endif /* end of include guard: IP_L2NORMFUNCTIONAL_HH_BSVF8BMQ */