FV3 Bundle
FieldL95.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef LORENZ95_FIELDL95_H_
12 #define LORENZ95_FIELDL95_H_
13 
14 #include <ostream>
15 #include <string>
16 #include <vector>
17 
18 #include "oops/util/Printable.h"
19 
20 // Forward declarations
21 namespace eckit {
22  class Configuration;
23 }
24 
25 namespace oops {
26  class UnstructuredGrid;
27 }
28 
29 namespace lorenz95 {
30  class LocsL95;
31  class GomL95;
32  class Resolution;
33 
34 // -----------------------------------------------------------------------------
35 /// Class to represent fields for the L95 model
36 class FieldL95 : public util::Printable {
37  public:
38  static const std::string classname() {return "lorenz95::FieldL95";}
39 
40 /// Constructors and basic operators
41  explicit FieldL95(const Resolution &);
42  FieldL95(const FieldL95 &, const Resolution &);
43  explicit FieldL95(const FieldL95 &, const bool copy = true);
44  ~FieldL95() {}
45 
46 /// Linear algebra
47  void zero();
48  void dirac(const eckit::Configuration &);
49  FieldL95 & operator=(const FieldL95 &);
50  FieldL95 & operator+=(const FieldL95 &);
51  FieldL95 & operator-=(const FieldL95 &);
52  FieldL95 & operator*=(const double &);
53  void diff(const FieldL95 &, const FieldL95 &);
54  void axpy(const double &, const FieldL95 &);
55  double dot_product_with(const FieldL95 &) const;
56  void schur(const FieldL95 &);
57  void random();
58  void generate(const eckit::Configuration &);
59 
60 /// Utilities
61  void read(std::ifstream &);
62  void write(std::ofstream &) const;
63  double rms() const;
64 
65 /// Set and get
66  const int & resol() const {return resol_;}
67  double & operator[](const int ii) {return x_[ii];}
68  const double & operator[](const int ii) const {return x_[ii];}
69  std::vector<double> & asVector() {return x_;}
70  const std::vector<double> & asVector() const {return x_;}
71 
72 /// Interpolate to given location
73  void interp(const LocsL95 &, GomL95 &) const;
74  void interpAD(const LocsL95 &, const GomL95 &);
75 
76 /// Unstructured grid
77  void ug_coord(oops::UnstructuredGrid &, const int &) const;
78  void field_to_ug(oops::UnstructuredGrid &, const int &) const;
80 
81  private:
82  void print(std::ostream &) const;
83  const int resol_;
84  std::vector<double> x_;
85 };
86 // -----------------------------------------------------------------------------
87 
88 } // namespace lorenz95
89 
90 #endif // LORENZ95_FIELDL95_H_
GomL95 class to handle locations for L95 model.
Definition: GomL95.h:32
const std::vector< double > & asVector() const
Definition: FieldL95.h:70
void interp(const LocsL95 &, GomL95 &) const
Interpolate to given location.
Definition: FieldL95.cc:148
void ug_coord(oops::UnstructuredGrid &, const int &) const
Unstructured grid.
Definition: FieldL95.cc:171
void field_to_ug(oops::UnstructuredGrid &, const int &) const
Definition: FieldL95.cc:175
FieldL95 & operator-=(const FieldL95 &)
Definition: FieldL95.cc:106
FieldL95(const Resolution &)
Constructors and basic operators.
Definition: FieldL95.cc:30
subroutine, public copy(self, rhs)
void diff(const FieldL95 &, const FieldL95 &)
Definition: FieldL95.cc:117
void interpAD(const LocsL95 &, const GomL95 &)
Definition: FieldL95.cc:159
void print(std::ostream &) const
Definition: FieldL95.cc:199
double & operator[](const int ii)
Definition: FieldL95.h:67
const double & operator[](const int ii) const
Definition: FieldL95.h:68
void dirac(const eckit::Configuration &)
Definition: FieldL95.cc:60
LocsL95 class to handle locations for L95 model.
Definition: LocsL95.h:28
Handles resolution.
Definition: Resolution.h:25
void field_from_ug(const oops::UnstructuredGrid &)
Definition: FieldL95.cc:179
The namespace for the main oops code.
void zero()
Linear algebra.
Definition: FieldL95.cc:56
double rms() const
Definition: FieldL95.cc:192
static const std::string classname()
Definition: FieldL95.h:38
void read(std::ifstream &)
Utilities.
Definition: FieldL95.cc:183
The namespace for the L95 model.
void schur(const FieldL95 &)
Definition: FieldL95.cc:137
double dot_product_with(const FieldL95 &) const
Definition: FieldL95.cc:130
FieldL95 & operator*=(const double &)
Definition: FieldL95.cc:112
FieldL95 & operator+=(const FieldL95 &)
Definition: FieldL95.cc:100
const int & resol() const
Set and get.
Definition: FieldL95.h:66
void generate(const eckit::Configuration &)
Definition: FieldL95.cc:75
const int resol_
Definition: FieldL95.h:83
std::vector< double > & asVector()
Definition: FieldL95.h:69
std::vector< double > x_
Definition: FieldL95.h:84
void write(std::ofstream &) const
Definition: FieldL95.cc:187
void axpy(const double &, const FieldL95 &)
Definition: FieldL95.cc:125
FieldL95 & operator=(const FieldL95 &)
Definition: FieldL95.cc:94
Class to represent fields for the L95 model.
Definition: FieldL95.h:36