OOPS
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 <iomanip>
15 #include <memory>
16 #include <ostream>
17 #include <string>
18 #include <vector>
19 
20 #include "atlas/field.h"
21 #include "atlas/functionspace/PointCloud.h"
22 #include "eckit/exception/Exceptions.h"
23 #include "eckit/mpi/Comm.h"
24 
25 #include "oops/util/DateTime.h"
26 #include "oops/util/ObjectCounter.h"
27 #include "oops/util/Printable.h"
28 
29 #include "oops/qg/QgFortran.h"
30 
31 namespace qg {
32 
33 // -----------------------------------------------------------------------------
34 /// LocationsQG class to handle locations for QG model.
35 class LocationsQG : public util::Printable,
36  private util::ObjectCounter<LocationsQG> {
37  public:
38  static const std::string classname() {return "qg::LocationsQG";}
39 
40 // Constructors and basic operators
41  LocationsQG(atlas::FieldSet &, std::vector<util::DateTime> &&);
42  LocationsQG(const eckit::Configuration &, const eckit::mpi::Comm &);
43  LocationsQG(const LocationsQG &);
45 
46 // Utilities
47  int size() const {return pointcloud_->size();}
48  atlas::functionspace::PointCloud & pointcloud() {return *pointcloud_;}
49  atlas::Field lonlat() const {return pointcloud_->lonlat();}
50  atlas::Field & altitude() {ASSERT(altitude_); return *altitude_;}
51  util::DateTime & times(size_t idx) {return times_[idx];}
52 
53  private:
54  void print(std::ostream &) const;
55  std::unique_ptr<atlas::functionspace::PointCloud> pointcloud_;
56  std::unique_ptr<atlas::Field> altitude_;
57  std::vector<util::DateTime> times_;
58 };
59 
60 } // namespace qg
61 
62 #endif // QG_MODEL_LOCATIONSQG_H_
LocationsQG class to handle locations for QG model.
Definition: LocationsQG.h:36
std::vector< util::DateTime > times_
Definition: LocationsQG.h:57
static const std::string classname()
Definition: LocationsQG.h:38
atlas::Field lonlat() const
Definition: LocationsQG.h:49
std::unique_ptr< atlas::Field > altitude_
Definition: LocationsQG.h:56
LocationsQG(atlas::FieldSet &, std::vector< util::DateTime > &&)
Constructor from fields and times.
Definition: LocationsQG.cc:133
atlas::Field & altitude()
Definition: LocationsQG.h:50
void print(std::ostream &) const
Definition: LocationsQG.cc:144
std::unique_ptr< atlas::functionspace::PointCloud > pointcloud_
Definition: LocationsQG.h:55
atlas::functionspace::PointCloud & pointcloud()
Definition: LocationsQG.h:48
int size() const
Definition: LocationsQG.h:47
util::DateTime & times(size_t idx)
Definition: LocationsQG.h:51
The namespace for the qg model.