Debian Codegraph @

src/atlas/meshgenerator/detail/HealpixMeshGenerator.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
12 #pragma once
13
14 #include "atlas/meshgenerator/MeshGenerator.h"
15 #include "atlas/meshgenerator/detail/MeshGeneratorImpl.h"
16 #include "atlas/util/Config.h"
17 #include "atlas/util/Metadata.h"
18
19 #ifndef DOXYGEN_SHOULD_SKIP_THIS
20 namespace eckit {
21 class Parametrisation;
22 }
23
24 namespace atlas {
25 class StructuredGrid;
26 class Mesh;
27 template <typename T>
28 class vector;
29 } // namespace atlas
30
31 namespace atlas {
32 namespace grid {
33 class Distribution;
34 } // namespace grid
35 } // namespace atlas
36 #endif
37
38 namespace atlas {
39 namespace meshgenerator {
40
41 //----------------------------------------------------------------------------------------------------------------------
42
43 class HealpixMeshGenerator : public MeshGenerator::Implementation {
44 public:
45 HealpixMeshGenerator(const eckit::Parametrisation& = util::NoConfig());
46
47 virtual void generate(const Grid&, const grid::Distribution&, Mesh&) const override;
48 virtual void generate(const Grid&, Mesh&) const override;
49
50 using MeshGenerator::Implementation::generate;
51
52 virtual void hash(eckit::Hash&) const override;
53 virtual std::string type() const override { return static_type(); }
54 static std::string static_type() { return "healpix"; }
55
56 private:
57 void configure_defaults();
58
59 void generate_mesh(const StructuredGrid&, const grid::Distribution&, Mesh& m) const;
60
61 gidx_t match_node_idx(const gidx_t& gidx, const int ns) const;
62 gidx_t idx_xy_to_x(const int xidx, const int yidx, const int ns) const;
63 gidx_t up_idx(const int xidx, const int yidx, const int ns) const;
64 gidx_t down_idx(const int xidx, const int yidx, const int ns) const;
65 gidx_t right_idx(const int xidx, const int yidx, const int ns) const;
66 gidx_t pentagon_right_idx(const int xidx, const int yidx, const int ns) const;
67
68 private:
69 util::Metadata options;
70 mutable gidx_t nb_points_;
71 mutable gidx_t nb_nodes_;
72 mutable int nb_pole_nodes_;
73 };
74
75 //----------------------------------------------------------------------------------------------------------------------
76
77 } // namespace meshgenerator
78 } // namespace atlas