11 #ifndef OOPS_ASSIMILATION_COSTJB4D_H_ 12 #define OOPS_ASSIMILATION_COSTJB4D_H_ 16 #include <boost/ptr_container/ptr_vector.hpp> 17 #include <boost/scoped_ptr.hpp> 19 #include "eckit/config/LocalConfiguration.h" 27 #include "oops/util/DateTime.h" 28 #include "oops/util/dot_product.h" 29 #include "oops/util/Duration.h" 30 #include "oops/util/Logger.h" 33 template<
typename MODEL>
class ControlIncrement;
34 template<
typename MODEL>
class JqTerm;
35 template<
typename MODEL>
class JqTermTLAD;
55 const util::Duration &,
const State4D_ &);
87 unsigned int nstates()
const override {
return B_.size();}
92 boost::ptr_vector< ModelSpaceCovarianceBase<MODEL> >
B_;
94 boost::scoped_ptr<const Geometry_>
resol_;
96 const eckit::LocalConfiguration
conf_;
104 template<
typename MODEL>
107 : xb_(
xb), B_(), ctlvars_(ctlvars), resol_(), times_(), conf_(config,
"Covariance")
109 Log::trace() <<
"CostJb4D contructed." << std::endl;
114 template<
typename MODEL>
120 std::vector<eckit::LocalConfiguration> confs;
121 conf_.get(
"covariance_time", confs);
122 for (
unsigned jsub = 0; jsub < fg.
size(); ++jsub) {
124 xb_[jsub], fg[jsub]));
125 times_.push_back(fg[jsub].validTime());
132 template<
typename MODEL>
140 template<
typename MODEL>
148 template<
typename MODEL>
150 for (
unsigned k1 = 0; k1 < B_.size(); ++k1) {
155 for (
unsigned k2 = 0; k2 < B_.size(); ++k2) {
159 B_[k2].multiply(dxin[k2], dout);
167 template<
typename MODEL>
169 Log::warning() <<
"*** B inverse might not always exist ***" << std::endl;
170 for (
unsigned jsub = 0; jsub < B_.size(); ++jsub) {
171 B_[jsub].inverseMultiply(dxin[jsub], dxout[jsub]);
173 Log::warning() <<
"*** B inverse might not always exist ***" << std::endl;
178 template<
typename MODEL>
180 for (
unsigned jsub = 0; jsub < B_.size(); ++jsub) {
181 B_[jsub].randomize(dx[jsub]);
187 template<
typename MODEL>
198 #endif // OOPS_ASSIMILATION_COSTJB4D_H_
integer, parameter, public warning
boost::scoped_ptr< const Geometry_ > resol_
void diff(const State4D_ &, const State4D_ &)
Linear algebra operators.
JqTermTLAD< MODEL > * initializeJqTL() const override
Empty TL Jq observer.
std::vector< util::DateTime > times_
void linearize(const State4D_ &, const Geometry_ &) override
Linearize before the linear computations.
The namespace for the main oops code.
State4D< MODEL > State4D_
Increment4D< MODEL > Increment4D_
Increment< MODEL > Increment_
Increment_ * newStateIncrement(const unsigned int) const override
CostJb4D(const eckit::Configuration &, const Geometry_ &, const Variables &, const util::Duration &, const State4D_ &)
Construct .
void Bminv(const Increment4D_ &, Increment4D_ &) const override
void randomize(Increment4D_ &) const override
Randomize.
virtual ~CostJb4D()
Destructor.
boost::ptr_vector< ModelSpaceCovarianceBase< MODEL > > B_
Jb Cost Function Base Class.
void addGradient(const Increment4D_ &, Increment4D_ &, Increment4D_ &) const override
Add Jb gradient.
JqTermTLAD< MODEL > * initializeJqTLAD() const override
unsigned int nstates() const override
Create new increment (set to 0).
Geometry< MODEL > Geometry_
Increment Class: Difference between two states.
JqTermTLAD< MODEL > * initializeJqAD(const Increment4D_ &) const override
Empty AD Jq observer.
ControlIncrement< MODEL > CtrlInc_
bool checkStatesNumber(const unsigned int nn) const
Get model space control variable.
void Bmult(const Increment4D_ &, Increment4D_ &) const override
Multiply by and .
JqTerm< MODEL > * initializeJq() const override
Empty Jq observer.
void computeIncrement(const State4D_ &, const State4D_ &, Increment4D_ &) const override
Get increment from state (usually first guess).
const eckit::LocalConfiguration conf_