Debian Codegraph @

src/atlas/grid/Grid.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 <functional>
14 #include <initializer_list>
15 #include <string>
16
17 #include "atlas/domain/Domain.h"
18 #include "atlas/library/config.h"
19 #include "atlas/projection/Projection.h"
20 #include "atlas/util/ObjectHandle.h"
21
22 namespace eckit {
23 class Hash;
24 }
25 namespace atlas {
26 class PointXY;
27 class PointLonLat;
28 namespace util {
29 class Config;
30 }
31 namespace grid {
32 class IterateXY;
33 class IterateLonLat;
34 namespace detail {
35 namespace grid {
36 class Grid;
37 }
38 } // namespace detail
39 } // namespace grid
40 } // namespace atlas
41
42 namespace atlas {
43
44 //---------------------------------------------------------------------------------------------------------------------
45
46 /// @class Grid
47 /// @brief Most general grid container
48 /// @details
49 /// @code{.sh}
50 /// Grid
51 /// |
52 /// +----------+----------+
53 /// | |
54 /// StructuredGrid UnstructuredGrid
55 /// |
56 /// +--------------------+-----------------------+
57 /// | | |
58 /// ReducedGrid GaussianGrid RegularGrid
59 /// | | | | |
60 /// +--------+--------+ +--------+--------+ +-----+
61 /// | | |
62 /// ReducedGaussianGrid RegularGaussianGrid RegularLonLatGrid
63 /// @endcode
64 class Grid : DOXYGEN_HIDE(public util::ObjectHandle<grid::detail::grid::Grid>) {
65 public:
66 using Config = util::Config;
67 using Spec = util::Config;
68 using Domain = atlas::Domain;
69 using Projection = atlas::Projection;
70 using PointXY = atlas::PointXY; // must be sizeof(double)*2
71 using PointLonLat = atlas::PointLonLat; // must be sizeof(double)*2
72 using IterateXY = grid::IterateXY;
73 using IterateLonLat = grid::IterateLonLat;
74
75 public:
76 IterateXY xy() const;
77 IterateLonLat lonlat() const;
78
79 using Handle::Handle;
80 Grid() = default;
81 Grid(const std::string& name, const Domain& = Domain());
82 Grid(const std::string& name, const Projection&, const Domain& = Domain());
83 Grid(const Grid&, const Domain&);
84 Grid(const Config&);
85
86 bool operator==(const Grid& other) const { return uid() == other.uid(); }
87 bool operator!=(const Grid& other) const { return uid() != other.uid(); }
88
89 idx_t size() const;
90
91 const Projection& projection() const;
92 const Domain& domain() const;
93 RectangularLonLatDomain lonlatBoundingBox() const;
94 std::string name() const;
95 std::string type() const;
96 std::string uid() const;
97
98 /// Adds to the hash the information that makes this Grid unique
99 void hash(eckit::Hash& h) const;
100
101 size_t footprint() const;
102
103 Spec spec() const;
104
105 Config meshgenerator() const;
106 Config partitioner() const;
107 };
108
109 //---------------------------------------------------------------------------------------------------------------------
110
111 } // namespace atlas