OOPS
StateQG.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 QG_MODEL_STATEQG_H_
12 #define QG_MODEL_STATEQG_H_
13 
14 #include <memory>
15 #include <ostream>
16 #include <string>
17 #include <vector>
18 
19 #include "oops/util/DateTime.h"
20 #include "oops/util/ObjectCounter.h"
21 #include "oops/util/Printable.h"
22 
23 #include "oops/qg/FieldsQG.h"
24 
25 namespace eckit {
26  class Configuration;
27 }
28 
29 namespace oops {
30  class Variables;
31 }
32 
33 namespace qg {
34  class GomQG;
35  class LocationsQG;
36  class GeometryQG;
37  class IncrementQG;
38 
39 /// QG model state
40 // -----------------------------------------------------------------------------
41 class StateQG : public util::Printable,
42  private util::ObjectCounter<StateQG> {
43  public:
44  static const std::string classname() {return "qg::StateQG";}
45 
46 /// Constructor, destructor
47  StateQG(const GeometryQG &, const oops::Variables &, const util::DateTime &); // Is it used?
48  StateQG(const GeometryQG &, const eckit::Configuration &);
49  StateQG(const GeometryQG &, const StateQG &);
50  StateQG(const StateQG &);
51  virtual ~StateQG();
52  StateQG & operator=(const StateQG &);
53 
54 /// Interpolate full fields
55  void changeResolution(const StateQG & xx);
56 
57 /// Interactions with Increment
58  StateQG & operator+=(const IncrementQG &);
59 
60 /// I/O and diagnostics
61  void read(const eckit::Configuration &);
62  void write(const eckit::Configuration &) const;
63  double norm() const {return fields_->norm();}
64  const util::DateTime & validTime() const {return fields_->time();}
65  util::DateTime & validTime() {return fields_->time();}
66  void updateTime(const util::Duration & dt) {fields_->updateTime(dt);}
67 
68 /// Access to fields
69  FieldsQG & fields() {return *fields_;}
70  const FieldsQG & fields() const {return *fields_;}
71  std::shared_ptr<const GeometryQG> geometry() const {
72  return fields_->geometry();
73  }
74  const oops::Variables & variables() const {return fields_->variables();}
75 
76 /// Serialization
77  size_t serialSize() const;
78  void serialize(std::vector<double> &) const;
79  void deserialize(const std::vector<double> &, size_t &);
80 
81 /// Other
82  void zero();
83  void accumul(const double &, const StateQG &);
84 
85  private:
86  void print(std::ostream &) const;
87  const bool lbc_ = true;
88  std::unique_ptr<FieldsQG> fields_;
89 };
90 // -----------------------------------------------------------------------------
91 
92 } // namespace qg
93 
94 #endif // QG_MODEL_STATEQG_H_
Class to represent a Fields for the QG model.
Definition: FieldsQG.h:52
GeometryQG handles geometry for QG model.
Definition: GeometryQG.h:58
Increment Class: Difference between two states.
Definition: IncrementQG.h:64
QG model state.
Definition: StateQG.h:42
void print(std::ostream &) const
Definition: StateQG.cc:138
void write(const eckit::Configuration &) const
Definition: StateQG.cc:119
StateQG & operator+=(const IncrementQG &)
Interactions with Increment.
Definition: StateQG.cc:106
std::shared_ptr< const GeometryQG > geometry() const
Definition: StateQG.h:71
double norm() const
Definition: StateQG.h:63
void accumul(const double &, const StateQG &)
Definition: StateQG.cc:149
StateQG & operator=(const StateQG &)
Basic operators.
Definition: StateQG.cc:91
static const std::string classname()
Definition: StateQG.h:44
void changeResolution(const StateQG &xx)
Interpolate full fields.
Definition: StateQG.cc:99
FieldsQG & fields()
Access to fields.
Definition: StateQG.h:69
virtual ~StateQG()
Definition: StateQG.cc:85
const util::DateTime & validTime() const
Definition: StateQG.h:64
void updateTime(const util::Duration &dt)
Definition: StateQG.h:66
std::unique_ptr< FieldsQG > fields_
Definition: StateQG.h:88
void read(const eckit::Configuration &)
I/O and diagnostics.
Definition: StateQG.cc:115
void serialize(std::vector< double > &) const
Definition: StateQG.cc:130
size_t serialSize() const
Serialization.
Definition: StateQG.cc:125
void deserialize(const std::vector< double > &, size_t &)
Definition: StateQG.cc:134
const FieldsQG & fields() const
Definition: StateQG.h:70
StateQG(const GeometryQG &, const oops::Variables &, const util::DateTime &)
Constructor, destructor.
Definition: StateQG.cc:40
void zero()
Other.
Definition: StateQG.cc:145
util::DateTime & validTime()
Definition: StateQG.h:65
const oops::Variables & variables() const
Definition: StateQG.h:74
const bool lbc_
Definition: StateQG.h:87
Definition: FieldL95.h:22
The namespace for the main oops code.
The namespace for the qg model.