Debian Codegraph @

src/atlas/domain/detail/Domain.h

raw
1 /*
2 * (C) Copyright 2013 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
8 * nor does it submit to any jurisdiction.
9 */
10
11 #pragma once
12
13 #include <iosfwd>
14
15 #include "atlas/util/Config.h"
16 #include "atlas/util/Object.h"
17 #include "atlas/util/Point.h"
18
19 namespace eckit {
20 class Parametrisation;
21 }
22
23 namespace atlas {
24 class Projection;
25
26 namespace domain {
27
28 class Domain : public util::Object {
29 public:
30 using Spec = util::Config;
31
32 public:
33 static const Domain* create(); // Create a global domain
34
35 static const Domain* create(const eckit::Parametrisation&);
36
37 virtual std::string type() const = 0;
38
39 /// Checks if the point is contained in the domain
40 virtual bool contains(double x, double y) const = 0;
41
42 bool contains(const PointXY& p) const { return contains(p.x(), p.y()); }
43
44 // Specification of grid
45 virtual Spec spec() const = 0;
46
47 /// Check if domain represents the complete globe surface
48 virtual bool global() const = 0;
49
50 /// Check if domain does not represent any area on the globe surface
51 virtual bool empty() const = 0;
52
53 // Unless the domain is global, we can never be sure about these functions
54 // without knowing also the projection
55
56 /// Check if grid includes the North pole
57 virtual bool containsNorthPole() const = 0;
58
59 /// Check if grid includes the South pole
60 virtual bool containsSouthPole() const = 0;
61
62 /// Output to stream
63 virtual void print(std::ostream&) const = 0;
64
65 friend std::ostream& operator<<(std::ostream& s, const Domain& d) {
66 d.print(s);
67 return s;
68 }
69
70 virtual std::string units() const = 0;
71
72 virtual void hash(eckit::Hash&) const = 0;
73 };
74
75 class RectangularDomain;
76
77 extern "C" {
78 const Domain* atlas__Domain__ctor_config(const eckit::Parametrisation* config);
79 void atlas__Domain__type(const Domain* This, char*& type, int& size);
80 void atlas__Domain__hash(const Domain* This, char*& hash, int& size);
81 Domain::Spec* atlas__Domain__spec(const Domain* This);
82 double atlas__LonLatRectangularDomain__north(const RectangularDomain* This);
83 double atlas__LonLatRectangularDomain__west(const RectangularDomain* This);
84 double atlas__LonLatRectangularDomain__south(const RectangularDomain* This);
85 double atlas__LonLatRectangularDomain__east(const RectangularDomain* This);
86 }
87
88 } // namespace domain
89 } // namespace atlas