FV3 Bundle
CostTermBase.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_COSTTERMBASE_H_
12 #define OOPS_ASSIMILATION_COSTTERMBASE_H_
13 
14 #include <boost/shared_ptr.hpp>
15 
18 #include "oops/base/PostBase.h"
19 #include "oops/base/PostBaseTLAD.h"
22 #include "oops/interface/State.h"
23 
24 namespace eckit {
25  class Configuration;
26 }
27 
28 namespace oops {
29 
30 // -----------------------------------------------------------------------------
31 
32 /// Base Class for Cost Function Terms
33 /*!
34  * Abstract base class for the terms of the cost function.
35  */
36 
37 template<typename MODEL> class CostTermBase {
41  typedef boost::shared_ptr<PostBase<State_> > PostPtr_;
42  typedef boost::shared_ptr<PostBaseTLAD<MODEL> > PostPtrTLAD_;
43 
44  public:
45 /// Destructor
46  virtual ~CostTermBase() {}
47 
48 /// Initialize before nonlinear model integration.
49  virtual PostPtr_ initialize(const ControlVariable<MODEL> &) const = 0;
51  const Geometry_ &, const eckit::Configuration &) = 0;
52 
53 /// Finalize computation after nonlinear model integration.
54  virtual double finalize(const eckit::Configuration &) const = 0;
55  virtual void finalizeTraj() = 0;
56 
57 /// Initialize before starting the TL run.
58  virtual PostPtrTLAD_ setupTL(const ControlIncrement<MODEL> &) const = 0;
59 
60 /// Initialize before starting the AD run.
61  virtual PostPtrTLAD_ setupAD(boost::shared_ptr<const GeneralizedDepartures>,
62  ControlIncrement<MODEL> &) const = 0;
63 
64 /// Multiply by covariance (or weight) matrix and its inverse.
65  virtual GeneralizedDepartures * multiplyCovar(const GeneralizedDepartures &) const = 0;
66  virtual GeneralizedDepartures * multiplyCoInv(const GeneralizedDepartures &) const = 0;
67 
68 /// Provide new dual space vector (for example a Departure for Jo).
69  virtual GeneralizedDepartures * newDualVector() const = 0;
70 
71 /// Gradient at first guess.
72  virtual GeneralizedDepartures * newGradientFG() const = 0;
73 
74 /// Reset trajectory.
75  virtual void resetLinearization() = 0;
76 };
77 
78 // -----------------------------------------------------------------------------
79 
80 } // namespace oops
81 
82 #endif // OOPS_ASSIMILATION_COSTTERMBASE_H_
virtual PostPtrTLAD_ initializeTraj(const ControlVariable< MODEL > &, const Geometry_ &, const eckit::Configuration &)=0
Encapsulates the model state.
Control variable.
virtual void finalizeTraj()=0
The namespace for the main oops code.
virtual double finalize(const eckit::Configuration &) const =0
Finalize computation after nonlinear model integration.
State< MODEL > State_
Definition: CostTermBase.h:39
virtual ~CostTermBase()
Destructor.
Definition: CostTermBase.h:46
virtual GeneralizedDepartures * newDualVector() const =0
Provide new dual space vector (for example a Departure for Jo).
virtual GeneralizedDepartures * newGradientFG() const =0
Gradient at first guess.
boost::shared_ptr< PostBaseTLAD< MODEL > > PostPtrTLAD_
Definition: CostTermBase.h:42
boost::shared_ptr< PostBase< State_ > > PostPtr_
Definition: CostTermBase.h:41
Increment Class: Difference between two states.
Base Class for Cost Function Terms.
Definition: CostTermBase.h:37
virtual PostPtrTLAD_ setupAD(boost::shared_ptr< const GeneralizedDepartures >, ControlIncrement< MODEL > &) const =0
Initialize before starting the AD run.
virtual GeneralizedDepartures * multiplyCovar(const GeneralizedDepartures &) const =0
Multiply by covariance (or weight) matrix and its inverse.
virtual GeneralizedDepartures * multiplyCoInv(const GeneralizedDepartures &) const =0
Abstract base class for quantities.
virtual PostPtrTLAD_ setupTL(const ControlIncrement< MODEL > &) const =0
Initialize before starting the TL run.
virtual PostPtr_ initialize(const ControlVariable< MODEL > &) const =0
Initialize before nonlinear model integration.
virtual void resetLinearization()=0
Reset trajectory.
Increment< MODEL > Increment_
Definition: CostTermBase.h:40
Geometry< MODEL > Geometry_
Definition: CostTermBase.h:38