FV3 Bundle
ObsOperators.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_OBSOPERATORS_H_
12 #define OOPS_BASE_OBSOPERATORS_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"
25 #include "oops/util/DateTime.h"
26 #include "oops/util/Logger.h"
27 #include "oops/util/Printable.h"
28 #include "oops/util/Timer.h"
29 
30 namespace oops {
31 
32 // -----------------------------------------------------------------------------
33 
34 template <typename MODEL>
35 class ObsOperators : public util::Printable,
36  private boost::noncopyable {
41 
42  public:
43  static const std::string classname() {return "oops::ObsOperators";}
44 
45  explicit ObsOperators(const ObsSpace_ &);
46  ~ObsOperators();
47 
48 /// Access
49  std::size_t size() const {return ops_.size();}
50  const ObsOperator_ & operator[](const std::size_t ii) const {return *ops_.at(ii);}
51  const Variables & variables(const std::size_t jobs) const;
52 
53  private:
54  void print(std::ostream &) const;
55  std::vector<boost::shared_ptr<ObsOperator_> > ops_;
56 };
57 
58 // -----------------------------------------------------------------------------
59 
60 template <typename MODEL>
62 {
63  for (std::size_t jobs = 0; jobs < os.size(); ++jobs) {
64  boost::shared_ptr<ObsOperator_> tmp(new ObsOperator_(os[jobs]));
65  ops_.push_back(tmp);
66  }
67 }
68 
69 // -----------------------------------------------------------------------------
70 
71 template <typename MODEL>
73 
74 // -----------------------------------------------------------------------------
75 
76 template <typename MODEL>
77 const Variables & ObsOperators<MODEL>::variables(const std::size_t jobs) const {
78  return ops_.at(jobs)->variables();
79 }
80 
81 // -----------------------------------------------------------------------------
82 
83 template<typename MODEL>
84 void ObsOperators<MODEL>::print(std::ostream & os) const {
85  for (std::size_t jobs = 0; jobs < ops_.size(); ++jobs) os << *ops_[jobs];
86 }
87 
88 // -----------------------------------------------------------------------------
89 
90 } // namespace oops
91 
92 #endif // OOPS_BASE_OBSOPERATORS_H_
static const std::string classname()
Definition: ObsOperators.h:43
ObsVector< MODEL > ObsVector_
Definition: ObsOperators.h:39
void print(std::ostream &) const
Definition: ObsOperators.h:84
std::size_t size() const
Access.
Definition: ObsOperators.h:49
The namespace for the main oops code.
const std::vector< std::string > & variables() const
Definition: Variables.h:35
ObsOperator< MODEL > ObsOperator_
Definition: ObsOperators.h:38
ObsSpaces< MODEL > ObsSpace_
Definition: ObsOperators.h:40
const ObsOperator_ & operator[](const std::size_t ii) const
Definition: ObsOperators.h:50
ObsAuxControl< MODEL > ObsAuxControl_
Definition: ObsOperators.h:37
const Variables & variables(const std::size_t jobs) const
Definition: ObsOperators.h:77
std::vector< boost::shared_ptr< ObsOperator_ > > ops_
Definition: ObsOperators.h:55
std::size_t size() const
Access.
Definition: ObsSpaces.h:51
ObsOperators(const ObsSpace_ &)
Definition: ObsOperators.h:61