11 #ifndef OOPS_INTERFACE_MODELAUXINCREMENT_H_
12 #define OOPS_INTERFACE_MODELAUXINCREMENT_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"
35 template <
typename MODEL>
37 public util::Serializable,
38 private util::ObjectCounter<ModelAuxIncrement<MODEL> > {
44 static const std::string
classname() {
return "oops::ModelAuxIncrement";}
67 void read(
const eckit::Configuration &);
68 void write(
const eckit::Configuration &)
const;
73 void serialize(std::vector<double> &)
const override;
74 void deserialize(
const std::vector<double> &,
size_t &)
override;
77 void print(std::ostream &)
const override;
78 std::unique_ptr<ModelAuxIncrement_>
aux_;
83 template <
typename MODEL>
86 Log::trace() <<
"operator+=(ModelAuxControl, ModelAuxIncrement) starting" << std::endl;
87 util::Timer timer(
"oops::ModelAuxIncrement",
"operator+=ModelAuxControl");
89 Log::trace() <<
"operator+=(ModelAuxControl, ModelAuxIncrement) done" << std::endl;
95 template<
typename MODEL>
97 const eckit::Configuration & conf) : aux_()
99 Log::trace() <<
"ModelAuxIncrement<MODEL>::ModelAuxIncrement starting" << std::endl;
100 util::Timer timer(
classname(),
"ModelAuxIncrement");
102 this->setObjectSize(
aux_->serialSize()*
sizeof(
double));
103 Log::trace() <<
"ModelAuxIncrement<MODEL>::ModelAuxIncrement done" << std::endl;
106 template<
typename MODEL>
108 const bool copy) : aux_()
110 Log::trace() <<
"ModelAuxIncrement<MODEL>::ModelAuxIncrement copy starting" << std::endl;
111 util::Timer timer(
classname(),
"ModelAuxIncrement");
113 this->setObjectSize(
aux_->serialSize()*
sizeof(
double));
114 Log::trace() <<
"ModelAuxIncrement<MODEL>::ModelAuxIncrement copy done" << std::endl;
117 template<
typename MODEL>
119 const eckit::Configuration & conf) : aux_()
121 Log::trace() <<
"ModelAuxIncrement<MODEL>::ModelAuxIncrement interpolated starting" << std::endl;
122 util::Timer timer(
classname(),
"ModelAuxIncrement");
124 this->setObjectSize(
aux_->serialSize()*
sizeof(
double));
125 Log::trace() <<
"ModelAuxIncrement<MODEL>::ModelAuxIncrement interpolated done" << std::endl;
128 template<
typename MODEL>
130 Log::trace() <<
"ModelAuxIncrement<MODEL>::~ModelAuxIncrement starting" << std::endl;
131 util::Timer timer(classname(),
"~ModelAuxIncrement");
133 Log::trace() <<
"ModelAuxIncrement<MODEL>::~ModelAuxIncrement done" << std::endl;
136 template<
typename MODEL>
138 Log::trace() <<
"ModelAuxIncrement<MODEL>::diff starting" << std::endl;
139 util::Timer timer(classname(),
"diff");
141 Log::trace() <<
"ModelAuxIncrement<MODEL>::diff done" << std::endl;
144 template<
typename MODEL>
146 Log::trace() <<
"ModelAuxIncrement<MODEL>::zero starting" << std::endl;
147 util::Timer timer(classname(),
"zero");
149 Log::trace() <<
"ModelAuxIncrement<MODEL>::zero done" << std::endl;
152 template<
typename MODEL>
154 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator= starting" << std::endl;
155 util::Timer timer(classname(),
"operator=");
157 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator= done" << std::endl;
161 template<
typename MODEL>
163 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator+= starting" << std::endl;
164 util::Timer timer(classname(),
"operator+=");
166 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator+= done" << std::endl;
170 template<
typename MODEL>
172 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator-= starting" << std::endl;
173 util::Timer timer(classname(),
"operator-=");
175 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator-= done" << std::endl;
179 template<
typename MODEL>
181 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator*= starting" << std::endl;
182 util::Timer timer(classname(),
"operator*=");
184 Log::trace() <<
"ModelAuxIncrement<MODEL>::operator*= done" << std::endl;
188 template<
typename MODEL>
190 Log::trace() <<
"ModelAuxIncrement<MODEL>::axpy starting" << std::endl;
191 util::Timer timer(classname(),
"axpy");
192 aux_->axpy(zz, *dx.
aux_);
193 Log::trace() <<
"ModelAuxIncrement<MODEL>::axpy done" << std::endl;
196 template<
typename MODEL>
198 Log::trace() <<
"ModelAuxIncrement<MODEL>::dot_product_with starting" << std::endl;
199 util::Timer timer(classname(),
"dot_product_with");
200 double zz = aux_->dot_product_with(*dx.
aux_);
201 Log::trace() <<
"ModelAuxIncrement<MODEL>::dot_product_with done" << std::endl;
205 template<
typename MODEL>
207 Log::trace() <<
"ModelAuxIncrement<MODEL>::read starting" << std::endl;
208 util::Timer timer(classname(),
"read");
210 Log::trace() <<
"ModelAuxIncrement<MODEL>::read done" << std::endl;
213 template<
typename MODEL>
215 Log::trace() <<
"ModelAuxIncrement<MODEL>::write starting" << std::endl;
216 util::Timer timer(classname(),
"write");
218 Log::trace() <<
"ModelAuxIncrement<MODEL>::write done" << std::endl;
221 template<
typename MODEL>
223 Log::trace() <<
"ModelAuxIncrement<MODEL>::norm starting" << std::endl;
224 util::Timer timer(classname(),
"norm");
225 double zz = aux_->norm();
226 Log::trace() <<
"ModelAuxIncrement<MODEL>::norm done" << std::endl;
230 template<
typename MODEL>
232 Log::trace() <<
"ModelAuxIncrement<MODEL>::serialSize" << std::endl;
233 util::Timer timer(classname(),
"serialSize");
234 return aux_->serialSize();
237 template<
typename MODEL>
239 Log::trace() <<
"ModelAuxIncrement<MODEL>::serialize starting" << std::endl;
240 util::Timer timer(classname(),
"serialize");
241 aux_->serialize(vect);
242 Log::trace() <<
"ModelAuxIncrement<MODEL>::serialize done" << std::endl;
245 template<
typename MODEL>
247 Log::trace() <<
"ModelAuxIncrement<MODEL>::deserialize starting" << std::endl;
248 util::Timer timer(classname(),
"deserialize");
249 aux_->deserialize(vect, current);
250 Log::trace() <<
"ModelAuxIncrement<MODEL>::deserialize done" << std::endl;
253 template<
typename MODEL>
255 Log::trace() <<
"ModelAuxIncrement<MODEL>::print starting" << std::endl;
256 util::Timer timer(classname(),
"print");
258 Log::trace() <<
"ModelAuxIncrement<MODEL>::print done" << std::endl;
Geometry class used in oops; subclass of interface class interface::Geometry.
const ModelAuxControl_ & modelauxcontrol() const
Interfacing.
void deserialize(const std::vector< double > &, size_t &) override
ModelAuxIncrement(const Geometry_ &, const eckit::Configuration &)
Constructor, destructor.
ModelAuxIncrement & operator+=(const ModelAuxIncrement &)
ModelAuxIncrement & operator=(const ModelAuxIncrement &)
Geometry< MODEL > Geometry_
MODEL::ModelAuxIncrement ModelAuxIncrement_
void serialize(std::vector< double > &) const override
const ModelAuxIncrement_ & modelauxincrement() const
Interfacing.
size_t serialSize() const override
Serialize and deserialize.
void read(const eckit::Configuration &)
I/O and diagnostics.
void write(const eckit::Configuration &) const
ModelAuxIncrement_ & modelauxincrement()
std::unique_ptr< ModelAuxIncrement_ > aux_
double dot_product_with(const ModelAuxIncrement &) const
void diff(const ModelAuxControl_ &, const ModelAuxControl_ &)
Linear algebra operators.
static const std::string classname()
ModelAuxControl< MODEL > ModelAuxControl_
void print(std::ostream &) const override
ModelAuxIncrement & operator-=(const ModelAuxIncrement &)
void axpy(const double &, const ModelAuxIncrement &)
ModelAuxIncrement & operator*=(const double &)
const Geometry_ & geometry() const
IODA_DL void copy(const ObjectSelection &from, ObjectSelection &to, const ScaleMapping &scale_map)
Generic data copying function.
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.