FV3 Bundle
HtMatrix.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_HTMATRIX_H_
12 #define OOPS_ASSIMILATION_HTMATRIX_H_
13 
14 #include <boost/noncopyable.hpp>
15 
22 
23 namespace oops {
24 
25 /// The \f$ H^T \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^T \f$
29  * matrix which includes \f$ H^T \f$ itself and the equivalent operators
30  * for the other terms of the cost function.
31  */
32 
33 template<typename MODEL> class HtMatrix : private boost::noncopyable {
36 
37  public:
38  explicit HtMatrix(const CostFct_ & j): j_(j) {}
39 
41  const bool idModel = false) const {
44  // Don't zero out dx here
45  for (unsigned jj = 0; jj < j_.nterms(); ++jj) {
46  cost.enrollProcessor(j_.jterm(jj).setupAD(dy.getv(jj), dx));
47  }
48  j_.runADJ(dx, cost, post, idModel);
49  }
50 
51  private:
52  CostFct_ const & j_;
53 };
54 
55 } // namespace oops
56 
57 #endif // OOPS_ASSIMILATION_HTMATRIX_H_
Container of dual space vectors for all terms of the cost function.
Definition: DualVector.h:34
HtMatrix(const CostFct_ &j)
Definition: HtMatrix.h:38
Cost Function.
Definition: CostFunction.h:56
unsigned nterms() const
Definition: CostFunction.h:100
l_size ! loop over number of fields ke do j
The namespace for the main oops code.
virtual void runADJ(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ > post=PostProcessor< Increment_ >(), const bool idModel=false) const =0
void multiply(const DualVector< MODEL > &dy, ControlIncrement< MODEL > &dx, const bool idModel=false) const
Definition: HtMatrix.h:40
CostFunction< MODEL > CostFct_
Definition: HtMatrix.h:34
Control model post processing.
void enrollProcessor(PostBaseTLAD_ *pp)
CostFct_ const & j_
Definition: HtMatrix.h:52
Increment Class: Difference between two states.
virtual PostPtrTLAD_ setupAD(boost::shared_ptr< const GeneralizedDepartures >, ControlIncrement< MODEL > &) const =0
Initialize before starting the AD run.
Increment< MODEL > Increment_
Definition: HtMatrix.h:35
Control model post processing.
Definition: PostProcessor.h:31
boost::shared_ptr< const GeneralizedDepartures > getv(const unsigned) const
Definition: DualVector.h:127
The matrix.
Definition: HtMatrix.h:33
const CostBase_ & jterm(const unsigned ii) const
Access terms of the cost function other than .
Definition: CostFunction.h:99