FV3 Bundle
RinvMatrix.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_RINVMATRIX_H_
12 #define OOPS_ASSIMILATION_RINVMATRIX_H_
13 
14 #include <boost/noncopyable.hpp>
15 
18 
19 namespace oops {
20 
21 /// The \f$ R^{-1} \f$ matrix.
22 /*!
23  * The solvers represent matrices as objects that implement a "multiply"
24  * method. This class defines objects that apply a generalized \f$ R^{-1} \f$
25  * matrix which includes \f$ R^{-1} \f$ itself and the equivalent operators
26  * for the other terms of the cost function.
27  */
28 
29 template<typename MODEL> class RinvMatrix : private boost::noncopyable {
32 
33  public:
34  explicit RinvMatrix(const CostFct_ & j): j_(j) {}
35 
36  void multiply(const Dual_ & dx, Dual_ & dy) const {
37  dy.clear();
38  for (unsigned jj = 0; jj < j_.nterms(); ++jj) {
39  dy.append(j_.jterm(jj).multiplyCoInv(*dx.getv(jj)));
40  }
41  }
42 
43  private:
44  CostFct_ const & j_;
45 };
46 
47 } // namespace oops
48 
49 #endif // OOPS_ASSIMILATION_RINVMATRIX_H_
void multiply(const Dual_ &dx, Dual_ &dy) const
Definition: RinvMatrix.h:36
Container of dual space vectors for all terms of the cost function.
Definition: DualVector.h:34
Cost Function.
Definition: CostFunction.h:56
unsigned nterms() const
Definition: CostFunction.h:100
l_size ! loop over number of fields ke do j
DualVector< MODEL > Dual_
Definition: RinvMatrix.h:31
The namespace for the main oops code.
RinvMatrix(const CostFct_ &j)
Definition: RinvMatrix.h:34
CostFct_ const & j_
Definition: RinvMatrix.h:44
The matrix.
Definition: RinvMatrix.h:29
virtual GeneralizedDepartures * multiplyCoInv(const GeneralizedDepartures &) const =0
void append(GeneralizedDepartures *)
Definition: DualVector.h:107
boost::shared_ptr< const GeneralizedDepartures > getv(const unsigned) const
Definition: DualVector.h:127
CostFunction< MODEL > CostFct_
Definition: RinvMatrix.h:30
const CostBase_ & jterm(const unsigned ii) const
Access terms of the cost function other than .
Definition: CostFunction.h:99