FV3 Bundle
FieldsQG.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_FIELDSQG_H_
12 #define QG_MODEL_FIELDSQG_H_
13 
14 #include <ostream>
15 #include <string>
16 
17 #include <boost/shared_ptr.hpp>
18 
19 #include "model/GeometryQG.h"
21 #include "model/VariablesQG.h"
22 #include "oops/base/GridPoint.h"
23 #include "oops/base/Variables.h"
24 #include "oops/util/DateTime.h"
25 #include "oops/util/Duration.h"
26 #include "oops/util/ObjectCounter.h"
27 #include "oops/util/Printable.h"
28 
29 // Forward declarations
30 namespace eckit {
31  class Configuration;
32 }
33 
34 namespace oops {
35  class UnstructuredGrid;
36  class Variables;
37  class GridPoint;
38 }
39 
40 namespace qg {
41  class LocationsQG;
42  class GomQG;
43 
44 // -----------------------------------------------------------------------------
45 /// Class to represent a FieldSet for the QG model
46 class FieldsQG : public util::Printable,
47  private util::ObjectCounter<FieldsQG> {
48  public:
49  static const std::string classname() {return "qg::FieldsQG";}
50 
51 // Constructors and basic operators
52  FieldsQG(const GeometryQG &, const oops::Variables &, const util::DateTime &);
53  FieldsQG(const FieldsQG &, const GeometryQG &);
54  FieldsQG(const FieldsQG &, const oops::Variables &);
55  FieldsQG(const FieldsQG &, const bool);
56  FieldsQG(const FieldsQG &);
57  ~FieldsQG();
58 
59  void zero();
60  void zero(const util::DateTime &);
61  FieldsQG & operator=(const FieldsQG &);
62  FieldsQG & operator+=(const FieldsQG &);
63  FieldsQG & operator-=(const FieldsQG &);
64  FieldsQG & operator*=(const double &);
65  void axpy(const double &, const FieldsQG &);
66  double dot_product_with(const FieldsQG &) const;
67  void schur_product_with(const FieldsQG &);
68  void dirac(const eckit::Configuration &);
69  void random();
70 
71 // Get fields values at given location
72  void getValues(const LocationsQG &, const oops::Variables &, GomQG &) const;
73  void getValuesTL(const LocationsQG &, const oops::Variables &, GomQG &) const;
74  void getValuesAD(const LocationsQG &, const oops::Variables &, const GomQG &);
75 
76 // Interpolate full fields
77  void changeResolution(const FieldsQG &);
78  void add(const FieldsQG &);
79  void diff(const FieldsQG &, const FieldsQG &);
80 
81 // Unstructured grid
82  void ug_coord(oops::UnstructuredGrid &, const int &) const;
83  void field_to_ug(oops::UnstructuredGrid &, const int &) const;
85 
86 // Utilities
87  void read(const eckit::Configuration &);
88  void analytic_init(const eckit::Configuration &, const GeometryQG &);
89  void write(const eckit::Configuration &) const;
90  double norm() const;
91  boost::shared_ptr<const GeometryQG> geometry() const {return geom_;}
92 
93  const util::DateTime & time() const {return time_;}
94  util::DateTime & time() {return time_;}
95 
96  int & toFortran() {return keyFlds_;}
97  const int & toFortran() const {return keyFlds_;}
98 
99  bool isForModel(const bool &) const;
100 
102 
103  private:
104  void print(std::ostream &) const;
106  boost::shared_ptr<const GeometryQG> geom_;
108  util::DateTime time_;
109 };
110 // -----------------------------------------------------------------------------
111 
112 } // namespace qg
113 #endif // QG_MODEL_FIELDSQG_H_
GomQG class to handle local model values for QG model.
Definition: GomQG.h:31
F90flds keyFlds_
Definition: FieldsQG.h:105
void read(const eckit::Configuration &)
Definition: FieldsQG.cc:170
double dot_product_with(const FieldsQG &) const
Definition: FieldsQG.cc:109
int & toFortran()
Definition: FieldsQG.h:96
void print(std::ostream &) const
Definition: FieldsQG.cc:195
void getValuesAD(const LocationsQG &, const oops::Variables &, const GomQG &)
Definition: FieldsQG.cc:140
Class to represent a FieldSet for the QG model.
Definition: FieldsQG.h:46
void dirac(const eckit::Configuration &)
Definition: FieldsQG.cc:123
void write(const eckit::Configuration &) const
Definition: FieldsQG.cc:183
void field_to_ug(oops::UnstructuredGrid &, const int &) const
Definition: FieldsQG.cc:162
void getValuesTL(const LocationsQG &, const oops::Variables &, GomQG &) const
Definition: FieldsQG.cc:134
FieldsQG(const GeometryQG &, const oops::Variables &, const util::DateTime &)
Definition: FieldsQG.cc:32
void add(const FieldsQG &)
Definition: FieldsQG.cc:150
The namespace for the main oops code.
bool isForModel(const bool &) const
Definition: FieldsQG.cc:213
int F90flds
Definition: QgFortran.h:38
util::DateTime time_
Definition: FieldsQG.h:108
void schur_product_with(const FieldsQG &)
Definition: FieldsQG.cc:115
FieldsQG & operator+=(const FieldsQG &)
Definition: FieldsQG.cc:81
double norm() const
Definition: FieldsQG.cc:189
boost::shared_ptr< const GeometryQG > geometry() const
Definition: FieldsQG.h:91
const VariablesQG vars_
Definition: FieldsQG.h:107
void changeResolution(const FieldsQG &)
Definition: FieldsQG.cc:146
void zero()
Definition: FieldsQG.cc:96
static const std::string classname()
Definition: FieldsQG.h:49
void axpy(const double &, const FieldsQG &)
Definition: FieldsQG.cc:105
const int & toFortran() const
Definition: FieldsQG.h:97
void ug_coord(oops::UnstructuredGrid &, const int &) const
Definition: FieldsQG.cc:158
void field_from_ug(const oops::UnstructuredGrid &)
Definition: FieldsQG.cc:166
oops::GridPoint getPoint(const GeometryQGIterator &) const
Definition: FieldsQG.cc:225
GeometryQG handles geometry for QG model.
Definition: GeometryQG.h:33
void getValues(const LocationsQG &, const oops::Variables &, GomQG &) const
Definition: FieldsQG.cc:128
LocationsQG class to handle locations for QG model.
Definition: LocationsQG.h:26
const util::DateTime & time() const
Definition: FieldsQG.h:93
FieldsQG & operator-=(const FieldsQG &)
Definition: FieldsQG.cc:86
void diff(const FieldsQG &, const FieldsQG &)
Definition: FieldsQG.cc:154
boost::shared_ptr< const GeometryQG > geom_
Definition: FieldsQG.h:106
FieldsQG & operator=(const FieldsQG &)
Definition: FieldsQG.cc:75
void analytic_init(const eckit::Configuration &, const GeometryQG &)
Definition: FieldsQG.cc:176
void random()
Definition: FieldsQG.cc:119
util::DateTime & time()
Definition: FieldsQG.h:94
The namespace for the qg model.
FieldsQG & operator*=(const double &)
Definition: FieldsQG.cc:91