OOPS
ObsOpBaseQG.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-2018 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_OBSOPBASEQG_H_
9 #define QG_MODEL_OBSOPBASEQG_H_
10 
11 #include <map>
12 #include <memory>
13 #include <string>
14 
15 #include <boost/noncopyable.hpp>
16 
17 #include "eckit/config/Configuration.h"
18 
19 #include "oops/base/Variables.h"
20 #include "oops/util/abor1_cpp.h"
21 #include "oops/util/DateTime.h"
22 #include "oops/util/Printable.h"
23 
24 #include "oops/qg/ObsSpaceQG.h"
25 
26 namespace qg {
27 class GomQG;
28 class LocationsQG;
29 class ObsBias;
30 class ObsVecQG;
31 
32 // -----------------------------------------------------------------------------
33 /// Base class for observation operators
34 
35 class ObsOpBaseQG : public util::Printable,
36  private boost::noncopyable {
37  public:
38  ObsOpBaseQG() = default;
39 
40 /// Obs Operator
41  virtual void simulateObs(const GomQG &, ObsVecQG &, const ObsBias &) const = 0;
42 
43 /// Other
44  virtual const oops::Variables & requiredVars() const = 0; // Required from Model
45  virtual std::unique_ptr<LocationsQG> locations(const util::DateTime &,
46  const util::DateTime &) const = 0;
47 
48  private:
49  virtual void print(std::ostream &) const = 0;
50 };
51 
52 // -----------------------------------------------------------------------------
53 
54 /// Obs Operator Factory
55 class ObsOpFactory {
56  public:
57  static ObsOpBaseQG * create(const ObsSpaceQG &, const eckit::Configuration &);
58  virtual ~ObsOpFactory() = default;
59  protected:
60  explicit ObsOpFactory(const std::string &);
61  private:
62  virtual ObsOpBaseQG * make(const ObsSpaceQG &, const eckit::Configuration &) = 0;
63  static std::map < std::string, ObsOpFactory * > & getMakers() {
64  static std::map < std::string, ObsOpFactory * > makers_;
65  return makers_;
66  }
67 };
68 
69 // -----------------------------------------------------------------------------
70 
71 template<class T>
72 class ObsOpMaker : public ObsOpFactory {
73  virtual ObsOpBaseQG * make(const ObsSpaceQG & odb, const eckit::Configuration & conf)
74  { return new T(odb, conf); }
75  public:
76  explicit ObsOpMaker(const std::string & name) : ObsOpFactory(name) {}
77 };
78 
79 // -----------------------------------------------------------------------------
80 
81 } // namespace qg
82 
83 #endif // QG_MODEL_OBSOPBASEQG_H_
qg::ObsOpFactory::create
static ObsOpBaseQG * create(const ObsSpaceQG &, const eckit::Configuration &)
Definition: ObsOpBaseQG.cc:28
qg::ObsOpMaker::make
virtual ObsOpBaseQG * make(const ObsSpaceQG &odb, const eckit::Configuration &conf)
Definition: ObsOpBaseQG.h:73
qg::ObsOpFactory::~ObsOpFactory
virtual ~ObsOpFactory()=default
qg
The namespace for the qg model.
Definition: qg/model/AnalyticInit.cc:13
qg::ObsOpFactory
Obs Operator Factory.
Definition: ObsOpBaseQG.h:55
qg::ObsBias
Class to handle observation bias parameters.
Definition: qg/model/ObsBias.h:37
qg::ObsSpaceQG
ObsSpace for QG model.
Definition: ObsSpaceQG.h:44
qg::GomQG
GomQG class to handle local model values for QG model.
Definition: GomQG.h:33
qg::ObsOpBaseQG::simulateObs
virtual void simulateObs(const GomQG &, ObsVecQG &, const ObsBias &) const =0
Obs Operator.
qg::ObsOpFactory::ObsOpFactory
ObsOpFactory(const std::string &)
Definition: ObsOpBaseQG.cc:18
qg::ObsOpFactory::make
virtual ObsOpBaseQG * make(const ObsSpaceQG &, const eckit::Configuration &)=0
qg::ObsOpFactory::getMakers
static std::map< std::string, ObsOpFactory * > & getMakers()
Definition: ObsOpBaseQG.h:63
qg::ObsOpBaseQG::ObsOpBaseQG
ObsOpBaseQG()=default
qg::ObsOpMaker::ObsOpMaker
ObsOpMaker(const std::string &name)
Definition: ObsOpBaseQG.h:76
qg::ObsOpBaseQG
Base class for observation operators.
Definition: ObsOpBaseQG.h:36
qg::ObsVecQG
ObsVecQG class to handle vectors in observation space for QG model.
Definition: ObsVecQG.h:34
qg::ObsOpBaseQG::locations
virtual std::unique_ptr< LocationsQG > locations(const util::DateTime &, const util::DateTime &) const =0
qg::ObsOpMaker
Definition: ObsOpBaseQG.h:72
qg::ObsOpBaseQG::print
virtual void print(std::ostream &) const =0
oops::Variables
Definition: oops/base/Variables.h:23
qg::ObsOpBaseQG::requiredVars
virtual const oops::Variables & requiredVars() const =0
Other.
Variables.h