FV3 Bundle
CostJbState.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef OOPS_ASSIMILATION_COSTJBSTATE_H_
12 #define OOPS_ASSIMILATION_COSTJBSTATE_H_
13 
14 #include <memory>
15 #include <boost/noncopyable.hpp>
16 
19 
20 namespace util {
21  class Duration;
22 }
23 
24 namespace oops {
25 
26 // Forward declaration
27  template<typename MODEL> class ControlIncrement;
28  template<typename MODEL> class Increment4D;
29  template<typename MODEL> class State4D;
30  template<typename MODEL> class JqTerm;
31  template<typename MODEL> class JqTermTLAD;
32 
33 // -----------------------------------------------------------------------------
34 
35 /// Jb Cost Function Base Class
36 /*!
37  * The CostJbState is the base class for the Jb term corresponding to the
38  * state part (3D or 4D) of the control variable.
39  */
40 
41 template<typename MODEL> class CostJbState : private boost::noncopyable {
47 
48  public:
49 /// Constructor
51 
52 /// Destructor
53  virtual ~CostJbState() {}
54 
55 /// Initialize Jq computations if needed.
56  virtual JqTerm<MODEL> * initializeJq() const = 0;
57  virtual JqTermTLAD<MODEL> * initializeJqTLAD() const = 0;
58 
59 /// Get increment from state (usually first guess).
60  virtual void computeIncrement(const State4D_ &, const State4D_ &,
61  Increment4D_ &) const = 0;
62 
63 /// Linearize before the linear computations.
64  virtual void linearize(const State4D_ &, const Geometry_ &) = 0;
65 
66 /// Add Jb gradient.
67  virtual void addGradient(const Increment4D_ &, Increment4D_ &, Increment4D_ &) const = 0;
68 
69 /// Finalize \f$ J_b\f$ after the TL run.
70  virtual JqTermTLAD<MODEL> * initializeJqTL() const = 0;
71 
72 /// Initialize \f$ J_b\f$ before the AD run.
73  virtual JqTermTLAD<MODEL> * initializeJqAD(const Increment4D_ &) const = 0;
74 
75 /// Multiply by \f$ B\f$ and \f$ B^{-1}\f$.
76  virtual void Bmult(const Increment4D_ &, Increment4D_ &) const = 0;
77  virtual void Bminv(const Increment4D_ &, Increment4D_ &) const = 0;
78 
79 /// Randomize
80  virtual void randomize(Increment4D_ &) const = 0;
81 
82 /// Create new increment (set to 0).
83  virtual unsigned int nstates() const = 0;
84  virtual Increment_ * newStateIncrement(const unsigned int) const = 0;
85 };
86 
87 // -----------------------------------------------------------------------------
88 
89 } // namespace oops
90 
91 #endif // OOPS_ASSIMILATION_COSTJBSTATE_H_
virtual unsigned int nstates() const =0
Create new increment (set to 0).
virtual ~CostJbState()
Destructor.
Definition: CostJbState.h:53
virtual void computeIncrement(const State4D_ &, const State4D_ &, Increment4D_ &) const =0
Get increment from state (usually first guess).
State4D< MODEL > State4D_
Definition: CostJbState.h:44
virtual void Bmult(const Increment4D_ &, Increment4D_ &) const =0
Multiply by and .
virtual JqTermTLAD< MODEL > * initializeJqAD(const Increment4D_ &) const =0
Initialize before the AD run.
The namespace for the main oops code.
Increment< MODEL > Increment_
Definition: CostJbState.h:42
virtual Increment_ * newStateIncrement(const unsigned int) const =0
ControlIncrement< MODEL > CtrlInc_
Definition: CostJbState.h:43
virtual JqTermTLAD< MODEL > * initializeJqTLAD() const =0
State increment.
Definition: CostJbState.h:28
Four dimensional state.
Definition: CostJbState.h:29
virtual void randomize(Increment4D_ &) const =0
Randomize.
virtual void linearize(const State4D_ &, const Geometry_ &)=0
Linearize before the linear computations.
virtual void Bminv(const Increment4D_ &, Increment4D_ &) const =0
Jb Cost Function Base Class.
Definition: CostJbState.h:41
Increment Class: Difference between two states.
virtual JqTerm< MODEL > * initializeJq() const =0
Initialize Jq computations if needed.
CostJbState()
Constructor.
Definition: CostJbState.h:50
virtual void addGradient(const Increment4D_ &, Increment4D_ &, Increment4D_ &) const =0
Add Jb gradient.
Increment4D< MODEL > Increment4D_
Definition: CostJbState.h:45
virtual JqTermTLAD< MODEL > * initializeJqTL() const =0
Finalize after the TL run.
Geometry< MODEL > Geometry_
Definition: CostJbState.h:46