Debian Codegraph @

src/atlas/interpolation/method/PointIndex3.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 "eckit/container/KDMapped.h"
14 #include "eckit/container/KDMemory.h"
15 #include "eckit/container/KDTree.h"
16 #include "eckit/geometry/Point3.h"
17
18 #include "atlas/field/Field.h"
19 #include "atlas/mesh/Mesh.h"
20 #include "atlas/util/CoordinateEnums.h"
21
22 namespace atlas {
23 namespace interpolation {
24 namespace method {
25
26 //----------------------------------------------------------------------------------------------------------------------
27
28 template <class Traits>
29 class PointKdTree : public eckit::KDTreeMemory<Traits> {
30 public:
31 typedef eckit::KDTreeMemory<Traits> Tree;
32
33 typedef typename Tree::Alloc Alloc;
34 typedef typename Tree::NodeInfo NodeInfo;
35 typedef typename Tree::NodeList NodeList;
36 typedef typename Tree::PayloadType Payload;
37 typedef typename Tree::Point Point;
38 typedef typename Tree::Value Value;
39
40 PointKdTree(): eckit::KDTreeMemory<Traits>() {}
41 PointKdTree(Alloc& alloc): Tree(alloc) {}
42
43 using Tree::findInSphere;
44 using Tree::kNearestNeighbours;
45 using Tree::nearestNeighbour;
46
47 using Tree::findInSphereBruteForce;
48 using Tree::kNearestNeighboursBruteForce;
49 using Tree::nearestNeighbourBruteForce;
50 };
51
52 //----------------------------------------------------------------------------------------------------------------------
53
54 struct PointIndex3TreeTrait {
55 typedef eckit::geometry::Point3 Point;
56 typedef size_t Payload;
57 };
58
59 typedef PointKdTree<PointIndex3TreeTrait> PointIndex3;
60
61 //----------------------------------------------------------------------------------------------------------------------
62
63 struct ElemIndex3TreeTrait {
64 typedef eckit::geometry::Point3 Point;
65 typedef size_t Payload;
66 };
67
68 typedef PointKdTree<ElemIndex3TreeTrait> ElemIndex3;
69
70 ElemIndex3* create_element_kdtree(const Mesh& mesh, const Field& field_centres);
71
72 // TODO: remove this function, and use "create_element_kdtree(const Field&)"
73 // instead.
74 ElemIndex3* create_element_centre_index(const Mesh& mesh);
75
76 //----------------------------------------------------------------------------------------------------------------------
77
78 } // namespace method
79 } // namespace interpolation
80 } // namespace atlas