FV3 Bundle
InterpolatorTraj.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2018 UCAR
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  */
7 
8 #ifndef OOPS_INTERFACE_INTERPOLATORTRAJ_H_
9 #define OOPS_INTERFACE_INTERPOLATORTRAJ_H_
10 
11 #include <ostream>
12 #include <string>
13 
14 #include <boost/scoped_ptr.hpp>
15 
16 #include "oops/util/Logger.h"
17 #include "oops/util/ObjectCounter.h"
18 #include "oops/util/Printable.h"
19 #include "oops/util/Timer.h"
20 
21 namespace oops {
22 
23 // -----------------------------------------------------------------------------
24 
25 template <typename MODEL>
26 class InterpolatorTraj : public util::Printable,
27  private util::ObjectCounter<InterpolatorTraj<MODEL> > {
28  typedef typename MODEL::InterpolatorTraj InterpolatorTraj_;
29 
30  public:
31  static const std::string classname() {return "oops::InterpolatorTraj";}
32 
35 
36 /// Interfacing
38  const InterpolatorTraj_ & interpolatortraj() const {return *traj_;}
39 
40  private:
43  void print(std::ostream &) const;
44  boost::scoped_ptr<InterpolatorTraj_> traj_;
45 };
46 
47 // -----------------------------------------------------------------------------
48 
49 template <typename MODEL>
51  Log::trace() << "InterpolatorTraj<MODEL>::InterpolatorTraj starting" << std::endl;
52  util::Timer timer(classname(), "InterpolatorTraj");
53  traj_.reset(new InterpolatorTraj_());
54  Log::trace() << "InterpolatorTraj<MODEL>::InterpolatorTraj done" << std::endl;
55 }
56 
57 // -----------------------------------------------------------------------------
58 
59 template <typename MODEL>
61  Log::trace() << "InterpolatorTraj<MODEL>::~InterpolatorTraj starting" << std::endl;
62  util::Timer timer(classname(), "~InterpolatorTraj");
63  traj_.reset();
64  Log::trace() << "InterpolatorTraj<MODEL>::~InterpolatorTraj done" << std::endl;
65 }
66 
67 // -----------------------------------------------------------------------------
68 
69 template <typename MODEL>
70 void InterpolatorTraj<MODEL>::print(std::ostream & os) const {
71  Log::trace() << "InterpolatorTraj<MODEL>::print starting" << std::endl;
72  util::Timer timer(classname(), "print");
73  os << *traj_;
74  Log::trace() << "InterpolatorTraj<MODEL>::print done" << std::endl;
75 }
76 
77 // -----------------------------------------------------------------------------
78 
79 } // namespace oops
80 
81 #endif // OOPS_INTERFACE_INTERPOLATORTRAJ_H_
void print(std::ostream &) const
The namespace for the main oops code.
InterpolatorTraj_ & interpolatortraj()
Interfacing.
static const std::string classname()
boost::scoped_ptr< InterpolatorTraj_ > traj_
MODEL::InterpolatorTraj InterpolatorTraj_
InterpolatorTraj & operator=(const InterpolatorTraj &)
const InterpolatorTraj_ & interpolatortraj() const