From f2c1a83c2be613bd07b8c4b1f54e7134288cfb9c Mon Sep 17 00:00:00 2001 From: Eugen Betke Date: Mon, 21 Oct 2024 17:19:39 +0200 Subject: [PATCH] Modernisation: Change namespace and move lats_ and lons_ to base class --- CMakeLists.txt | 7 ++- src/CMakeLists.txt | 26 +++++------ src/accessor/grib_accessor_class_iterator.h | 2 +- src/eccodes_prototypes.h | 2 +- .../grib_iterator.cc | 22 +++------- .../grib_iterator.h | 15 ++----- .../grib_iterator_class_gaussian.cc | 19 +++----- .../grib_iterator_class_gaussian.h | 12 ++---- .../grib_iterator_class_gaussian_reduced.cc | 43 ++++++++----------- .../grib_iterator_class_gaussian_reduced.h | 13 +----- .../grib_iterator_class_gen.cc | 11 +---- .../grib_iterator_class_gen.h | 13 ++---- .../grib_iterator_class_healpix.cc | 16 ++----- .../grib_iterator_class_healpix.h | 13 +----- ...ator_class_lambert_azimuthal_equal_area.cc | 15 ++----- ...rator_class_lambert_azimuthal_equal_area.h | 13 +----- .../grib_iterator_class_lambert_conformal.cc | 15 ++----- .../grib_iterator_class_lambert_conformal.h | 13 +----- .../grib_iterator_class_latlon.cc | 27 +++++------- .../grib_iterator_class_latlon.h | 11 +---- .../grib_iterator_class_latlon_reduced.cc | 31 ++++++------- .../grib_iterator_class_latlon_reduced.h | 17 ++------ .../grib_iterator_class_mercator.cc | 15 ++----- .../grib_iterator_class_mercator.h | 15 ++----- ...grib_iterator_class_polar_stereographic.cc | 15 ++----- .../grib_iterator_class_polar_stereographic.h | 13 +----- .../grib_iterator_class_regular.cc | 35 ++++++--------- .../grib_iterator_class_regular.h | 17 ++------ .../grib_iterator_class_space_view.cc | 15 ++----- .../grib_iterator_class_space_view.h | 13 +----- src/grib_api_internal.h | 6 +-- src/grib_iterator_class.cc | 16 +++---- src/grib_iterator_class.h | 24 +++++------ 33 files changed, 172 insertions(+), 368 deletions(-) rename src/{iterator => geo_iterator}/grib_iterator.cc (86%) rename src/{iterator => geo_iterator}/grib_iterator.h (84%) rename src/{iterator => geo_iterator}/grib_iterator_class_gaussian.cc (92%) rename src/{iterator => geo_iterator}/grib_iterator_class_gaussian.h (85%) rename src/{iterator => geo_iterator}/grib_iterator_class_gaussian_reduced.cc (94%) rename src/{iterator => geo_iterator}/grib_iterator_class_gaussian_reduced.h (90%) rename src/{iterator => geo_iterator}/grib_iterator_class_gen.cc (96%) rename src/{iterator => geo_iterator}/grib_iterator_class_gen.h (89%) rename src/{iterator => geo_iterator}/grib_iterator_class_healpix.cc (97%) rename src/{iterator => geo_iterator}/grib_iterator_class_healpix.h (84%) rename src/{iterator => geo_iterator}/grib_iterator_class_lambert_azimuthal_equal_area.cc (97%) rename src/{iterator => geo_iterator}/grib_iterator_class_lambert_azimuthal_equal_area.h (89%) rename src/{iterator => geo_iterator}/grib_iterator_class_lambert_conformal.cc (98%) rename src/{iterator => geo_iterator}/grib_iterator_class_lambert_conformal.h (89%) rename src/{iterator => geo_iterator}/grib_iterator_class_latlon.cc (91%) rename src/{iterator => geo_iterator}/grib_iterator_class_latlon.h (86%) rename src/{iterator => geo_iterator}/grib_iterator_class_latlon_reduced.cc (85%) rename src/{iterator => geo_iterator}/grib_iterator_class_latlon_reduced.h (75%) rename src/{iterator => geo_iterator}/grib_iterator_class_mercator.cc (97%) rename src/{iterator => geo_iterator}/grib_iterator_class_mercator.h (81%) rename src/{iterator => geo_iterator}/grib_iterator_class_polar_stereographic.cc (97%) rename src/{iterator => geo_iterator}/grib_iterator_class_polar_stereographic.h (83%) rename src/{iterator => geo_iterator}/grib_iterator_class_regular.cc (86%) rename src/{iterator => geo_iterator}/grib_iterator_class_regular.h (75%) rename src/{iterator => geo_iterator}/grib_iterator_class_space_view.cc (98%) rename src/{iterator => geo_iterator}/grib_iterator_class_space_view.h (83%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84f1ab2dc..1b002b1b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -434,7 +434,12 @@ endforeach() ### include directories -include_directories( ${ECCODES_INCLUDE_DIRS} ${ECCODES_EXTRA_INCLUDE_DIRS} ) +include_directories( + "accessor" + "geo_iterator" + ${ECCODES_INCLUDE_DIRS} + ${ECCODES_EXTRA_INCLUDE_DIRS} + ) add_subdirectory( definitions ) # must be before memfs add_subdirectory( memfs ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ad3fc89d..a012d66e7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -331,20 +331,20 @@ list( APPEND eccodes_src_files grib_nearest_class_mercator.cc grib_nearest_class_polar_stereographic.cc grib_nearest_class_space_view.cc - iterator/grib_iterator_class_polar_stereographic.cc - iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc - iterator/grib_iterator_class_lambert_conformal.cc - iterator/grib_iterator_class_mercator.cc - iterator/grib_iterator.cc + geo_iterator/grib_iterator_class_polar_stereographic.cc + geo_iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc + geo_iterator/grib_iterator_class_lambert_conformal.cc + geo_iterator/grib_iterator_class_mercator.cc + geo_iterator/grib_iterator.cc grib_iterator_class.cc - iterator/grib_iterator_class_gaussian.cc - iterator/grib_iterator_class_gaussian_reduced.cc - iterator/grib_iterator_class_latlon_reduced.cc - iterator/grib_iterator_class_gen.cc - iterator/grib_iterator_class_latlon.cc - iterator/grib_iterator_class_regular.cc - iterator/grib_iterator_class_space_view.cc - iterator/grib_iterator_class_healpix.cc + geo_iterator/grib_iterator_class_gaussian.cc + geo_iterator/grib_iterator_class_gaussian_reduced.cc + geo_iterator/grib_iterator_class_latlon_reduced.cc + geo_iterator/grib_iterator_class_gen.cc + geo_iterator/grib_iterator_class_latlon.cc + geo_iterator/grib_iterator_class_regular.cc + geo_iterator/grib_iterator_class_space_view.cc + geo_iterator/grib_iterator_class_healpix.cc grib_expression.cc codes_util.cc grib_util.cc diff --git a/src/accessor/grib_accessor_class_iterator.h b/src/accessor/grib_accessor_class_iterator.h index 1b2186575..8fd950570 100644 --- a/src/accessor/grib_accessor_class_iterator.h +++ b/src/accessor/grib_accessor_class_iterator.h @@ -23,5 +23,5 @@ public: private: grib_arguments* args_; - friend eccodes::grib::geo::Iterator* eccodes::grib::geo::gribIteratorNew(const grib_handle*, unsigned long, int*); + friend eccodes::geo_iterator::Iterator* eccodes::geo_iterator::gribIteratorNew(const grib_handle*, unsigned long, int*); }; diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index 454403874..90592dd72 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -820,7 +820,7 @@ int grib_get_data(const grib_handle* h, double* lats, double* lons, double* valu //int grib_iterator_delete(grib_iterator* i); /* grib_iterator_class.cc */ -eccodes::grib::geo::Iterator* grib_iterator_factory(grib_handle* h, grib_arguments* args, unsigned long flags, int* error); +eccodes::geo_iterator::Iterator* grib_iterator_factory(grib_handle* h, grib_arguments* args, unsigned long flags, int* error); /* grib_iterator_class_gen.cc */ int transform_iterator_data(grib_context* c, double* data, long iScansNegatively, long jScansPositively, long jPointsAreConsecutive, long alternativeRowScanning, size_t numPoints, long nx, long ny); diff --git a/src/iterator/grib_iterator.cc b/src/geo_iterator/grib_iterator.cc similarity index 86% rename from src/iterator/grib_iterator.cc rename to src/geo_iterator/grib_iterator.cc index a95070a79..75938146e 100644 --- a/src/iterator/grib_iterator.cc +++ b/src/geo_iterator/grib_iterator.cc @@ -12,15 +12,9 @@ * Jean Baptiste Filippi - 01.11.2005 * ***************************************************************************/ #include "grib_iterator.h" -#include "../accessor/grib_accessor_class_iterator.h" - -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +#include "accessor/grib_accessor_class_iterator.h" +namespace eccodes::geo_iterator { int Iterator::init(grib_handle* h, grib_arguments* args) { @@ -36,7 +30,7 @@ int Iterator::destroy() return GRIB_SUCCESS; } -eccodes::grib::geo::Iterator* gribIteratorNew(const grib_handle* ch, unsigned long flags, int* error) +eccodes::geo_iterator::Iterator* gribIteratorNew(const grib_handle* ch, unsigned long flags, int* error) { grib_handle* h = (grib_handle*)ch; grib_accessor* a = NULL; @@ -48,7 +42,7 @@ eccodes::grib::geo::Iterator* gribIteratorNew(const grib_handle* ch, unsigned lo if (!a) return NULL; - eccodes::grib::geo::Iterator* iter = grib_iterator_factory(h, ita->args_, flags, error); + eccodes::geo_iterator::Iterator* iter = grib_iterator_factory(h, ita->args_, flags, error); if (iter) *error = GRIB_SUCCESS; @@ -56,7 +50,7 @@ eccodes::grib::geo::Iterator* gribIteratorNew(const grib_handle* ch, unsigned lo return iter; } -int gribIteratorDelete(eccodes::grib::geo::Iterator* i) +int gribIteratorDelete(eccodes::geo_iterator::Iterator* i) { if (i) i->destroy(); @@ -64,9 +58,7 @@ int gribIteratorDelete(eccodes::grib::geo::Iterator* i) } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator /* @@ -104,7 +96,7 @@ int grib_iterator_destroy(grib_context* c, grib_iterator* i) grib_iterator* grib_iterator_new(const grib_handle* ch, unsigned long flags, int* error) { grib_iterator* i = (grib_iterator*)grib_context_malloc_clear(ch->context, sizeof(grib_iterator)); - i->iterator = eccodes::grib::geo::gribIteratorNew(ch, flags, error); + i->iterator = eccodes::geo_iterator::gribIteratorNew(ch, flags, error); if (!i->iterator) { grib_context_free(ch->context, i); return NULL; diff --git a/src/iterator/grib_iterator.h b/src/geo_iterator/grib_iterator.h similarity index 84% rename from src/iterator/grib_iterator.h rename to src/geo_iterator/grib_iterator.h index 91ecda4dd..948bb5fe9 100644 --- a/src/iterator/grib_iterator.h +++ b/src/geo_iterator/grib_iterator.h @@ -16,12 +16,7 @@ \ingroup grib_iterator */ -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class Iterator { @@ -51,9 +46,7 @@ private: int inited_; }; -eccodes::grib::geo::Iterator* gribIteratorNew(const grib_handle*, unsigned long, int*); -int gribIteratorDelete(eccodes::grib::geo::Iterator*); +eccodes::geo_iterator::Iterator* gribIteratorNew(const grib_handle*, unsigned long, int*); +int gribIteratorDelete(eccodes::geo_iterator::Iterator*); -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_gaussian.cc b/src/geo_iterator/grib_iterator_class_gaussian.cc similarity index 92% rename from src/iterator/grib_iterator_class_gaussian.cc rename to src/geo_iterator/grib_iterator_class_gaussian.cc index 5ebbf9bd6..da50560ef 100644 --- a/src/iterator/grib_iterator_class_gaussian.cc +++ b/src/geo_iterator/grib_iterator_class_gaussian.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_gaussian.h" -eccodes::grib::geo::Gaussian _grib_iterator_gaussian{}; -eccodes::grib::geo::Iterator* grib_iterator_gaussian = &_grib_iterator_gaussian; +eccodes::geo_iterator::Gaussian _grib_iterator_gaussian{}; +eccodes::geo_iterator::Iterator* grib_iterator_gaussian = &_grib_iterator_gaussian; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { static void binary_search_gaussian_latitudes(const double xx[], const unsigned long n, double x, long* j); @@ -81,13 +76,13 @@ int Gaussian::init(grib_handle* h, grib_arguments* args) if (jScansPositively) { for (lai = 0; lai < Nj_; lai++) { DEBUG_ASSERT(istart >= 0); - las_[lai] = lats[istart--]; + lats_[lai] = lats[istart--]; if (istart < 0) istart = size - 1; } } else { for (lai = 0; lai < Nj_; lai++) { - las_[lai] = lats[istart++]; + lats_[lai] = lats[istart++]; if (istart > size - 1) istart = 0; } @@ -152,6 +147,4 @@ static void binary_search_gaussian_latitudes(const double array[], const unsigne // *j = jl; // } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_gaussian.h b/src/geo_iterator/grib_iterator_class_gaussian.h similarity index 85% rename from src/iterator/grib_iterator_class_gaussian.h rename to src/geo_iterator/grib_iterator_class_gaussian.h index 1dd8a70ae..5c0696f13 100644 --- a/src/iterator/grib_iterator_class_gaussian.h +++ b/src/geo_iterator/grib_iterator_class_gaussian.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_regular.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class Gaussian : public Regular { @@ -29,6 +24,5 @@ public: int init(grib_handle*, grib_arguments*) override; }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator + diff --git a/src/iterator/grib_iterator_class_gaussian_reduced.cc b/src/geo_iterator/grib_iterator_class_gaussian_reduced.cc similarity index 94% rename from src/iterator/grib_iterator_class_gaussian_reduced.cc rename to src/geo_iterator/grib_iterator_class_gaussian_reduced.cc index 29f896ce8..eb90c8420 100644 --- a/src/iterator/grib_iterator_class_gaussian_reduced.cc +++ b/src/geo_iterator/grib_iterator_class_gaussian_reduced.cc @@ -11,15 +11,10 @@ #include "grib_iterator_class_gaussian_reduced.h" #include -eccodes::grib::geo::GaussianReduced _grib_iterator_gaussian_reduced{}; -eccodes::grib::geo::Iterator* grib_iterator_gaussian_reduced = &_grib_iterator_gaussian_reduced; +eccodes::geo_iterator::GaussianReduced _grib_iterator_gaussian_reduced{}; +eccodes::geo_iterator::Iterator* grib_iterator_gaussian_reduced = &_grib_iterator_gaussian_reduced; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "Reduced Gaussian grid Geoiterator" @@ -31,8 +26,8 @@ int GaussianReduced::next(double* lat, double* lon, double* val) const return 0; e_++; - ret_lat = las_[e_]; - ret_lon = los_[e_]; + ret_lat = lats_[e_]; + ret_lon = lons_[e_]; if (val && data_) { *val = data_[e_]; } @@ -141,8 +136,8 @@ int GaussianReduced::iterate_reduced_gaussian_subarea_legacy(grib_handle* h, return GRIB_WRONG_GRID; } - los_[e_] = ((i) * 360.0) / pl[j]; - las_[e_] = lats[j + l]; + lons_[e_] = ((i) * 360.0) / pl[j]; + lats_[e_] = lats[j + l]; e_++; k++; if (k >= row_count) { @@ -205,9 +200,9 @@ int GaussianReduced::iterate_reduced_gaussian_subarea(grib_handle* h, "%s (sub-area). Num points=%zu, size(values)=%zu", ITER, np, nv_); return GRIB_WRONG_GRID; } - los_[e_] = lon2; + lons_[e_] = lon2; DEBUG_ASSERT(j + l < numlats); - las_[e_] = lats[j + l]; + lats_[e_] = lats[j + l]; e_++; } } @@ -308,11 +303,11 @@ int GaussianReduced::init(grib_handle* h, grib_arguments* args) grib_get_long_array_internal(h, spl, pl, &plsize); - las_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); - if (!las_) + lats_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); + if (!lats_) return GRIB_OUT_OF_MEMORY; - los_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); - if (!los_) + lons_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); + if (!lons_) return GRIB_OUT_OF_MEMORY; while (lon_last < 0) @@ -354,8 +349,8 @@ int GaussianReduced::init(grib_handle* h, grib_arguments* args) goto finalise; } - los_[e_] = (i * 360.0) / row_count; - las_[e_] = lats[j]; + lons_[e_] = (i * 360.0) / row_count; + lats_[e_] = lats[j]; e_++; } } @@ -373,12 +368,10 @@ int GaussianReduced::destroy() { const grib_context* c = h_->context; - grib_context_free(c, las_); - grib_context_free(c, los_); + grib_context_free(c, lats_); + grib_context_free(c, lons_); return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_gaussian_reduced.h b/src/geo_iterator/grib_iterator_class_gaussian_reduced.h similarity index 90% rename from src/iterator/grib_iterator_class_gaussian_reduced.h rename to src/geo_iterator/grib_iterator_class_gaussian_reduced.h index db3d58457..c67c6afb7 100644 --- a/src/iterator/grib_iterator_class_gaussian_reduced.h +++ b/src/geo_iterator/grib_iterator_class_gaussian_reduced.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class GaussianReduced : public Gen { @@ -31,8 +26,6 @@ public: int destroy() override; private: - double* las_; - double* los_; long Nj_; long isRotated_; double angleOfRotation_; @@ -51,6 +44,4 @@ private: double*, long*, size_t, size_t); }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_gen.cc b/src/geo_iterator/grib_iterator_class_gen.cc similarity index 96% rename from src/iterator/grib_iterator_class_gen.cc rename to src/geo_iterator/grib_iterator_class_gen.cc index ff78e9412..e2c9d825e 100644 --- a/src/iterator/grib_iterator_class_gen.cc +++ b/src/geo_iterator/grib_iterator_class_gen.cc @@ -10,12 +10,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { int Gen::init(grib_handle* h, grib_arguments* args) { @@ -124,6 +119,4 @@ int Gen::next(double*, double*, double*) const // return 1; //} -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_gen.h b/src/geo_iterator/grib_iterator_class_gen.h similarity index 89% rename from src/iterator/grib_iterator_class_gen.h rename to src/geo_iterator/grib_iterator_class_gen.h index a2a6da7c2..0cca14c08 100644 --- a/src/iterator/grib_iterator_class_gen.h +++ b/src/geo_iterator/grib_iterator_class_gen.h @@ -12,12 +12,7 @@ #include "grib_iterator.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class Gen : public Iterator { @@ -35,12 +30,12 @@ public: protected: int carg_; + double* lats_; + double* lons_; private: const char* missingValue_; // int get(double*, double*, double*); }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_healpix.cc b/src/geo_iterator/grib_iterator_class_healpix.cc similarity index 97% rename from src/iterator/grib_iterator_class_healpix.cc rename to src/geo_iterator/grib_iterator_class_healpix.cc index e0710eb89..fcba61678 100644 --- a/src/iterator/grib_iterator_class_healpix.cc +++ b/src/geo_iterator/grib_iterator_class_healpix.cc @@ -14,18 +14,12 @@ #include #include #include -#include #include -eccodes::grib::geo::Healpix _grib_iterator_healpix; -eccodes::grib::geo::Iterator* grib_iterator_healpix = &_grib_iterator_healpix; +eccodes::geo_iterator::Healpix _grib_iterator_healpix; +eccodes::geo_iterator::Iterator* grib_iterator_healpix = &_grib_iterator_healpix; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "HEALPix Geoiterator" constexpr double RAD2DEG = 57.29577951308232087684; // 180 over pi @@ -361,6 +355,4 @@ int Healpix::destroy() return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_healpix.h b/src/geo_iterator/grib_iterator_class_healpix.h similarity index 84% rename from src/iterator/grib_iterator_class_healpix.h rename to src/geo_iterator/grib_iterator_class_healpix.h index ba241fbb4..74ebdcec3 100644 --- a/src/iterator/grib_iterator_class_healpix.h +++ b/src/geo_iterator/grib_iterator_class_healpix.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class Healpix : public Gen { @@ -31,14 +26,10 @@ public: int destroy() override; private: - double* lats_; - double* lons_; long Nsides_; bool nested_; int iterate_healpix(long N); }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc b/src/geo_iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc similarity index 97% rename from src/iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc rename to src/geo_iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc index ea7d21d31..15eff4bef 100644 --- a/src/iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc +++ b/src/geo_iterator/grib_iterator_class_lambert_azimuthal_equal_area.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_lambert_azimuthal_equal_area.h" -eccodes::grib::geo::LambertAzimuthalEqualArea _grib_iterator_lambert_azimuthal_equal_area{}; -eccodes::grib::geo::Iterator* grib_iterator_lambert_azimuthal_equal_area = &_grib_iterator_lambert_azimuthal_equal_area; +eccodes::geo_iterator::LambertAzimuthalEqualArea _grib_iterator_lambert_azimuthal_equal_area{}; +eccodes::geo_iterator::Iterator* grib_iterator_lambert_azimuthal_equal_area = &_grib_iterator_lambert_azimuthal_equal_area; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "Lambert azimuthal equal area Geoiterator" @@ -442,6 +437,4 @@ int LambertAzimuthalEqualArea::destroy() return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_lambert_azimuthal_equal_area.h b/src/geo_iterator/grib_iterator_class_lambert_azimuthal_equal_area.h similarity index 89% rename from src/iterator/grib_iterator_class_lambert_azimuthal_equal_area.h rename to src/geo_iterator/grib_iterator_class_lambert_azimuthal_equal_area.h index 137b4722d..17cafff53 100644 --- a/src/iterator/grib_iterator_class_lambert_azimuthal_equal_area.h +++ b/src/geo_iterator/grib_iterator_class_lambert_azimuthal_equal_area.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class LambertAzimuthalEqualArea : public Gen { @@ -31,8 +26,6 @@ public: int destroy() override; private: - double* lats_; - double* lons_; long Nj_; int init_sphere(grib_handle*, @@ -50,6 +43,4 @@ private: long, long, long); }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_lambert_conformal.cc b/src/geo_iterator/grib_iterator_class_lambert_conformal.cc similarity index 98% rename from src/iterator/grib_iterator_class_lambert_conformal.cc rename to src/geo_iterator/grib_iterator_class_lambert_conformal.cc index bcd14b57b..5204d7638 100644 --- a/src/iterator/grib_iterator_class_lambert_conformal.cc +++ b/src/geo_iterator/grib_iterator_class_lambert_conformal.cc @@ -11,15 +11,10 @@ #include "grib_iterator_class_lambert_conformal.h" #include -eccodes::grib::geo::LambertConformal _grib_iterator_lambert_conformal{}; -eccodes::grib::geo::Iterator* grib_iterator_lambert_conformal = &_grib_iterator_lambert_conformal; +eccodes::geo_iterator::LambertConformal _grib_iterator_lambert_conformal{}; +eccodes::geo_iterator::Iterator* grib_iterator_lambert_conformal = &_grib_iterator_lambert_conformal; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "Lambert conformal Geoiterator" #define EPSILON 1.0e-10 @@ -491,6 +486,4 @@ int LambertConformal::destroy() return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_lambert_conformal.h b/src/geo_iterator/grib_iterator_class_lambert_conformal.h similarity index 89% rename from src/iterator/grib_iterator_class_lambert_conformal.h rename to src/geo_iterator/grib_iterator_class_lambert_conformal.h index ba3b1d4aa..6a70b536d 100644 --- a/src/iterator/grib_iterator_class_lambert_conformal.h +++ b/src/geo_iterator/grib_iterator_class_lambert_conformal.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class LambertConformal : public Gen { @@ -31,8 +26,6 @@ public: int destroy() override; private: - double* lats_; - double* lons_; long Nj_; int init_sphere(const grib_handle*, @@ -53,6 +46,4 @@ private: double); }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_latlon.cc b/src/geo_iterator/grib_iterator_class_latlon.cc similarity index 91% rename from src/iterator/grib_iterator_class_latlon.cc rename to src/geo_iterator/grib_iterator_class_latlon.cc index fb44b551e..603640130 100644 --- a/src/iterator/grib_iterator_class_latlon.cc +++ b/src/geo_iterator/grib_iterator_class_latlon.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_latlon.h" -eccodes::grib::geo::Latlon _grib_iterator_latlon{}; -eccodes::grib::geo::Iterator* grib_iterator_latlon = &_grib_iterator_latlon; +eccodes::geo_iterator::Latlon _grib_iterator_latlon{}; +eccodes::geo_iterator::Iterator* grib_iterator_latlon = &_grib_iterator_latlon; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { int Latlon::next(double* lat, double* lon, double* val) const { @@ -34,15 +29,15 @@ int Latlon::next(double* lat, double* lon, double* val) const */ if (!jPointsAreConsecutive_) { /* Adjacent points in i (x) direction are consecutive */ - ret_lat = las_[(long)floor(e_ / Ni_)]; - ret_lon = los_[(long)e_ % Ni_]; + ret_lat = lats_[(long)floor(e_ / Ni_)]; + ret_lon = lons_[(long)e_ % Ni_]; if (data_) ret_val = data_[e_]; } else { /* Adjacent points in j (y) direction is consecutive */ - ret_lon = los_[(long)e_ / Nj_]; - ret_lat = las_[(long)floor(e_ % Nj_)]; + ret_lon = lons_[(long)e_ / Nj_]; + ret_lat = lats_[(long)floor(e_ % Nj_)]; if (data_) ret_val = data_[e_]; } @@ -147,18 +142,16 @@ int Latlon::init(grib_handle* h, grib_arguments* args) } for (lai = 0; lai < Nj_; lai++) { - las_[lai] = lat1; + lats_[lai] = lat1; lat1 -= jdir; } /* ECC-1406: Due to rounding, errors can accumulate. * So we ensure the last latitude is latitudeOfLastGridPointInDegrees */ - las_[Nj_ - 1] = lat2; + lats_[Nj_ - 1] = lat2; e_ = -1; return err; } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_latlon.h b/src/geo_iterator/grib_iterator_class_latlon.h similarity index 86% rename from src/iterator/grib_iterator_class_latlon.h rename to src/geo_iterator/grib_iterator_class_latlon.h index 28cd297e0..8d2f5ef90 100644 --- a/src/iterator/grib_iterator_class_latlon.h +++ b/src/geo_iterator/grib_iterator_class_latlon.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_regular.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class Latlon : public Regular { @@ -30,6 +25,4 @@ public: int next(double*, double*, double*) const override; }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_latlon_reduced.cc b/src/geo_iterator/grib_iterator_class_latlon_reduced.cc similarity index 85% rename from src/iterator/grib_iterator_class_latlon_reduced.cc rename to src/geo_iterator/grib_iterator_class_latlon_reduced.cc index ea79c9e77..ba0396912 100644 --- a/src/iterator/grib_iterator_class_latlon_reduced.cc +++ b/src/geo_iterator/grib_iterator_class_latlon_reduced.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_latlon_reduced.h" -eccodes::grib::geo::LatlonReduced _grib_iterator_latlon_reduced{}; -eccodes::grib::geo::Iterator* grib_iterator_latlon_reduced = &_grib_iterator_latlon_reduced; +eccodes::geo_iterator::LatlonReduced _grib_iterator_latlon_reduced{}; +eccodes::geo_iterator::Iterator* grib_iterator_latlon_reduced = &_grib_iterator_latlon_reduced; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { int LatlonReduced::next(double* lat, double* lon, double* val) const { @@ -26,8 +21,8 @@ int LatlonReduced::next(double* lat, double* lon, double* val) const return 0; e_++; - *lat = las_[e_]; - *lon = los_[e_]; + *lat = lats_[e_]; + *lon = lons_[e_]; if (val && data_) { *val = data_[e_]; } @@ -83,8 +78,8 @@ int LatlonReduced::init(grib_handle* h, grib_arguments* args) pl = (long*)grib_context_malloc(h->context, plsize * sizeof(long)); grib_get_long_array_internal(h, plac, pl, &plsize); - las_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); - los_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); + lats_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); + lons_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double)); plmax = pl[0]; for (j = 0; j < nlats; j++) @@ -119,8 +114,8 @@ int LatlonReduced::init(grib_handle* h, grib_arguments* args) nlons2 = 1; idirinc = dlon / nlons2; for (ii = 0; ii < nlons; ii++) { - las_[k] = laf; - los_[k] = tlof; + lats_[k] = laf; + lons_[k] = tlof; tlof += idirinc; k++; } @@ -137,12 +132,10 @@ int LatlonReduced::destroy() { const grib_context* c = h_->context; - grib_context_free(c, las_); - grib_context_free(c, los_); + grib_context_free(c, lats_); + grib_context_free(c, lons_); return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_latlon_reduced.h b/src/geo_iterator/grib_iterator_class_latlon_reduced.h similarity index 75% rename from src/iterator/grib_iterator_class_latlon_reduced.h rename to src/geo_iterator/grib_iterator_class_latlon_reduced.h index 992cba840..cbfdefd4f 100644 --- a/src/iterator/grib_iterator_class_latlon_reduced.h +++ b/src/geo_iterator/grib_iterator_class_latlon_reduced.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class LatlonReduced : public Gen { @@ -27,14 +22,8 @@ public: Iterator* create() const override { return new LatlonReduced(); } int init(grib_handle*, grib_arguments*) override; - int next(double* lat, double* lon, double* val) const override; + int next(double*, double*, double*) const override; int destroy() override; - -private: - double* las_; - double* los_; }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_mercator.cc b/src/geo_iterator/grib_iterator_class_mercator.cc similarity index 97% rename from src/iterator/grib_iterator_class_mercator.cc rename to src/geo_iterator/grib_iterator_class_mercator.cc index 0ef438c45..4d86164b1 100644 --- a/src/iterator/grib_iterator_class_mercator.cc +++ b/src/geo_iterator/grib_iterator_class_mercator.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_mercator.h" -eccodes::grib::geo::Mercator _grib_iterator_mercator{}; -eccodes::grib::geo::Iterator* grib_iterator_mercator = &_grib_iterator_mercator; +eccodes::geo_iterator::Mercator _grib_iterator_mercator{}; +eccodes::geo_iterator::Iterator* grib_iterator_mercator = &_grib_iterator_mercator; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "Mercator Geoiterator" #define EPSILON 1.0e-10 @@ -286,6 +281,4 @@ int Mercator::destroy() return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_mercator.h b/src/geo_iterator/grib_iterator_class_mercator.h similarity index 81% rename from src/iterator/grib_iterator_class_mercator.h rename to src/geo_iterator/grib_iterator_class_mercator.h index 580e26e30..ce4e867b7 100644 --- a/src/iterator/grib_iterator_class_mercator.h +++ b/src/geo_iterator/grib_iterator_class_mercator.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class Mercator : public Gen { @@ -26,12 +21,10 @@ public: Iterator* create() const override { return new Mercator(); } int init(grib_handle*, grib_arguments*) override; - int next(double* lat, double* lon, double* val) const override; + int next(double*, double*, double*) const override; int destroy() override; private: - double* lats_; - double* lons_; long Nj_; int init_mercator(grib_handle*, @@ -43,6 +36,4 @@ private: double, double); }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_polar_stereographic.cc b/src/geo_iterator/grib_iterator_class_polar_stereographic.cc similarity index 97% rename from src/iterator/grib_iterator_class_polar_stereographic.cc rename to src/geo_iterator/grib_iterator_class_polar_stereographic.cc index 2a4a14f5b..f912374e0 100644 --- a/src/iterator/grib_iterator_class_polar_stereographic.cc +++ b/src/geo_iterator/grib_iterator_class_polar_stereographic.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_polar_stereographic.h" -eccodes::grib::geo::PolarStereographic _grib_iterator_polar_stereographic{}; -eccodes::grib::geo::Iterator* grib_iterator_polar_stereographic = &_grib_iterator_polar_stereographic; +eccodes::geo_iterator::PolarStereographic _grib_iterator_polar_stereographic{}; +eccodes::geo_iterator::Iterator* grib_iterator_polar_stereographic = &_grib_iterator_polar_stereographic; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "Polar stereographic Geoiterator" @@ -315,6 +310,4 @@ int PolarStereographic::destroy() return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_polar_stereographic.h b/src/geo_iterator/grib_iterator_class_polar_stereographic.h similarity index 83% rename from src/iterator/grib_iterator_class_polar_stereographic.h rename to src/geo_iterator/grib_iterator_class_polar_stereographic.h index d786f4ee9..6b35c9040 100644 --- a/src/iterator/grib_iterator_class_polar_stereographic.h +++ b/src/geo_iterator/grib_iterator_class_polar_stereographic.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class PolarStereographic : public Gen { @@ -31,11 +26,7 @@ public: int destroy() override; private: - double* lats_; - double* lons_; long Nj_; }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_regular.cc b/src/geo_iterator/grib_iterator_class_regular.cc similarity index 86% rename from src/iterator/grib_iterator_class_regular.cc rename to src/geo_iterator/grib_iterator_class_regular.cc index 28148e94b..0b1865c7c 100644 --- a/src/iterator/grib_iterator_class_regular.cc +++ b/src/geo_iterator/grib_iterator_class_regular.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_regular.h" -eccodes::grib::geo::Regular _grib_iterator_regular{}; -eccodes::grib::geo::Iterator* grib_iterator_regular = &_grib_iterator_regular; +eccodes::geo_iterator::Regular _grib_iterator_regular{}; +eccodes::geo_iterator::Iterator* grib_iterator_regular = &_grib_iterator_regular; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "Regular grid Geoiterator" @@ -29,8 +24,8 @@ int Regular::next(double* lat, double* lon, double* val) const e_++; - *lat = las_[(long)floor(e_ / Ni_)]; - *lon = los_[(long)e_ % Ni_]; + *lat = lats_[(long)floor(e_ / Ni_)]; + *lon = lons_[(long)e_ % Ni_]; if (val && data_) { *val = data_[e_]; } @@ -41,8 +36,8 @@ int Regular::previous(double* lat, double* lon, double* val) const { if (e_ < 0) return 0; - *lat = las_[(long)floor(e_ / Ni_)]; - *lon = los_[e_ % Ni_]; + *lat = lats_[(long)floor(e_ / Ni_)]; + *lon = lons_[e_ % Ni_]; if (val && data_) { *val = data_[e_]; } @@ -54,8 +49,8 @@ int Regular::previous(double* lat, double* lon, double* val) const int Regular::destroy() { const grib_context* c = h_->context; - grib_context_free(c, las_); - grib_context_free(c, los_); + grib_context_free(c, lats_); + grib_context_free(c, lons_); return Gen::destroy(); } @@ -141,15 +136,15 @@ int Regular::init(grib_handle* h, grib_arguments* args) Ni_ = Ni; Nj_ = Nj; - las_ = (double*)grib_context_malloc(h->context, Nj * sizeof(double)); - los_ = (double*)grib_context_malloc(h->context, Ni * sizeof(double)); + lats_ = (double*)grib_context_malloc(h->context, Nj * sizeof(double)); + lons_ = (double*)grib_context_malloc(h->context, Ni * sizeof(double)); if (idir != idir_coded) { grib_context_log(h->context, GRIB_LOG_DEBUG, "%s: Using idir=%g (coded value=%g)", ITER, idir, idir_coded); } for (loi = 0; loi < Ni; loi++) { - los_[loi] = lon1; + lons_[loi] = lon1; lon1 += idir; } @@ -159,11 +154,9 @@ int Regular::init(grib_handle* h, grib_arguments* args) if (lon2 > 0) { lon2 = normalise_longitude_in_degrees(lon2); } - los_[Ni - 1] = lon2; + lons_[Ni - 1] = lon2; return ret; } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_regular.h b/src/geo_iterator/grib_iterator_class_regular.h similarity index 75% rename from src/iterator/grib_iterator_class_regular.h rename to src/geo_iterator/grib_iterator_class_regular.h index a0301bef3..b7d5bfd34 100644 --- a/src/iterator/grib_iterator_class_regular.h +++ b/src/geo_iterator/grib_iterator_class_regular.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class Regular : public Gen { @@ -26,15 +21,13 @@ public: Iterator* create() const override { return new Regular(); } int init(grib_handle*, grib_arguments*) override; - int next(double* lat, double* lon, double* val) const override; - int previous(double* lat, double* lon, double* val) const override; + int next(double*, double*, double*) const override; + int previous(double*, double*, double*) const override; int destroy() override; protected: long Ni_; long Nj_; - double* las_; - double* los_; long iScansNegatively_; long isRotated_; double angleOfRotation_; @@ -44,6 +37,4 @@ protected: long disableUnrotate_; }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_space_view.cc b/src/geo_iterator/grib_iterator_class_space_view.cc similarity index 98% rename from src/iterator/grib_iterator_class_space_view.cc rename to src/geo_iterator/grib_iterator_class_space_view.cc index 0d488be05..ddf8700ed 100644 --- a/src/iterator/grib_iterator_class_space_view.cc +++ b/src/geo_iterator/grib_iterator_class_space_view.cc @@ -10,15 +10,10 @@ #include "grib_iterator_class_space_view.h" -eccodes::grib::geo::SpaceView _grib_iterator_space_view{}; -eccodes::grib::geo::Iterator* grib_iterator_space_view = &_grib_iterator_space_view; +eccodes::geo_iterator::SpaceView _grib_iterator_space_view{}; +eccodes::geo_iterator::Iterator* grib_iterator_space_view = &_grib_iterator_space_view; -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { #define ITER "Space view Geoiterator" @@ -326,6 +321,4 @@ int SpaceView::destroy() return Gen::destroy(); } -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/iterator/grib_iterator_class_space_view.h b/src/geo_iterator/grib_iterator_class_space_view.h similarity index 83% rename from src/iterator/grib_iterator_class_space_view.h rename to src/geo_iterator/grib_iterator_class_space_view.h index 7ed40c853..72a11e68f 100644 --- a/src/iterator/grib_iterator_class_space_view.h +++ b/src/geo_iterator/grib_iterator_class_space_view.h @@ -12,12 +12,7 @@ #include "grib_iterator_class_gen.h" -namespace eccodes -{ -namespace grib -{ -namespace geo -{ +namespace eccodes::geo_iterator { class SpaceView : public Gen { @@ -30,11 +25,7 @@ public: int destroy() override; private: - double* lats_; - double* lons_; long Nj_; }; -} // namespace geo -} // namespace grib -} // namespace eccodes +} // namespace eccodes::geo_iterator diff --git a/src/grib_api_internal.h b/src/grib_api_internal.h index baa1e6af7..d17ffb83f 100644 --- a/src/grib_api_internal.h +++ b/src/grib_api_internal.h @@ -248,12 +248,12 @@ typedef struct grib_codetable grib_codetable; typedef struct grib_smart_table grib_smart_table; class grib_accessor; -namespace eccodes::grib::geo { +namespace eccodes::geo_iterator { class Iterator; } typedef struct grib_iterator { - eccodes::grib::geo::Iterator* iterator; + eccodes::geo_iterator::Iterator* iterator; } grib_iterator; typedef struct grib_nearest_class grib_nearest_class; @@ -1254,7 +1254,7 @@ typedef struct j2k_encode_helper } #include "accessor/grib_accessor.h" #include "accessor/grib_accessors_list.h" -#include "iterator/grib_iterator.h" +#include "geo_iterator/grib_iterator.h" #endif #endif diff --git a/src/grib_iterator_class.cc b/src/grib_iterator_class.cc index 92129285e..0c0e3d6b3 100644 --- a/src/grib_iterator_class.cc +++ b/src/grib_iterator_class.cc @@ -14,8 +14,8 @@ ***************************************************************************/ #include "grib_api_internal.h" -#include "./iterator/grib_iterator.h" -#include "./accessor/grib_accessor_class_iterator.h" +#include "geo_iterator/grib_iterator.h" +#include "accessor/grib_accessor_class_iterator.h" /* This file is generated by ./make_class.pl */ #include "grib_iterator_class.h" @@ -51,7 +51,7 @@ static void init_mutex() struct table_entry { const char* type; - eccodes::grib::geo::Iterator** iterator; + eccodes::geo_iterator::Iterator** iterator; }; static const struct table_entry table[] = { @@ -60,7 +60,7 @@ static const struct table_entry table[] = { }; -eccodes::grib::geo::Iterator* grib_iterator_factory(grib_handle* h, grib_arguments* args, unsigned long flags, int* error) +eccodes::geo_iterator::Iterator* grib_iterator_factory(grib_handle* h, grib_arguments* args, unsigned long flags, int* error) { size_t i = 0, num_table_entries = 0; const char* type = (char*)grib_arguments_get_name(h, args, 0); @@ -69,8 +69,8 @@ eccodes::grib::geo::Iterator* grib_iterator_factory(grib_handle* h, grib_argumen num_table_entries = sizeof(table) / sizeof(table[0]); for (i = 0; i < num_table_entries; i++) { if (strcmp(type, table[i].type) == 0) { - eccodes::grib::geo::Iterator* builder = *(table[i].iterator); - eccodes::grib::geo::Iterator* it = builder->create(); + eccodes::geo_iterator::Iterator* builder = *(table[i].iterator); + eccodes::geo_iterator::Iterator* it = builder->create(); it->flags_ = flags; GRIB_MUTEX_INIT_ONCE(&once, &init_mutex); @@ -95,10 +95,10 @@ eccodes::grib::geo::Iterator* grib_iterator_factory(grib_handle* h, grib_argumen int grib_get_data(const grib_handle* h, double* lats, double* lons, double* values) { int err = 0; - eccodes::grib::geo::Iterator* iter = NULL; + eccodes::geo_iterator::Iterator* iter = NULL; double *lat, *lon, *val; - iter = eccodes::grib::geo::gribIteratorNew(h, 0, &err); + iter = eccodes::geo_iterator::gribIteratorNew(h, 0, &err); if (!iter || err != GRIB_SUCCESS) return err; diff --git a/src/grib_iterator_class.h b/src/grib_iterator_class.h index 833f9b579..31aabe985 100644 --- a/src/grib_iterator_class.h +++ b/src/grib_iterator_class.h @@ -1,13 +1,13 @@ /* This file is automatically generated by ./make_class.pl, do not edit */ -extern eccodes::grib::geo::Iterator* grib_iterator_gaussian; -extern eccodes::grib::geo::Iterator* grib_iterator_gaussian_reduced; -//extern eccodes::grib::geo::Iterator* grib_iterator_gen; -extern eccodes::grib::geo::Iterator* grib_iterator_healpix; -extern eccodes::grib::geo::Iterator* grib_iterator_lambert_azimuthal_equal_area; -extern eccodes::grib::geo::Iterator* grib_iterator_lambert_conformal; -extern eccodes::grib::geo::Iterator* grib_iterator_latlon; -extern eccodes::grib::geo::Iterator* grib_iterator_latlon_reduced; -extern eccodes::grib::geo::Iterator* grib_iterator_mercator; -extern eccodes::grib::geo::Iterator* grib_iterator_polar_stereographic; -extern eccodes::grib::geo::Iterator* grib_iterator_regular; -extern eccodes::grib::geo::Iterator* grib_iterator_space_view; +extern eccodes::geo_iterator::Iterator* grib_iterator_gaussian; +extern eccodes::geo_iterator::Iterator* grib_iterator_gaussian_reduced; +//extern eccodes::geo_iterator::Iterator* grib_iterator_gen; +extern eccodes::geo_iterator::Iterator* grib_iterator_healpix; +extern eccodes::geo_iterator::Iterator* grib_iterator_lambert_azimuthal_equal_area; +extern eccodes::geo_iterator::Iterator* grib_iterator_lambert_conformal; +extern eccodes::geo_iterator::Iterator* grib_iterator_latlon; +extern eccodes::geo_iterator::Iterator* grib_iterator_latlon_reduced; +extern eccodes::geo_iterator::Iterator* grib_iterator_mercator; +extern eccodes::geo_iterator::Iterator* grib_iterator_polar_stereographic; +extern eccodes::geo_iterator::Iterator* grib_iterator_regular; +extern eccodes::geo_iterator::Iterator* grib_iterator_space_view;