OOPS
ObsBiasIncrement.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_OBSBIASINCREMENT_H_
12 #define QG_MODEL_OBSBIASINCREMENT_H_
13 
14 #include <iostream>
15 #include <vector>
16 
18 #include "oops/util/Printable.h"
19 #include "oops/util/Serializable.h"
20 
21 namespace eckit {
22  class Configuration;
23 }
24 
25 namespace qg {
26  class ObsBias;
27  class ObsSpaceQG;
28 
29 // -----------------------------------------------------------------------------
30 
31 class ObsBiasIncrement : public util::Printable,
32  public util::Serializable {
33  public:
35 
36 /// Constructor, destructor
38  ObsBiasIncrement(const ObsSpaceQG &, const Parameters_ &);
39  ObsBiasIncrement(const ObsBiasIncrement &, const bool copy = true);
40 
41 /// Linear algebra operators
42  void diff(const ObsBias &, const ObsBias &);
43  void zero();
47  ObsBiasIncrement & operator*=(const double);
48  void axpy(const double, const ObsBiasIncrement &);
49  double dot_product_with(const ObsBiasIncrement &) const;
50 
51 /// I/O and diagnostics
52  void read(const eckit::Configuration &) {}
53  void write(const eckit::Configuration &) const {}
54  double norm() const;
55 
56  double & operator[](const unsigned int ii) {return bias_[ii];}
57  const double & operator[](const unsigned int ii) const {return bias_[ii];}
58 
59  double & stream() {return bias_[0];}
60  double & wind() {return bias_[1];}
61  double & wspd() {return bias_[3];}
62  const double & stream() const {return bias_[0];}
63  const double & wind() const {return bias_[1];}
64  const double & wspd() const {return bias_[3];}
65 
66 /// Serialization
67  size_t serialSize() const override;
68  void serialize(std::vector<double> &) const override;
69  void deserialize(const std::vector<double> &, size_t &) override;
70 
71  private:
72  void print(std::ostream &) const override;
73  void makePassive();
74 
75  std::vector<double> bias_;
76  std::vector<bool> active_;
77 };
78 
79 // -----------------------------------------------------------------------------
80 
81 } // namespace qg
82 
83 #endif // QG_MODEL_OBSBIASINCREMENT_H_
Class to handle observation bias parameters.
void read(const eckit::Configuration &)
I/O and diagnostics.
void write(const eckit::Configuration &) const
void print(std::ostream &) const override
std::vector< bool > active_
const double & operator[](const unsigned int ii) const
size_t serialSize() const override
Serialization.
void deserialize(const std::vector< double > &, size_t &) override
ObsBiasIncrement()
Constructor, destructor.
void axpy(const double, const ObsBiasIncrement &)
double dot_product_with(const ObsBiasIncrement &) const
ObsBiasIncrement & operator*=(const double)
const double & stream() const
const double & wspd() const
const double & wind() const
ObsBiasIncrement & operator=(const ObsBiasIncrement &)
std::vector< double > bias_
void serialize(std::vector< double > &) const override
ObsBiasParameters Parameters_
void diff(const ObsBias &, const ObsBias &)
Linear algebra operators.
ObsBiasIncrement & operator+=(const ObsBiasIncrement &)
double & operator[](const unsigned int ii)
ObsBiasIncrement & operator-=(const ObsBiasIncrement &)
ObsSpace for QG model.
Definition: ObsSpaceQG.h:81
Definition: FieldL95.h:22
The namespace for the qg model.