FV3 Bundle
ObsVec1D.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 LORENZ95_OBSVEC1D_H_
12 #define LORENZ95_OBSVEC1D_H_
13 
14 #include <ostream>
15 #include <string>
16 #include <vector>
17 
18 #include <boost/shared_ptr.hpp>
19 
20 #include "oops/util/ObjectCounter.h"
21 #include "oops/util/Printable.h"
22 
23 namespace lorenz95 {
24  class ObsTable;
25 
26 // -----------------------------------------------------------------------------
27 /// Vector in observation space
28 /*!
29  * ObsVec1D is implemented as an STL vector
30  */
31 
32 class ObsVec1D : public util::Printable,
33  private util::ObjectCounter<ObsVec1D> {
34  public:
35  static const std::string classname() {return "lorenz95::ObsVec1D";}
36 
37  explicit ObsVec1D(const ObsTable &);
38  ObsVec1D(const ObsVec1D &, const bool copy = true);
39  ~ObsVec1D() {}
40 
41  ObsVec1D & operator= (const ObsVec1D &);
42  ObsVec1D & operator*= (const double &);
43  ObsVec1D & operator+= (const ObsVec1D &);
44  ObsVec1D & operator-= (const ObsVec1D &);
45  ObsVec1D & operator*= (const ObsVec1D &);
46  ObsVec1D & operator/= (const ObsVec1D &);
47 
48  void zero();
49  void axpy(const double &, const ObsVec1D &);
50  void invert();
51  void random();
52  double dot_product_with(const ObsVec1D &) const;
53  double rms() const;
54 
55  unsigned int size() const {return data_.size();}
56  double & operator() (const unsigned int ii) {return data_[ii];}
57  const double & operator() (const unsigned int ii) const {return data_[ii];}
58 
59 // I/O
60  void read(const std::string &);
61  void save(const std::string &) const;
62 
63  private:
64  void print(std::ostream &) const;
65 
66  const ObsTable & obsdb_;
67  std::vector<double> data_;
68 };
69 //-----------------------------------------------------------------------------
70 } // namespace lorenz95
71 #endif // LORENZ95_OBSVEC1D_H_
void axpy(const double &, const ObsVec1D &)
void print(std::ostream &) const
ObsVec1D & operator/=(const ObsVec1D &)
ObsVec1D & operator=(const ObsVec1D &)
ObsVec1D & operator+=(const ObsVec1D &)
subroutine, public copy(self, rhs)
void read(const std::string &)
double & operator()(const unsigned int ii)
Definition: ObsVec1D.h:56
ObsVec1D & operator*=(const double &)
Vector in observation space.
Definition: ObsVec1D.h:32
static const std::string classname()
Definition: ObsVec1D.h:35
The namespace for the L95 model.
std::vector< double > data_
Definition: ObsVec1D.h:67
ObsVec1D(const ObsTable &)
ObsVec1D & operator-=(const ObsVec1D &)
double dot_product_with(const ObsVec1D &) const
A Simple Observation Data Handler.
Definition: ObsTable.h:39
const ObsTable & obsdb_
Definition: ObsVec1D.h:66
unsigned int size() const
Definition: ObsVec1D.h:55
void save(const std::string &) const