OOPS
ObsDataQG.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2019 UCAR
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  */
7 
8 #ifndef QG_MODEL_OBSDATAQG_H_
9 #define QG_MODEL_OBSDATAQG_H_
10 
11 #include <math.h>
12 #include <ostream>
13 #include <string>
14 #include <vector>
15 
16 #include "oops/base/Variables.h"
17 #include "oops/util/Logger.h"
18 #include "oops/util/ObjectCounter.h"
19 #include "oops/util/Printable.h"
20 
21 #include "oops/qg/ObsSpaceQG.h"
22 #include "oops/qg/ObsVecQG.h"
23 #include "oops/qg/QgFortran.h"
24 
25 namespace qg {
26 
27 // -----------------------------------------------------------------------------
28 /// Data in observation space
29 
30 template<typename DATATYPE>
31 class ObsDataQG : public util::Printable,
32  private util::ObjectCounter<ObsDataQG<DATATYPE> > {
33  public:
34  static const std::string classname() {return "qg::ObsDataQG";}
35 
36  ObsDataQG(const ObsSpaceQG &, const oops::Variables &, const std::string &);
37  ObsDataQG(const ObsDataQG &);
39 
40  ObsDataQG & operator= (const ObsDataQG &);
41 
42  void zero();
43  void mask(const ObsDataQG<int>);
44 
45 // I/O
46  void save(const std::string &) const;
47 
48  private:
49  void print(std::ostream &) const;
50 
52 };
53 //-----------------------------------------------------------------------------
54 
55 template<typename DATATYPE>
57  const std::string & name): data_(os, name) {
58 }
59 // -----------------------------------------------------------------------------
60 template<typename DATATYPE>
61 ObsDataQG<DATATYPE>::ObsDataQG(const ObsDataQG & other): data_(other.data_) {
62 }
63 // -----------------------------------------------------------------------------
64 template<typename DATATYPE>
66  data_ = rhs.data_;
67  return *this;
68 }
69 // -----------------------------------------------------------------------------
70 template<typename DATATYPE>
72  data_.zero();
73 }
74 // -----------------------------------------------------------------------------
75 template<typename DATATYPE>
77 }
78 // -----------------------------------------------------------------------------
79 template<typename DATATYPE>
80 void ObsDataQG<DATATYPE>::save(const std::string & name) const {
81  data_.save(name);
82 }
83 // -----------------------------------------------------------------------------
84 template<typename DATATYPE>
85 void ObsDataQG<DATATYPE>::print(std::ostream & os) const {
86  os << data_;
87 }
88 // -----------------------------------------------------------------------------
89 } // namespace qg
90 
91 #endif // QG_MODEL_OBSDATAQG_H_
qg::ObsDataQG::mask
void mask(const ObsDataQG< int >)
Definition: ObsDataQG.h:76
qg
The namespace for the qg model.
Definition: qg/model/AnalyticInit.cc:13
qg::ObsDataQG::operator=
ObsDataQG & operator=(const ObsDataQG &)
Definition: ObsDataQG.h:65
qg::ObsDataQG::zero
void zero()
Definition: ObsDataQG.h:71
qg::ObsDataQG::save
void save(const std::string &) const
Definition: ObsDataQG.h:80
qg::ObsSpaceQG
ObsSpace for QG model.
Definition: ObsSpaceQG.h:44
qg::ObsDataQG
Data in observation space.
Definition: ObsDataQG.h:32
qg::ObsDataQG::print
void print(std::ostream &) const
Definition: ObsDataQG.h:85
qg::ObsDataQG::~ObsDataQG
~ObsDataQG()
Definition: ObsDataQG.h:38
qg::ObsDataQG::ObsDataQG
ObsDataQG(const ObsSpaceQG &, const oops::Variables &, const std::string &)
Definition: ObsDataQG.h:56
qg::ObsVecQG
ObsVecQG class to handle vectors in observation space for QG model.
Definition: ObsVecQG.h:34
qg::ObsDataQG::classname
static const std::string classname()
Definition: ObsDataQG.h:34
qg::ObsDataQG::data_
ObsVecQG data_
Definition: ObsDataQG.h:51
oops::Variables
Definition: oops/base/Variables.h:23
Variables.h