Debian Codegraph @

src/atlas/mesh/actions/ReorderHilbert.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 "atlas/mesh/actions/Reorder.h"
14
15 namespace atlas {
16 namespace mesh {
17 namespace actions {
18
19 //----------------------------------------------------------------------------------------------------------------------
20
21 /// Reorder implementation that reorders nodes of a mesh following a Hilbert Space-filling curve.
22 /// Cells and edges are reordered to follow lowest node index.
23 ///
24 /// Usage:
25 /// auto reorder = Reorder{ option::type("hilbert") | config };
26 /// reorder( mesh );
27 ///
28 /// The optional extra config can contain:
29 ///
30 /// - "recursion" : <int> (default=30) // Recursion of hilbert space-filling curve,
31 /// // needs to be large enough to provide unique node indices.
32 ///
33 /// - "ghost_at_end" : <bool> (default=true) // Determines if ghost nodes should be reordered in between
34 /// // internal nodes or added/remain at the end
35 class ReorderHilbert : public ReorderImpl {
36 public:
37 ReorderHilbert(const eckit::Parametrisation& config = util::NoConfig());
38
39 std::vector<idx_t> computeNodesOrder(Mesh&) override;
40
41 private:
42 idx_t recursion_{30};
43 bool ghost_at_end_{true};
44 };
45
46 // ------------------------------------------------------------------
47
48 } // namespace actions
49 } // namespace mesh
50 } // namespace atlas