Skip to content

Commit

Permalink
eckit::geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
pmaciel committed Aug 16, 2023
1 parent 5deca35 commit 63aa160
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
22 changes: 4 additions & 18 deletions src/eckit/geometry/Grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,13 @@ std::pair<std::vector<double>, std::vector<double>> Grid::to_latlon() const {
}


SearchLonLat::Result Grid::nearest(const PointLonLat& p) const {
SearchLonLat search;

size_t index = 0;
for (const auto& p : to_points()) {
search.insert({std::get<PointLonLat>(p), index});
}

return search.nearestNeighbour(p);
Ordering Grid::order() const {
throw NotImplemented("Grid::order");
}


SearchLonLat::Results Grid::nearest(const PointLonLat& p, size_t k) const {
SearchLonLat search;

size_t index = 0;
for (const auto& p : to_points()) {
search.insert({std::get<PointLonLat>(p), index});
}

return search.kNearestNeighbours(p, k);
Renumber Grid::reorder(const PointLonLat&) const {
throw NotImplemented("Grid::reorder");
}


Expand Down
6 changes: 3 additions & 3 deletions src/eckit/geometry/Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#include "eckit/geometry/Area.h"
#include "eckit/geometry/Increments.h"
#include "eckit/geometry/Iterator.h"
#include "eckit/geometry/Ordering.h"
#include "eckit/geometry/Point.h"
#include "eckit/geometry/Projection.h"
#include "eckit/geometry/Renumber.h"
#include "eckit/geometry/Search.h"
#include "eckit/geometry/area/BoundingBox.h"


Expand Down Expand Up @@ -109,8 +109,8 @@ class Grid {
virtual std::vector<Point> to_points() const;
virtual std::pair<std::vector<double>, std::vector<double>> to_latlon() const;

virtual SearchLonLat::Result nearest(const PointLonLat&) const;
virtual SearchLonLat::Results nearest(const PointLonLat&, size_t k) const;
virtual Ordering order() const;
virtual Renumber reorder(const PointLonLat&) const;

// -- Overridden methods
// None
Expand Down
2 changes: 1 addition & 1 deletion src/eckit/geometry/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Iterator {
protected:
// -- Constructors

Iterator(const Grid&) {}
explicit Iterator(const Grid&) {}

// -- Members
// None
Expand Down
1 change: 0 additions & 1 deletion src/eckit/geometry/grid/HEALPix.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <vector>

#include "eckit/geometry/Grid.h"
#include "eckit/geometry/Ordering.h"


namespace eckit::geometry::grid {
Expand Down

0 comments on commit 63aa160

Please sign in to comment.