FV3 Bundle
LocationsQG.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 QG_MODEL_LOCATIONSQG_H_
12 #define QG_MODEL_LOCATIONSQG_H_
13 
14 #include <ostream>
15 #include <string>
16 #include <vector>
17 
18 #include "model/QgFortran.h"
19 #include "oops/util/ObjectCounter.h"
20 #include "oops/util/Printable.h"
21 
22 namespace qg {
23 
24 /// LocationsQG class to handle locations for QG model.
25 
26 class LocationsQG : public util::Printable,
27  private util::ObjectCounter<LocationsQG> {
28  public:
29  static const std::string classname() {return "qg::LocationsQG";}
30 
31  explicit LocationsQG(const F90locs key) : keyLoc_(key) {}
32 
33  explicit LocationsQG(const eckit::Configuration &);
34 
36 
37  size_t size() const {
38  int nobs;
40  return nobs;
41  }
42 
43  int toFortran() const {return keyLoc_;}
44  private:
45  void print(std::ostream & os) const {
46  int nobs;
48 
49  std::vector<double> xyz(3);
50 
51  for (size_t jj=0; jj < static_cast<size_t>(nobs); ++jj) {
52  qg_loc_element_f90(keyLoc_, jj, &xyz[0]);
53  os << "loc " << jj << std::setprecision(2) << ": x = " << xyz[0]
54  << ", y = " << xyz[1] << ", z = " << xyz[2] << std::endl;
55  }
56  }
58 };
59 
60 } // namespace qg
61 
62 #endif // QG_MODEL_LOCATIONSQG_H_
void qg_loc_element_f90(const F90locs &, const int &, double *)
size_t size() const
Definition: LocationsQG.h:37
void qg_loc_delete_f90(F90locs &)
LocationsQG(const F90locs key)
Definition: LocationsQG.h:31
void print(std::ostream &os) const
Definition: LocationsQG.h:45
int toFortran() const
Definition: LocationsQG.h:43
F90locs keyLoc_
Definition: LocationsQG.h:57
void qg_loc_nobs_f90(const F90locs &, int &)
LocationsQG class to handle locations for QG model.
Definition: LocationsQG.h:26
static const std::string classname()
Definition: LocationsQG.h:29
int F90locs
Definition: QgFortran.h:34
The namespace for the qg model.