11 #ifndef OOPS_INTERFACE_OBSAUXINCREMENT_H_
12 #define OOPS_INTERFACE_OBSAUXINCREMENT_H_
21 #include "oops/util/Logger.h"
22 #include "oops/util/ObjectCounter.h"
23 #include "oops/util/Printable.h"
24 #include "oops/util/Serializable.h"
25 #include "oops/util/Timer.h"
40 template <
typename OBS>
42 public util::Serializable,
43 private util::ObjectCounter<ObsAuxIncrement<OBS> > {
50 static const std::string
classname() {
return "oops::ObsAuxIncrement";}
79 void read(
const eckit::Configuration &);
81 void write(
const eckit::Configuration &)
const;
87 void serialize(std::vector<double> &)
const override;
88 void deserialize(
const std::vector<double> &,
size_t &)
override;
91 void print(std::ostream &)
const override;
92 std::unique_ptr<ObsAuxIncrement_>
aux_;
97 template <
typename OBS>
99 Log::trace() <<
"operator+=(ObsAuxControl, ObsAuxIncrement) starting" << std::endl;
100 util::Timer timer(
"oops::ObsAuxIncrement",
"operator+=ObsAuxControl");
102 Log::trace() <<
"operator+=(ObsAuxControl, ObsAuxIncrement) done" << std::endl;
108 template<
typename OBS>
112 Log::trace() <<
"ObsAuxIncrement<OBS>::ObsAuxIncrement starting" << std::endl;
113 util::Timer timer(
classname(),
"ObsAuxIncrement");
115 this->setObjectSize(
aux_->serialSize()*
sizeof(
double));
116 Log::trace() <<
"ObsAuxIncrement<OBS>::ObsAuxIncrement done" << std::endl;
119 template<
typename OBS>
121 const bool copy) : aux_()
123 Log::trace() <<
"ObsAuxIncrement<OBS>::ObsAuxIncrement copy starting" << std::endl;
124 util::Timer timer(
classname(),
"ObsAuxIncrement");
126 this->setObjectSize(
aux_->serialSize()*
sizeof(
double));
127 Log::trace() <<
"ObsAuxIncrement<OBS>::ObsAuxIncrement copy done" << std::endl;
130 template<
typename OBS>
132 Log::trace() <<
"ObsAuxIncrement<OBS>::~ObsAuxIncrement starting" << std::endl;
133 util::Timer timer(classname(),
"~ObsAuxIncrement");
135 Log::trace() <<
"ObsAuxIncrement<OBS>::~ObsAuxIncrement done" << std::endl;
138 template<
typename OBS>
140 Log::trace() <<
"ObsAuxIncrement<OBS>::diff starting" << std::endl;
141 util::Timer timer(classname(),
"diff");
143 Log::trace() <<
"ObsAuxIncrement<OBS>::diff done" << std::endl;
146 template<
typename OBS>
148 Log::trace() <<
"ObsAuxIncrement<OBS>::zero starting" << std::endl;
149 util::Timer timer(classname(),
"zero");
151 Log::trace() <<
"ObsAuxIncrement<OBS>::zero done" << std::endl;
154 template<
typename OBS>
156 Log::trace() <<
"ObsAuxIncrement<OBS>::operator= starting" << std::endl;
157 util::Timer timer(classname(),
"operator=");
159 Log::trace() <<
"ObsAuxIncrement<OBS>::operator= done" << std::endl;
163 template<
typename OBS>
165 Log::trace() <<
"ObsAuxIncrement<OBS>::operator+= starting" << std::endl;
166 util::Timer timer(classname(),
"operator+=");
168 Log::trace() <<
"ObsAuxIncrement<OBS>::operator+= done" << std::endl;
172 template<
typename OBS>
174 Log::trace() <<
"ObsAuxIncrement<OBS>::operator-= starting" << std::endl;
175 util::Timer timer(classname(),
"operator-=");
177 Log::trace() <<
"ObsAuxIncrement<OBS>::operator-= done" << std::endl;
181 template<
typename OBS>
183 Log::trace() <<
"ObsAuxIncrement<OBS>::operator*= starting" << std::endl;
184 util::Timer timer(classname(),
"operator*=");
186 Log::trace() <<
"ObsAuxIncrement<OBS>::operator*= done" << std::endl;
190 template<
typename OBS>
192 Log::trace() <<
"ObsAuxIncrement<OBS>::axpy starting" << std::endl;
193 util::Timer timer(classname(),
"axpy");
194 aux_->axpy(zz, *dx.
aux_);
195 Log::trace() <<
"ObsAuxIncrement<OBS>::axpy done" << std::endl;
198 template<
typename OBS>
200 Log::trace() <<
"ObsAuxIncrement<OBS>::dot_product_with starting" << std::endl;
201 util::Timer timer(classname(),
"dot_product_with");
202 double zz = aux_->dot_product_with(*dx.
aux_);
203 Log::trace() <<
"ObsAuxIncrement<OBS>::dot_product_with done" << std::endl;
207 template<
typename OBS>
209 Log::trace() <<
"ObsAuxIncrement<OBS>::read starting" << std::endl;
210 util::Timer timer(classname(),
"read");
212 Log::trace() <<
"ObsAuxIncrement<OBS>::read done" << std::endl;
215 template<
typename OBS>
217 Log::trace() <<
"ObsAuxIncrement<OBS>::write starting" << std::endl;
218 util::Timer timer(classname(),
"write");
220 Log::trace() <<
"ObsAuxIncrement<OBS>::write done" << std::endl;
223 template<
typename OBS>
225 Log::trace() <<
"ObsAuxIncrement<OBS>::norm starting" << std::endl;
226 util::Timer timer(classname(),
"norm");
227 double zz = aux_->norm();
228 Log::trace() <<
"ObsAuxIncrement<OBS>::norm done" << std::endl;
232 template<
typename OBS>
234 Log::trace() <<
"ObsAuxIncrement<OBS>::serialSize" << std::endl;
235 util::Timer timer(classname(),
"serialSize");
236 return aux_->serialSize();
239 template<
typename OBS>
241 Log::trace() <<
"ObsAuxIncrement<OBS>::serialize starting" << std::endl;
242 util::Timer timer(classname(),
"serialize");
243 aux_->serialize(vect);
244 Log::trace() <<
"ObsAuxIncrement<OBS>::serialize done" << std::endl;
247 template<
typename OBS>
249 Log::trace() <<
"ObsAuxIncrement<OBS>::deserialize starting" << std::endl;
250 util::Timer timer(classname(),
"deserialize");
251 aux_->deserialize(vect, current);
252 Log::trace() <<
"ObsAuxIncrement<OBS>::deserialize done" << std::endl;
255 template<
typename OBS>
257 Log::trace() <<
"ObsAuxIncrement<OBS>::print starting" << std::endl;
258 util::Timer timer(classname(),
"print");
260 Log::trace() <<
"ObsAuxIncrement<OBS>::print done" << std::endl;
Auxiliary state related to observations, templated on <OBS>
const ObsAuxControl_ & obsauxcontrol() const
const Accessor
Auxiliary increment related to observations, templated on <OBS>
double norm() const
Norm (used in tests)
std::unique_ptr< ObsAuxIncrement_ > aux_
double dot_product_with(const ObsAuxIncrement &dx) const
dot product with dx ObsAuxIncrement
ObsAuxControl< OBS > ObsAuxControl_
OBS::ObsAuxIncrement ObsAuxIncrement_
ObsAuxIncrement_::Parameters_ Parameters_
void zero()
Zero out this ObsAuxIncrement.
void axpy(const double &, const ObsAuxIncrement &)
ObsAuxIncrement & operator*=(const double &)
void serialize(std::vector< double > &) const override
void deserialize(const std::vector< double > &, size_t &) override
ObsAuxIncrement(const ObsSpace< OBS > &os, const Parameters_ ¶ms)
Constructor for specified ObsSpace os and params.
void read(const eckit::Configuration &)
Read this ObsAuxIncrement from file.
ObsAuxIncrement_ & obsauxincrement()
Accessor.
size_t serialSize() const override
Serialize and deserialize (used in 4DEnVar, weak-constraint 4DVar and Block-Lanczos minimizer)
void write(const eckit::Configuration &) const
Write this ObsAuxIncrement out to file.
ObsAuxIncrement & operator-=(const ObsAuxIncrement &)
ObsAuxIncrement & operator=(const ObsAuxIncrement &)
Linear algebra operators.
void print(std::ostream &) const override
const ObsAuxIncrement_ & obsauxincrement() const
const Accessor
~ObsAuxIncrement()
Destructor (defined explicitly for timing and tracing)
static const std::string classname()
void diff(const ObsAuxControl_ &, const ObsAuxControl_ &)
Sets this ObsAuxIncrement to the difference between two ObsAuxControl objects.
ObsAuxIncrement & operator+=(const ObsAuxIncrement &)
ObsSpace_ & obsspace() const
Interfacing.
The namespace for the main oops code.
State< MODEL > & operator+=(State< MODEL > &xx, const Increment< MODEL > &dx)
Add on dx incrment to model state xx.