Debian Codegraph @

src/atlas/grid/detail/tiles/Tiles.h

raw
1 /*
2 * (C) Crown Copyright 2021 Met Office.
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 <array>
14 #include <string>
15
16 #include "atlas/library/config.h"
17 #include "atlas/projection/detail/ProjectionImpl.h"
18 #include "atlas/util/Config.h"
19 #include "atlas/util/Object.h"
20
21 namespace eckit {
22 class Parametrisation;
23 }
24
25
26 namespace atlas {
27 class PointXY;
28 } // namespace atlas
29
30 namespace atlas {
31 namespace grid {
32 namespace detail {
33
34 class CubedSphereTiles : public util::Object {
35 public:
36 using Spec = util::Config;
37 using Jacobian = projection::Jacobian;
38
39 public:
40 static const CubedSphereTiles* create();
41
42 static const CubedSphereTiles* create(const eckit::Parametrisation&);
43
44 static const CubedSphereTiles* create(const std::string&);
45
46 virtual std::string type() const = 0;
47
48 virtual std::array<std::array<double, 6>, 2> xy2abOffsets() const = 0;
49
50 virtual std::array<std::array<double, 6>, 2> ab2xyOffsets() const = 0;
51
52 virtual void rotate(idx_t t, double xyz[]) const = 0;
53
54 virtual void unrotate(idx_t t, double xyz[]) const = 0;
55
56 virtual idx_t indexFromXY(const double xy[]) const = 0;
57
58 virtual idx_t indexFromLonLat(const double lonlat[]) const = 0;
59
60 idx_t indexFromXY(const PointXY& xy) const;
61
62 idx_t indexFromLonLat(const PointLonLat& lonlat) const;
63
64 virtual void enforceXYdomain(double xy[]) const = 0;
65
66 virtual const PointXY& tileCentre(size_t t) const = 0;
67
68 virtual const Jacobian& tileJacobian(size_t t) const = 0;
69
70 idx_t size() const { return 6; }
71
72 virtual atlas::PointXY tileCubePeriodicity(const atlas::PointXY& xyExtended, const atlas::idx_t tile) const = 0;
73
74 /// Output to stream
75 virtual void print(std::ostream&) const = 0;
76
77 friend std::ostream& operator<<(std::ostream& s, const CubedSphereTiles& cst) {
78 cst.print(s);
79 return s;
80 }
81 };
82
83 } // namespace detail
84 } // namespace grid
85 } // namespace atlas