FV3 Bundle
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> 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_
The matrix.
Definition: HMatrix.h:33
GeneralizedDepartures * releaseOutputFromTL(unsigned int ii)
Get TL dual space output.
Container of dual space vectors for all terms of the cost function.
Definition: DualVector.h:34
CostFunction< MODEL > CostFct_
Definition: HMatrix.h:36
HMatrix(const CostFct_ &j)
Definition: HMatrix.h:39
virtual void runTLM(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ > post=PostProcessor< Increment_ >(), const bool idModel=false) const =0
Cost Function.
Definition: CostFunction.h:56
void multiply(CtrlInc_ &dx, DualVector< MODEL > &dy, const bool idModel=false) const
Definition: HMatrix.h:41
unsigned nterms() const
Definition: CostFunction.h:100
l_size ! loop over number of fields ke do j
The namespace for the main oops code.
Increment< MODEL > Increment_
Definition: HMatrix.h:34
CostFct_ const & j_
Definition: HMatrix.h:59
Control model post processing.
void enrollProcessor(PostBaseTLAD_ *pp)
Increment Class: Difference between two states.
ControlIncrement< MODEL > CtrlInc_
Definition: HMatrix.h:35
Control model post processing.
Definition: PostProcessor.h:31
void append(GeneralizedDepartures *)
Definition: DualVector.h:107
virtual PostPtrTLAD_ setupTL(const ControlIncrement< MODEL > &) const =0
Initialize before starting the TL run.
const CostBase_ & jterm(const unsigned ii) const
Access terms of the cost function other than .
Definition: CostFunction.h:99