FV3 Bundle
LinearObsOperators.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 OOPS_BASE_LINEAROBSOPERATORS_H_
12 #define OOPS_BASE_LINEAROBSOPERATORS_H_
13 
14 #include <string>
15 #include <vector>
16 
17 #include <boost/noncopyable.hpp>
18 #include <boost/shared_ptr.hpp>
19 
20 #include "oops/base/ObsSpaces.h"
21 #include "oops/base/Variables.h"
26 #include "oops/util/DateTime.h"
27 #include "oops/util/Logger.h"
28 #include "oops/util/Printable.h"
29 
30 namespace oops {
31 
32 // -----------------------------------------------------------------------------
33 
34 template <typename MODEL>
35 class LinearObsOperators : public util::Printable,
36  private boost::noncopyable {
42 
43  public:
44  static const std::string classname() {return "oops::LinearObsOperators";}
45 
46  explicit LinearObsOperators(const ObsSpace_ &);
48 
49 /// Access
50  std::size_t size() const {return ops_.size();}
51  LinearObsOperator_ & operator[](const std::size_t ii) {return *ops_.at(ii);}
52  const LinearObsOperator_ & operator[](const std::size_t ii) const {return *ops_.at(ii);}
53  const Variables & variables(const std::size_t) const;
54 
55  private:
56  void print(std::ostream &) const;
57  std::vector<boost::shared_ptr<LinearObsOperator_> > ops_;
58 };
59 
60 // -----------------------------------------------------------------------------
61 
62 template <typename MODEL>
64  for (std::size_t jobs = 0; jobs < os.size(); ++jobs) {
65  boost::shared_ptr<LinearObsOperator_> tmp(new LinearObsOperator_(os[jobs]));
66  ops_.push_back(tmp);
67  }
68 }
69 
70 // -----------------------------------------------------------------------------
71 
72 template <typename MODEL>
74 
75 // -----------------------------------------------------------------------------
76 
77 template <typename MODEL>
78 const Variables & LinearObsOperators<MODEL>::variables(const std::size_t jobs) const {
79  return ops_.at(jobs)->variables();
80 }
81 
82 // -----------------------------------------------------------------------------
83 
84 template<typename MODEL>
85 void LinearObsOperators<MODEL>::print(std::ostream & os) const {
86  for (std::size_t jobs = 0; jobs < ops_.size(); ++jobs) os << *ops_[jobs];
87 }
88 
89 // -----------------------------------------------------------------------------
90 
91 } // namespace oops
92 
93 #endif // OOPS_BASE_LINEAROBSOPERATORS_H_
const Variables & variables(const std::size_t) const
ObsAuxControl< MODEL > ObsAuxControl_
const LinearObsOperator_ & operator[](const std::size_t ii) const
std::size_t size() const
Access.
The namespace for the main oops code.
const std::vector< std::string > & variables() const
Definition: Variables.h:35
LinearObsOperator_ & operator[](const std::size_t ii)
std::vector< boost::shared_ptr< LinearObsOperator_ > > ops_
void print(std::ostream &) const
ObsAuxIncrement< MODEL > ObsAuxIncrement_
ObsSpaces< MODEL > ObsSpace_
LinearObsOperators(const ObsSpace_ &)
ObsVector< MODEL > ObsVector_
LinearObsOperator< MODEL > LinearObsOperator_
static const std::string classname()
std::size_t size() const
Access.
Definition: ObsSpaces.h:51