FV3 Bundle
oops/interface/Localization.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_INTERFACE_LOCALIZATION_H_
12 #define OOPS_INTERFACE_LOCALIZATION_H_
13 
14 #include <string>
15 
16 #include <boost/noncopyable.hpp>
17 #include <boost/scoped_ptr.hpp>
18 
22 #include "oops/util/Logger.h"
23 #include "oops/util/ObjectCounter.h"
24 #include "oops/util/Printable.h"
25 #include "oops/util/Timer.h"
26 
27 namespace eckit {
28  class Configuration;
29 }
30 
31 namespace oops {
32 
33 // -----------------------------------------------------------------------------
34 
35 template <typename MODEL>
36 class Localization : public util::Printable,
37  private boost::noncopyable,
38  private util::ObjectCounter<Localization<MODEL> > {
42 
43  public:
44  static const std::string classname() {return "oops::Localization";}
45 
46  Localization(const Geometry_ &, const eckit::Configuration &);
47  virtual ~Localization();
48 
49  void multiply(Increment_ &) const;
50 
51  private:
52  void print(std::ostream &) const;
53  boost::scoped_ptr<LocalizationBase_> local_;
54 };
55 
56 // =============================================================================
57 
58 template<typename MODEL>
60  const eckit::Configuration & conf) : local_()
61 {
62  Log::trace() << "Localization<MODEL>::Localization starting" << std::endl;
63  util::Timer timer(classname(), "Localization");
65  Log::trace() << "Localization<MODEL>::Localization done" << std::endl;
66 }
67 
68 // -----------------------------------------------------------------------------
69 
70 template<typename MODEL>
72  Log::trace() << "Localization<MODEL>::~Localization starting" << std::endl;
73  util::Timer timer(classname(), "~Localization");
74  local_.reset();
75  Log::trace() << "Localization<MODEL>::~Localization done" << std::endl;
76 }
77 
78 // -----------------------------------------------------------------------------
79 
80 template<typename MODEL>
82  Log::trace() << "Localization<MODEL>::mult starting" << std::endl;
83  util::Timer timer(classname(), "mult");
84  local_->multiply(dx);
85  Log::trace() << "Localization<MODEL>::mult done" << std::endl;
86 }
87 
88 // -----------------------------------------------------------------------------
89 
90 template<typename MODEL>
91 void Localization<MODEL>::print(std::ostream & os) const {
92  Log::trace() << "Localization<MODEL>::print starting" << std::endl;
93  util::Timer timer(classname(), "print");
94  os << *local_;
95  Log::trace() << "Localization<MODEL>::print done" << std::endl;
96 }
97 
98 // -----------------------------------------------------------------------------
99 
100 } // namespace oops
101 
102 #endif // OOPS_INTERFACE_LOCALIZATION_H_
void multiply(Increment_ &) const
Localization(const Geometry_ &, const eckit::Configuration &)
Definition: conf.py:1
The namespace for the main oops code.
LocalizationFactory Factory.
boost::scoped_ptr< LocalizationBase_ > local_
Base class for localizations.
Increment Class: Difference between two states.
void print(std::ostream &) const
static const std::string classname()
LocalizationBase< MODEL > LocalizationBase_