OOPS
ObsVecQG.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  * (C) Copyright 2017-2019 UCAR.
4  *
5  * This software is licensed under the terms of the Apache Licence Version 2.0
6  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
7  * In applying this licence, ECMWF does not waive the privileges and immunities
8  * granted to it by virtue of its status as an intergovernmental organisation nor
9  * does it submit to any jurisdiction.
10  */
11 
12 #ifndef QG_MODEL_OBSVECQG_H_
13 #define QG_MODEL_OBSVECQG_H_
14 
15 #include <Eigen/Dense>
16 #include <ostream>
17 #include <string>
18 
19 #include "oops/util/ObjectCounter.h"
20 #include "oops/util/Printable.h"
21 
22 #include "oops/qg/QgFortran.h"
23 
24 namespace qg {
25  class ObsSpaceQG;
26  template <typename DATATYPE> class ObsDataQG;
27 
28 // -----------------------------------------------------------------------------
29 /// ObsVecQG class to handle vectors in observation space for QG model.
30 
31 class ObsVecQG : public util::Printable,
32  private util::ObjectCounter<ObsVecQG> {
33  public:
34  static const std::string classname() {return "qg::ObsVecQG";}
35 
36  ObsVecQG(const ObsSpaceQG &,
37  const std::string & name = "");
38  ObsVecQG(const ObsVecQG &);
39  ~ObsVecQG();
40 
41  ObsVecQG & operator = (const ObsVecQG &);
42  ObsVecQG & operator*= (const double &);
43  ObsVecQG & operator+= (const ObsVecQG &);
44  ObsVecQG & operator-= (const ObsVecQG &);
45  ObsVecQG & operator*= (const ObsVecQG &);
46  ObsVecQG & operator/= (const ObsVecQG &);
47 
48  Eigen::VectorXd packEigen(const ObsVecQG &) const;
49  size_t packEigenSize(const ObsVecQG &) const;
50  size_t size() const;
51 
52  /// set all values to zero
53  void zero();
54  /// set \p i-th value to missing value
55  void setToMissing(int i);
56  /// set all values to one
57  void ones();
58  void axpy(const double &, const ObsVecQG &);
59  void invert();
60  void random();
61  double dot_product_with(const ObsVecQG &) const;
62  double rms() const;
63  void mask(const ObsDataQG<int> &);
64  void mask(const ObsVecQG &);
66 
67  unsigned int nobs() const;
68 
69  const int & toFortran() const {return keyOvec_;}
70 
71 // I/O
72  void save(const std::string &) const;
73  void read(const std::string &);
74 
75  private:
76  void print(std::ostream &) const;
77 
78  const ObsSpaceQG & obsdb_;
80 };
81 // -----------------------------------------------------------------------------
82 
83 } // namespace qg
84 
85 #endif // QG_MODEL_OBSVECQG_H_
Data in observation space.
Definition: ObsDataQG.h:32
ObsSpace for QG model.
Definition: ObsSpaceQG.h:81
ObsVecQG class to handle vectors in observation space for QG model.
Definition: ObsVecQG.h:32
const int & toFortran() const
Definition: ObsVecQG.h:69
ObsVecQG & operator/=(const ObsVecQG &)
Definition: ObsVecQG.cc:71
const ObsSpaceQG & obsdb_
Definition: ObsVecQG.h:78
void print(std::ostream &) const
Definition: ObsVecQG.cc:153
void zero()
set all values to zero
Definition: ObsVecQG.cc:82
double rms() const
Definition: ObsVecQG.cc:114
void read(const std::string &)
Definition: ObsVecQG.cc:149
ObsVecQG & operator-=(const ObsVecQG &)
Definition: ObsVecQG.cc:59
unsigned int nobs() const
Definition: ObsVecQG.cc:169
double dot_product_with(const ObsVecQG &) const
Definition: ObsVecQG.cc:107
void axpy(const double &, const ObsVecQG &)
Definition: ObsVecQG.cc:94
ObsVecQG & operator+=(const ObsVecQG &)
Definition: ObsVecQG.cc:53
F90ovec keyOvec_
Definition: ObsVecQG.h:79
void ones()
set all values to one
Definition: ObsVecQG.cc:90
ObsVecQG & operator=(const ObsVecQG &)
Definition: ObsVecQG.cc:42
void invert()
Definition: ObsVecQG.cc:99
size_t packEigenSize(const ObsVecQG &) const
Definition: ObsVecQG.cc:143
void random()
Definition: ObsVecQG.cc:103
void mask(const ObsDataQG< int > &)
Definition: ObsVecQG.cc:125
void setToMissing(int i)
set i-th value to missing value
Definition: ObsVecQG.cc:86
Eigen::VectorXd packEigen(const ObsVecQG &) const
Definition: ObsVecQG.cc:137
size_t size() const
Definition: ObsVecQG.cc:176
static const std::string classname()
Definition: ObsVecQG.h:34
ObsVecQG(const ObsSpaceQG &, const std::string &name="")
Definition: ObsVecQG.cc:25
ObsVecQG & operator*=(const double &)
Definition: ObsVecQG.cc:48
void save(const std::string &) const
Definition: ObsVecQG.cc:133
The namespace for the qg model.
int F90ovec
Definition: QgFortran.h:53