OOPS
PostProcessorTLAD.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_POSTPROCESSORTLAD_H_
12 #define OOPS_BASE_POSTPROCESSORTLAD_H_
13 
14 #include <vector>
15 
16 #include <memory>
17 
19 #include "oops/base/PostBaseTLAD.h"
21 #include "oops/interface/State.h"
22 
23 namespace oops {
24 
25 /// Control model post processing
26 /*!
27  * This class controls model post processing in the most general sense,
28  * ie all diagnostics computations that do not affect the model integration.
29  * It just calls all the individual processors one by one.
30  */
31 
32 template<typename MODEL>
37 
38  public:
42 
44  if (pp != 0) {
45  std::shared_ptr<PostBaseTLAD_> sp(pp);
46  processors_.push_back(sp);
47  }
48  }
49 
50  void enrollProcessor(std::shared_ptr<PostBaseTLAD_> pp) {
51  if (pp != 0) processors_.push_back(pp);
52  }
53 
54 /// Set linearization state
55  void initializeTraj(const State_ & xx, const util::DateTime & end,
56  const util::Duration & step) {
57  for (auto & jp : processors_) {
58  jp->initializeTraj(xx, end, step);
59  }
60  }
61 
62  void processTraj(const State_ & xx) {
63  for (auto & jp : processors_) {
64  jp->processTraj(xx);
65  }
66  }
67 
68  void finalizeTraj(const State_ & xx) {
69  for (auto & jp : processors_) {
70  jp->finalizeTraj(xx);
71  }
72  }
73 
74 /// Tangent linear methods
75  void initializeTL(const Increment_ & dx, const util::DateTime & end,
76  const util::Duration & step) {
77  for (auto & jp : processors_) {
78  jp->initializeTL(dx, end, step);
79  }
80  }
81 
82  void processTL(const Increment_ & dx) {
83  for (auto & jp : processors_) {
84  jp->processTL(dx);
85  }
86  }
87 
88  void finalizeTL(const Increment_ & dx) {
89  for (auto & jp : processors_) {
90  jp->finalizeTL(dx);
91  }
92  }
93 
94 /// Get TL dual space output
95  std::unique_ptr<GeneralizedDepartures> releaseOutputFromTL(unsigned int ii) {
96  return processors_[ii]->releaseOutputFromTL();
97  }
98 
99 /// Adjoint methods
100  void initializeAD(Increment_ & dx, const util::DateTime & bgn,
101  const util::Duration & step) {
102  for (auto & jp : processors_) {
103  jp->initializeAD(dx, bgn, step);
104  }
105  }
106 
107  void processAD(Increment_ & dx) {
108  for (auto & jp : processors_) {
109  jp->processAD(dx);
110  }
111  }
112 
113  void finalizeAD(Increment_ & dx) {
114  for (auto & jp : processors_) {
115  jp->finalizeAD(dx);
116  }
117  }
118 
119  private:
120  std::vector< std::shared_ptr<PostBaseTLAD_> > processors_;
122 };
123 
124 } // namespace oops
125 
126 #endif // OOPS_BASE_POSTPROCESSORTLAD_H_
oops
The namespace for the main oops code.
Definition: ErrorCovarianceL95.cc:22
oops::PostProcessorTLAD::Increment_
Increment< MODEL > Increment_
Definition: PostProcessorTLAD.h:34
oops::PostProcessorTLAD::PostProcessorTLAD
PostProcessorTLAD(const PostProcessorTLAD &pp)
Definition: PostProcessorTLAD.h:40
PostBaseTLAD.h
oops::PostBaseTLAD
Handles post-processing of model fields related to cost function.
Definition: PostBaseTLAD.h:41
oops::PostProcessorTLAD::finalizeTL
void finalizeTL(const Increment_ &dx)
Definition: PostProcessorTLAD.h:88
oops::PostProcessorTLAD::finalizeTraj
void finalizeTraj(const State_ &xx)
Definition: PostProcessorTLAD.h:68
oops::PostProcessorTLAD::PostProcessorTLAD
PostProcessorTLAD()
Definition: PostProcessorTLAD.h:39
oops::PostProcessorTLAD::processors_
std::vector< std::shared_ptr< PostBaseTLAD_ > > processors_
Definition: PostProcessorTLAD.h:120
oops::PostProcessorTLAD::initializeTraj
void initializeTraj(const State_ &xx, const util::DateTime &end, const util::Duration &step)
Set linearization state.
Definition: PostProcessorTLAD.h:55
oops::PostProcessorTLAD::initializeAD
void initializeAD(Increment_ &dx, const util::DateTime &bgn, const util::Duration &step)
Adjoint methods.
Definition: PostProcessorTLAD.h:100
oops::PostProcessorTLAD::releaseOutputFromTL
std::unique_ptr< GeneralizedDepartures > releaseOutputFromTL(unsigned int ii)
Get TL dual space output.
Definition: PostProcessorTLAD.h:95
oops::PostProcessorTLAD::~PostProcessorTLAD
~PostProcessorTLAD()
Definition: PostProcessorTLAD.h:41
oops::PostProcessorTLAD::enrollProcessor
void enrollProcessor(PostBaseTLAD_ *pp)
Definition: PostProcessorTLAD.h:43
oops::PostProcessorTLAD::finalizeAD
void finalizeAD(Increment_ &dx)
Definition: PostProcessorTLAD.h:113
oops::PostProcessorTLAD::State_
State< MODEL > State_
Definition: PostProcessorTLAD.h:36
oops::PostProcessorTLAD
Control model post processing.
Definition: PostProcessorTLAD.h:33
oops::State
Encapsulates the model state.
Definition: CostJbState.h:28
State.h
GeneralizedDepartures.h
oops::PostProcessorTLAD::processTL
void processTL(const Increment_ &dx)
Definition: PostProcessorTLAD.h:82
oops::PostProcessorTLAD::operator=
PostProcessorTLAD operator=(const PostProcessorTLAD &)
oops::PostProcessorTLAD::enrollProcessor
void enrollProcessor(std::shared_ptr< PostBaseTLAD_ > pp)
Definition: PostProcessorTLAD.h:50
oops::Increment
Increment Class: Difference between two states.
Definition: CostJbState.h:27
oops::PostProcessorTLAD::processAD
void processAD(Increment_ &dx)
Definition: PostProcessorTLAD.h:107
oops::PostProcessorTLAD::processTraj
void processTraj(const State_ &xx)
Definition: PostProcessorTLAD.h:62
oops::PostProcessorTLAD::initializeTL
void initializeTL(const Increment_ &dx, const util::DateTime &end, const util::Duration &step)
Tangent linear methods.
Definition: PostProcessorTLAD.h:75
oops::PostProcessorTLAD::PostBaseTLAD_
PostBaseTLAD< MODEL > PostBaseTLAD_
Definition: PostProcessorTLAD.h:35
Increment.h