FV3 Bundle
IncrementQG.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_INCREMENTQG_H_
12 #define QG_MODEL_INCREMENTQG_H_
13 
14 #include <ostream>
15 #include <string>
16 
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/shared_ptr.hpp>
19 
20 #include "model/FieldsQG.h"
21 #include "model/GeometryQG.h"
23 #include "oops/util/DateTime.h"
24 #include "oops/util/dot_product.h"
25 #include "oops/util/Duration.h"
26 #include "oops/util/ObjectCounter.h"
27 #include "oops/util/Printable.h"
28 
29 namespace eckit {
30  class Configuration;
31 }
32 
33 namespace oops {
34  class UnstructuredGrid;
35  class Variables;
36 }
37 
38 namespace qg {
39  class GomQG;
40  class LocationsQG;
41  class ModelBiasIncrement;
42  class ErrorCovarianceQG;
43  class StateQG;
44  class Nothing;
45 
46 /// Increment Class: Difference between two states
47 /*!
48  * Some fields that are present in a State may not be present in
49  * an Increment. The Increment contains everything that is needed by
50  * the tangent-linear and adjoint models.
51  */
52 
53 // -----------------------------------------------------------------------------
54 
56  public util::Printable,
57  private util::ObjectCounter<IncrementQG> {
58  public:
59  static const std::string classname() {return "qg::IncrementQG";}
60 
61 /// Constructor, destructor
62  IncrementQG(const GeometryQG &, const oops::Variables &, const util::DateTime &);
63  IncrementQG(const GeometryQG &, const IncrementQG &);
64  IncrementQG(const IncrementQG &, const bool);
65  IncrementQG(const IncrementQG &);
66  virtual ~IncrementQG();
67 
68 /// Basic operators
69  void diff(const StateQG &, const StateQG &);
70  void zero();
71  void zero(const util::DateTime &);
75  IncrementQG & operator*=(const double &);
76  void axpy(const double &, const IncrementQG &, const bool check = true);
77  double dot_product_with(const IncrementQG &) const;
78  void schur_product_with(const IncrementQG &);
79  void random();
80  void dirac(const eckit::Configuration &);
81 
82 /// Get increment values at observation locations
83  void getValuesTL(const LocationsQG &, const oops::Variables &,
84  GomQG &, const Nothing &) const;
85  void getValuesAD(const LocationsQG &, const oops::Variables &,
86  const GomQG &, const Nothing &);
87 
88 /// I/O and diagnostics
89  void read(const eckit::Configuration &);
90  void write(const eckit::Configuration &) const;
91  double norm() const {return fields_->norm();}
92  const util::DateTime & validTime() const {return fields_->time();}
93  util::DateTime & validTime() {return fields_->time();}
94  void updateTime(const util::Duration & dt) {fields_->time() += dt;}
95 
96 /// Unstructured grid
97  void ug_coord(oops::UnstructuredGrid &, const int &) const;
98  void field_to_ug(oops::UnstructuredGrid &, const int &) const;
100 
101 /// Access to fields
102  FieldsQG & fields() {return *fields_;}
103  const FieldsQG & fields() const {return *fields_;}
104 
105  boost::shared_ptr<const GeometryQG> geometry() const {
106  return fields_->geometry();
107  }
108 
109 /// Other
110  void accumul(const double &, const StateQG &);
111 
112 /// Data
113  private:
114  void print(std::ostream &) const;
115  boost::scoped_ptr<FieldsQG> fields_;
116  boost::scoped_ptr<FieldsQG> stash_;
117 };
118 // -----------------------------------------------------------------------------
119 
120 } // namespace qg
121 
122 #endif // QG_MODEL_INCREMENTQG_H_
IncrementQG & operator-=(const IncrementQG &)
Definition: IncrementQG.cc:90
void field_from_ug(const oops::UnstructuredGrid &)
Definition: IncrementQG.cc:157
GomQG class to handle local model values for QG model.
Definition: GomQG.h:31
void write(const eckit::Configuration &) const
Definition: IncrementQG.cc:167
FieldsQG & fields()
Access to fields.
Definition: IncrementQG.h:102
IncrementQG(const GeometryQG &, const oops::Variables &, const util::DateTime &)
Constructor, destructor.
Definition: IncrementQG.cc:38
Class to represent a FieldSet for the QG model.
Definition: FieldsQG.h:46
boost::scoped_ptr< FieldsQG > fields_
Definition: IncrementQG.h:115
void read(const eckit::Configuration &)
I/O and diagnostics.
Definition: IncrementQG.cc:163
void dirac(const eckit::Configuration &)
Definition: IncrementQG.cc:131
void schur_product_with(const IncrementQG &)
Definition: IncrementQG.cc:119
void print(std::ostream &) const
Data.
Definition: IncrementQG.cc:171
virtual ~IncrementQG()
Definition: IncrementQG.cc:64
The namespace for the main oops code.
IncrementQG & operator=(const IncrementQG &)
Definition: IncrementQG.cc:79
boost::scoped_ptr< FieldsQG > stash_
Definition: IncrementQG.h:116
IncrementQG & operator+=(const IncrementQG &)
Definition: IncrementQG.cc:84
util::DateTime & validTime()
Definition: IncrementQG.h:93
static const std::string classname()
Definition: IncrementQG.h:59
const util::DateTime & validTime() const
Definition: IncrementQG.h:92
IncrementQG & operator*=(const double &)
Definition: IncrementQG.cc:96
void getValuesTL(const LocationsQG &, const oops::Variables &, GomQG &, const Nothing &) const
Get increment values at observation locations.
Definition: IncrementQG.cc:137
void ug_coord(oops::UnstructuredGrid &, const int &) const
Unstructured grid.
Definition: IncrementQG.cc:149
QG model state.
Definition: StateQG.h:50
double dot_product_with(const IncrementQG &) const
Definition: IncrementQG.cc:123
void updateTime(const util::Duration &dt)
Definition: IncrementQG.h:94
double norm() const
Definition: IncrementQG.h:91
GeometryQG handles geometry for QG model.
Definition: GeometryQG.h:33
boost::shared_ptr< const GeometryQG > geometry() const
Definition: IncrementQG.h:105
const FieldsQG & fields() const
Definition: IncrementQG.h:103
LocationsQG class to handle locations for QG model.
Definition: LocationsQG.h:26
void field_to_ug(oops::UnstructuredGrid &, const int &) const
Definition: IncrementQG.cc:153
Abstract base class for quantities.
void getValuesAD(const LocationsQG &, const oops::Variables &, const GomQG &, const Nothing &)
Definition: IncrementQG.cc:142
void axpy(const double &, const IncrementQG &, const bool check=true)
Definition: IncrementQG.cc:109
void accumul(const double &, const StateQG &)
Other.
Definition: IncrementQG.cc:115
The namespace for the qg model.
void diff(const StateQG &, const StateQG &)
Basic operators.
Definition: IncrementQG.cc:70
Increment Class: Difference between two states.
Definition: IncrementQG.h:55