OOPS
HMatrix.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_HMATRIX_H_
12 #define OOPS_ASSIMILATION_HMATRIX_H_
13 
14 #include <boost/noncopyable.hpp>
15 
22 
23 namespace oops {
24 
25 /// The \f$ H \f$ matrix.
26 /*!
27  * The solvers represent matrices as objects that implement a "multiply"
28  * method. This class defines objects that apply a generalized \f$ H \f$
29  * matrix which includes \f$ H \f$ itself and the equivalent operators
30  * for the other terms of the cost function.
31  */
32 
33 template<typename MODEL, typename OBS> class HMatrix : private boost::noncopyable {
37 
38  public:
39  explicit HMatrix(const CostFct_ & j): j_(j) {}
40 
42  const bool idModel = false) const {
45 
46  for (unsigned jj = 0; jj < j_.nterms(); ++jj) {
47  cost.enrollProcessor(j_.jterm(jj).setupTL(dx));
48  }
49 
50  j_.runTLM(dx, cost, post, idModel);
51 
52  dy.clear();
53  for (unsigned jj = 0; jj < j_.nterms(); ++jj) {
54  dy.append(cost.releaseOutputFromTL(jj));
55  }
56  }
57 
58  private:
59  CostFct_ const & j_;
60 };
61 
62 } // namespace oops
63 
64 #endif // OOPS_ASSIMILATION_HMATRIX_H_
oops
The namespace for the main oops code.
Definition: ErrorCovarianceL95.cc:22
oops::DualVector::clear
void clear()
Definition: DualVector.h:97
oops::HMatrix::CostFct_
CostFunction< MODEL, OBS > CostFct_
Definition: HMatrix.h:36
oops::CostFunction::nterms
unsigned nterms() const
Definition: CostFunction.h:94
CostFunction.h
oops::HMatrix
The matrix.
Definition: HMatrix.h:33
oops::CostFunction::runTLM
virtual void runTLM(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ > post=PostProcessor< Increment_ >(), const bool idModel=false) const =0
oops::DualVector
Container of dual space vectors for all terms of the cost function.
Definition: DualVector.h:34
oops::HMatrix::HMatrix
HMatrix(const CostFct_ &j)
Definition: HMatrix.h:39
oops::CostFunction::jterm
const CostBase_ & jterm(const unsigned ii) const
Access terms of the cost function other than .
Definition: CostFunction.h:93
oops::HMatrix::CtrlInc_
ControlIncrement< MODEL, OBS > CtrlInc_
Definition: HMatrix.h:35
oops::ControlIncrement
Definition: ControlIncrement.h:46
oops::DualVector::append
void append(std::unique_ptr< GeneralizedDepartures > &&)
Definition: DualVector.h:107
oops::PostProcessorTLAD::releaseOutputFromTL
std::unique_ptr< GeneralizedDepartures > releaseOutputFromTL(unsigned int ii)
Get TL dual space output.
Definition: PostProcessorTLAD.h:95
oops::HMatrix::j_
CostFct_ const & j_
Definition: HMatrix.h:59
oops::PostProcessorTLAD::enrollProcessor
void enrollProcessor(PostBaseTLAD_ *pp)
Definition: PostProcessorTLAD.h:43
PostProcessor.h
oops::HMatrix::Increment_
Increment< MODEL > Increment_
Definition: HMatrix.h:34
oops::CostTermBase::setupTL
virtual PostPtrTLAD_ setupTL(const ControlIncrement< MODEL, OBS > &) const =0
Initialize before starting the TL run.
oops::PostProcessorTLAD
Control model post processing.
Definition: PostProcessorTLAD.h:33
oops::HMatrix::multiply
void multiply(CtrlInc_ &dx, DualVector< MODEL, OBS > &dy, const bool idModel=false) const
Definition: HMatrix.h:41
oops::PostProcessor
Control model post processing.
Definition: PostProcessor.h:30
ControlIncrement.h
oops::Increment
Increment Class: Difference between two states.
Definition: CostJbState.h:27
oops::CostFunction
Cost Function.
Definition: CostFunction.h:53
PostProcessorTLAD.h
DualVector.h
Increment.h