MPAS-JEDI
StateMPAS.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017 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 MPASJEDI_STATEMPAS_H_
9 #define MPASJEDI_STATEMPAS_H_
10 
11 #include <memory>
12 #include <ostream>
13 #include <string>
14 #include <vector>
15 
16 #include "oops/base/Variables.h"
17 #include "oops/util/DateTime.h"
18 #include "oops/util/ObjectCounter.h"
19 #include "oops/util/Printable.h"
20 #include "oops/util/Serializable.h"
21 
23 
24 namespace eckit {
25  class Configuration;
26 }
27 
28 namespace ufo {
29  class GeoVaLs;
30  class Locations;
31 }
32 
33 namespace oops {
34  class Variables;
35 }
36 
37 namespace mpas {
38  class GeometryMPAS;
39  class GetValuesTrajMPAS;
40  class IncrementMPAS;
41 
42 /// MPAS model state
43 /*!
44  * A State contains everything that is needed to propagate the state
45  * forward in time.
46  */
47 
48 // -----------------------------------------------------------------------------
49 class StateMPAS : public util::Printable,
50  public util::Serializable,
51  private util::ObjectCounter<StateMPAS> {
52  public:
53  static const std::string classname() {return "mpas::StateMPAS";}
54 
55 /// Constructor, destructor
56  StateMPAS(const GeometryMPAS &, const oops::Variables &,
57  const util::DateTime &); // Is it used?
58  StateMPAS(const GeometryMPAS &, const eckit::Configuration &);
59  StateMPAS(const GeometryMPAS &, const StateMPAS &);
60  StateMPAS(const StateMPAS &);
61  ~StateMPAS();
62 // virtual ~StateMPAS();
63 
64  StateMPAS & operator=(const StateMPAS &);
65  void zero();
66  void accumul(const double &, const StateMPAS &);
67 
68 /// Interpolate full fields
69  void changeResolution(const StateMPAS & xx);
70 
71 /// Interactions with Increment
73 
74 /// Serialization
75  size_t serialSize() const override;
76  void serialize(std::vector<double> &) const override;
77  void deserialize(const std::vector<double> &, size_t &) override;
78 
79 /// I/O and diagnostics
80  void read(const eckit::Configuration &);
81  void analytic_init(const eckit::Configuration &, const GeometryMPAS &);
82  void write(const eckit::Configuration &) const;
83  double norm() const;
84 
85  std::shared_ptr<const GeometryMPAS> geometry() const {return geom_;}
86 
87  const util::DateTime & time() const {return time_;}
88  util::DateTime & time() {return time_;}
89  const util::DateTime & validTime() const {return time_;}
90  util::DateTime & validTime() {return time_;}
91  const oops::Variables & variables() const {return vars_;}
92  void updateTime(const util::Duration & dt) {time_ += dt;}
93 
94  int & toFortran() {return keyState_;}
95  const int & toFortran() const {return keyState_;}
96 
97  private:
98  void print(std::ostream &) const override;
100  std::shared_ptr<const GeometryMPAS> geom_;
101  oops::Variables vars_;
102  util::DateTime time_;
103 
104  oops::Variables stateVars();
105 };
106 
107 // -----------------------------------------------------------------------------
108 
109 } // namespace mpas
110 
111 #endif // MPASJEDI_STATEMPAS_H_
GeometryMPAS handles geometry for MPAS model.
Definition: GeometryMPAS.h:37
Increment Class: Difference between two states.
Definition: IncrementMPAS.h:57
MPAS model state.
Definition: StateMPAS.h:51
void zero()
For accumulator.
Definition: StateMPAS.cc:203
static const std::string classname()
Definition: StateMPAS.h:53
const oops::Variables & variables() const
Definition: StateMPAS.h:91
util::DateTime & time()
Definition: StateMPAS.h:88
int & toFortran()
Definition: StateMPAS.h:94
void write(const eckit::Configuration &) const
Definition: StateMPAS.cc:171
std::shared_ptr< const GeometryMPAS > geom_
Definition: StateMPAS.h:100
const int & toFortran() const
Definition: StateMPAS.h:95
void read(const eckit::Configuration &)
I/O and diagnostics.
Definition: StateMPAS.cc:160
F90state keyState_
Definition: StateMPAS.h:99
double norm() const
Definition: StateMPAS.cc:211
void accumul(const double &, const StateMPAS &)
Definition: StateMPAS.cc:207
StateMPAS(const GeometryMPAS &, const oops::Variables &, const util::DateTime &)
Constructor, destructor.
Definition: StateMPAS.cc:30
const util::DateTime & time() const
Definition: StateMPAS.h:87
void analytic_init(const eckit::Configuration &, const GeometryMPAS &)
Definition: StateMPAS.cc:164
std::shared_ptr< const GeometryMPAS > geometry() const
Definition: StateMPAS.h:85
void serialize(std::vector< double > &) const override
Definition: StateMPAS.cc:131
void print(std::ostream &) const override
Definition: StateMPAS.cc:175
util::DateTime & validTime()
Definition: StateMPAS.h:90
size_t serialSize() const override
Serialization.
Definition: StateMPAS.cc:116
util::DateTime time_
Definition: StateMPAS.h:102
StateMPAS & operator=(const StateMPAS &)
Basic operators.
Definition: StateMPAS.cc:89
void changeResolution(const StateMPAS &xx)
Interpolate full fields.
Definition: StateMPAS.cc:97
oops::Variables stateVars()
Definition: StateMPAS.cc:218
void deserialize(const std::vector< double > &, size_t &) override
Definition: StateMPAS.cc:146
oops::Variables vars_
Definition: StateMPAS.h:101
void updateTime(const util::Duration &dt)
Definition: StateMPAS.h:92
const util::DateTime & validTime() const
Definition: StateMPAS.h:89
StateMPAS & operator+=(const IncrementMPAS &)
Interactions with Increment.
Definition: StateMPAS.cc:104
Definition: Fortran.h:17
int F90state
Definition: Fortran.h:42
Definition: GetValues.h:35