OOPS
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 <memory>
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, typename OBS> class CostTermBase {
41  typedef std::shared_ptr<PostBase<State_> > PostPtr_;
42  typedef std::shared_ptr<PostBaseTLAD<MODEL> > PostPtrTLAD_;
43 
44  public:
45 /// Destructor
46  virtual ~CostTermBase() {}
47 
48 /// Initialize before nonlinear model integration.
50  const eckit::Configuration &) = 0;
52  const Geometry_ &, const eckit::Configuration &) = 0;
53 
54 /// Finalize computation after nonlinear model integration.
55  virtual double finalize() = 0;
56  virtual void finalizeTraj() = 0;
57 
58 /// Initialize before starting the TL run.
60 
61 /// Initialize before starting the AD run.
62  virtual PostPtrTLAD_ setupAD(std::shared_ptr<const GeneralizedDepartures>,
63  ControlIncrement<MODEL, OBS> &) const = 0;
64 
65 /// Multiply by covariance (or weight) matrix and its inverse.
66  virtual std::unique_ptr<GeneralizedDepartures>
68  virtual std::unique_ptr<GeneralizedDepartures>
70 
71 /// Provide new dual space vector (for example a Departure for Jo).
72  virtual std::unique_ptr<GeneralizedDepartures> newDualVector() const = 0;
73 
74 /// Gradient at first guess.
75  virtual std::unique_ptr<GeneralizedDepartures> newGradientFG() const = 0;
76 
77 /// Reset trajectory.
78  virtual void resetLinearization() = 0;
79 };
80 
81 // -----------------------------------------------------------------------------
82 
83 } // namespace oops
84 
85 #endif // OOPS_ASSIMILATION_COSTTERMBASE_H_
oops
The namespace for the main oops code.
Definition: ErrorCovarianceL95.cc:22
oops::CostTermBase::multiplyCoInv
virtual std::unique_ptr< GeneralizedDepartures > multiplyCoInv(const GeneralizedDepartures &) const =0
oops::CostTermBase::multiplyCovar
virtual std::unique_ptr< GeneralizedDepartures > multiplyCovar(const GeneralizedDepartures &) const =0
Multiply by covariance (or weight) matrix and its inverse.
oops::GeneralizedDepartures
Abstract base class for quantities.
Definition: GeneralizedDepartures.h:22
oops::CostTermBase::Geometry_
Geometry< MODEL > Geometry_
Definition: CostTermBase.h:38
PostBaseTLAD.h
oops::CostTermBase
Base Class for Cost Function Terms.
Definition: CostTermBase.h:37
oops::ControlVariable
Control variable.
Definition: ControlVariable.h:41
oops::CostTermBase::initialize
virtual PostPtr_ initialize(const ControlVariable< MODEL, OBS > &, const eckit::Configuration &)=0
Initialize before nonlinear model integration.
oops::ControlIncrement
Definition: ControlIncrement.h:46
oops::CostTermBase::Increment_
Increment< MODEL > Increment_
Definition: CostTermBase.h:40
oops::CostTermBase::PostPtrTLAD_
std::shared_ptr< PostBaseTLAD< MODEL > > PostPtrTLAD_
Definition: CostTermBase.h:42
oops::CostTermBase::newGradientFG
virtual std::unique_ptr< GeneralizedDepartures > newGradientFG() const =0
Gradient at first guess.
oops::CostTermBase::State_
State< MODEL > State_
Definition: CostTermBase.h:39
oops::CostTermBase::finalizeTraj
virtual void finalizeTraj()=0
oops::CostTermBase::setupAD
virtual PostPtrTLAD_ setupAD(std::shared_ptr< const GeneralizedDepartures >, ControlIncrement< MODEL, OBS > &) const =0
Initialize before starting the AD run.
PostBase.h
oops::CostTermBase::initializeTraj
virtual PostPtrTLAD_ initializeTraj(const ControlVariable< MODEL, OBS > &, const Geometry_ &, const eckit::Configuration &)=0
eckit
Definition: FieldL95.h:22
oops::CostTermBase::resetLinearization
virtual void resetLinearization()=0
Reset trajectory.
oops::CostTermBase::PostPtr_
std::shared_ptr< PostBase< State_ > > PostPtr_
Definition: CostTermBase.h:41
oops::CostTermBase::setupTL
virtual PostPtrTLAD_ setupTL(const ControlIncrement< MODEL, OBS > &) const =0
Initialize before starting the TL run.
oops::CostTermBase::finalize
virtual double finalize()=0
Finalize computation after nonlinear model integration.
oops::Geometry
Geometry class used in oops; subclass of interface class above.
Definition: oops/interface/Geometry.h:189
oops::CostTermBase::newDualVector
virtual std::unique_ptr< GeneralizedDepartures > newDualVector() const =0
Provide new dual space vector (for example a Departure for Jo).
oops::State
Encapsulates the model state.
Definition: CostJbState.h:28
State.h
ControlIncrement.h
oops::Increment
Increment Class: Difference between two states.
Definition: CostJbState.h:27
oops::CostTermBase::~CostTermBase
virtual ~CostTermBase()
Destructor.
Definition: CostTermBase.h:46
ControlVariable.h
Geometry.h
Increment.h