8 #ifndef OOPS_BASE_OBSVECTOR_H_
9 #define OOPS_BASE_OBSVECTOR_H_
20 #include "oops/util/gatherPrint.h"
33 template <
typename OBS>
38 static const std::string
classname() {
return "oops::ObsVector";}
60 unsigned int nobs()
const;
63 void print(std::ostream &)
const;
69 template <
typename OBS>
71 : interface::
ObsVector<OBS>(os, name), commTime_(&os.timeComm()) {}
75 template <
typename OBS>
77 : interface::
ObsVector<OBS>(std::move(obsvector)), commTime_(&timeComm) {}
81 template <
typename OBS>
83 commTime_(other.commTime_) {}
87 template <
typename OBS>
90 commTime_->allReduceInPlace(zz, eckit::mpi::Operation::SUM);
96 template <
typename OBS>
100 double zzz = zz * zz *
static_cast<double>(ntot);
101 commTime_->allReduceInPlace(zzz, eckit::mpi::Operation::SUM);
104 zzz /=
static_cast<double>(ntot);
114 template <
typename OBS>
117 commTime_->allReduceInPlace(nobs, eckit::mpi::Operation::SUM);
123 template <
typename OBS>
125 if (commTime_->size() > 1) {
126 gatherPrint(os, this->obsvector(), *commTime_);
128 os << this->obsvector();
ObsVector class used in oops; subclass of interface class interface::ObsVector.
OBS::ObsVector ObsVector_
unsigned int nobs() const
Number of non-masked out observations (across all MPI tasks)
const eckit::mpi::Comm * commTime_
void print(std::ostream &) const
double rms() const
Return this ObsVector rms.
double dot_product_with(const ObsVector &other) const
Return the dot product between this ObsVector and other ObsVector.
ObsVector(const ObsSpace< OBS > &obsspace, const std::string name="")
static const std::string classname()
Holds observation vector (e.g. vector of observation values, or of computed H(x))
double rms() const
Return this ObsVector rms.
unsigned int nobs() const
Number of non-masked out observations (across all MPI tasks)
ObsVector_ & obsvector()
Accessor.
double dot_product_with(const ObsVector &other) const
Return the dot product between this ObsVector and another one other.
The namespace for the main oops code.