17 #include "atlas/field.h" 
   19 #include "eckit/exception/Exceptions.h" 
   21 #include "oops/util/abor1_cpp.h" 
   22 #include "oops/util/DateTime.h" 
   23 #include "oops/util/dot_product.h" 
   24 #include "oops/util/Duration.h" 
   25 #include "oops/util/Logger.h" 
   26 #include "oops/util/stringFunctions.h" 
   38 namespace sf = util::stringfunctions;
 
   46                            const util::DateTime & vt)
 
   47   : fld_(resol), time_(vt)
 
   50   oops::Log::trace() << 
"IncrementL95::IncrementL95 created." << std::endl;
 
   54   : fld_(resol), time_(dx.time_)
 
   57   oops::Log::trace() << 
"IncrementL95::IncrementL95 created by interpolation." << std::endl;
 
   61   : fld_(dx.fld_, copy), time_(dx.time_)
 
   63   oops::Log::trace() << 
"IncrementL95::IncrementL95 copy-created." << std::endl;
 
   67   oops::Log::trace() << 
"IncrementL95::~IncrementL95 destructed" << std::endl;
 
  125   double zz = dot_product(
fld_, other.
fld_);
 
  144   std::string filename(config.getString(
"filename"));
 
  145   sf::swapNameMember(config, filename);
 
  146   oops::Log::trace() << 
"IncrementL95::read opening " << filename << std::endl;
 
  147   std::ifstream fin(filename.c_str());
 
  148   if (!fin.is_open()) ABORT(
"IncrementL95::read: Error opening file: " + filename);
 
  156   const util::DateTime tt(stime);
 
  157   const util::DateTime tc(config.getString(
"date"));
 
  159     ABORT(
"IncrementL95::read: date and data file inconsistent.");
 
  166   oops::Log::trace() << 
"IncrementL95::read: file closed." << std::endl;
 
  170   std::string dir = config.getString(
"datadir");
 
  171   std::string exp = config.getString(
"exp");
 
  172   std::string type = config.getString(
"type");
 
  173   std::string filename = dir+
"/"+exp+
"."+type;
 
  175   if (type == 
"krylov") {
 
  176     std::string iter = config.getString(
"iteration");
 
  177     filename += 
"."+iter;
 
  180   const util::DateTime antime(config.getString(
"date"));
 
  181   filename += 
"."+antime.toString();
 
  182   const util::Duration step = 
time_ - antime;
 
  183   filename += 
"."+step.toString();
 
  184   sf::swapNameMember(config, filename);
 
  186   oops::Log::trace() << 
"IncrementL95::write opening " << filename << std::endl;
 
  187   std::ofstream fout(filename.c_str());
 
  188   if (!fout.is_open()) ABORT(
"IncrementL95::write: Error opening file: " + filename);
 
  191   fout << 
time_ << std::endl;
 
  196   oops::Log::trace() << 
"IncrementL95::write file closed." << std::endl;
 
  200   os << std::endl << 
" Valid time: " << 
time_;
 
  201   os << std::endl << 
fld_;
 
  205   std::vector<std::string> vars;
 
  207   std::vector<double> vals;
 
  209   std::vector<int> varlens;
 
  210   varlens.push_back(1);
 
  215   std::vector<double> vals;
 
  223   ABORT(
"FieldL95 setAtlas not implemented");
 
  227   ABORT(
"FieldL95 toAtlas not implemented");
 
  231   ABORT(
"FieldL95 fromAtlas not implemented");
 
  239   nn += 
time_.serialSize();
 
  244   vect.push_back(1000.0);
 
  246   vect.push_back(2000.0);
 
  247   time_.serialize(vect);
 
  248   vect.push_back(3000.0);
 
  253   ASSERT(vect.at(index) == 1000.0);
 
  256   ASSERT(vect.at(index) == 2000.0);
 
  258   time_.deserialize(vect, index);
 
  259   ASSERT(vect.at(index) == 3000.0);
 
void write(std::ofstream &) const
 
void diff(const FieldL95 &, const FieldL95 &)
 
const int & resol() const
Set and get.
 
void deserialize(const std::vector< double > &, size_t &) override
 
void axpy(const double &, const FieldL95 &)
 
void schur(const FieldL95 &)
 
void zero()
Linear algebra.
 
void dirac(const eckit::Configuration &)
 
void serialize(std::vector< double > &) const override
 
void read(std::ifstream &)
Utilities.
 
size_t serialSize() const override
Serialize and deserialize.
 
Increment Class: Difference between two states.
 
void diff(const StateL95 &, const StateL95 &)
Basic operators.
 
void accumul(const double &, const StateL95 &)
 
void setLocal(const oops::LocalIncrement &, const Iterator &)
 
void deserialize(const std::vector< double > &, size_t &) override
 
IncrementL95 & operator=(const IncrementL95 &)
 
void write(const eckit::Configuration &) const
 
void axpy(const double &, const IncrementL95 &, const bool check=true)
 
IncrementL95 & operator-=(const IncrementL95 &)
 
IncrementL95 & operator*=(const double &)
 
oops::LocalIncrement getLocal(const Iterator &) const
 
void schur_product_with(const IncrementL95 &)
 
void toAtlas(atlas::FieldSet *) const
 
void read(const eckit::Configuration &)
Utilities.
 
double dot_product_with(const IncrementL95 &) const
 
void print(std::ostream &) const override
 
void serialize(std::vector< double > &) const override
 
void fromAtlas(atlas::FieldSet *)
 
size_t serialSize() const override
Serialize and deserialize.
 
void dirac(const eckit::Configuration &)
 
void setAtlas(atlas::FieldSet *) const
ATLAS.
 
IncrementL95 & operator+=(const IncrementL95 &)
 
IncrementL95(const Resolution &, const oops::Variables &, const util::DateTime &)
Constructor, destructor.
 
const FieldL95 & getField() const
 
const util::DateTime & validTime() const
 
const std::vector< double > & getVals() const
 
The namespace for the L95 model.
 
The namespace for the main oops code.