diff --git a/CHANGELOG.md b/CHANGELOG.md index abc131be9..401372d81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ## [Unreleased] +## [0.31.1] - 2022-11-11 +### Fixed +- Fix bug introduced in StructuredMeshGenerator global numbering with release 0.31.0 in commit a63fc62a2 +- Fix healpix global numbering for pentagon pole elements in parallel +- Fix validity check of atlas::HealpixGrid + ## [0.31.0] - 2022-11-10 ### Added - Extend PointCloud functionspace to do halo exchanges, including Fortran API @@ -405,6 +411,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ## 0.13.0 - 2018-02-16 [Unreleased]: https://github.com/ecmwf/atlas/compare/master...develop +[0.31.1]: https://github.com/ecmwf/atlas/compare/0.31.0...0.31.1 [0.31.0]: https://github.com/ecmwf/atlas/compare/0.30.0...0.31.0 [0.30.0]: https://github.com/ecmwf/atlas/compare/0.29.0...0.30.0 [0.29.0]: https://github.com/ecmwf/atlas/compare/0.28.1...0.29.0 diff --git a/VERSION b/VERSION index 26bea73e8..f176c9441 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.31.0 +0.31.1 diff --git a/src/atlas/grid/StructuredGrid.h b/src/atlas/grid/StructuredGrid.h index ab7749ffb..a78feeabb 100644 --- a/src/atlas/grid/StructuredGrid.h +++ b/src/atlas/grid/StructuredGrid.h @@ -18,7 +18,6 @@ #include "atlas/grid/detail/grid/Healpix.h" #include "atlas/grid/detail/grid/Structured.h" - namespace atlas { //--------------------------------------------------------------------------------------------------------------------- @@ -275,7 +274,11 @@ class HealpixGrid : public StructuredGrid { HealpixGrid(const Grid&); HealpixGrid(int N); - bool valid() { return grid_; } + operator bool() const { return valid(); } + + bool valid() const { return grid_; } + + long N() const { return grid_->nxmax() / 4; } private: const grid_t* grid_; diff --git a/src/atlas/meshgenerator/detail/HealpixMeshGenerator.cc b/src/atlas/meshgenerator/detail/HealpixMeshGenerator.cc index 1cbe8bda7..189787e96 100644 --- a/src/atlas/meshgenerator/detail/HealpixMeshGenerator.cc +++ b/src/atlas/meshgenerator/detail/HealpixMeshGenerator.cc @@ -64,7 +64,7 @@ HealpixMeshGenerator::HealpixMeshGenerator(const eckit::Parametrisation& p) { options.set("3d", three_dimensional); } - std::string pole_elements{"quqds"}; + std::string pole_elements{"quads"}; if (p.get("pole_elements", pole_elements)) { if (pole_elements != "pentagons" and pole_elements != "quads") { Log::warning() << "Atlas::HealpixMeshGenerator accepts \"pentagons\" or \"quads\" for \"pole_elements\"." @@ -931,8 +931,10 @@ void HealpixMeshGenerator::generate_mesh(const StructuredGrid& grid, const grid: ii = 0; // index inside SB (surrounding belt) int jcell_offset = 0; // global index offset due to extra points at the north pole gidx_t jcell = 0; // global cell counter + gidx_t points_in_partition = 0; for (iy = iy_min; iy <= iy_max; iy++) { int nx = nb_lat_nodes(iy) + 1; + points_in_partition += (nx - 1); for (ix = 0; ix < nx; ix++) { const bool at_pole = (iy == 0 or iy == ny - 1); int not_duplicate_cell = (at_pole ? ix % 2 : 1); @@ -963,7 +965,7 @@ void HealpixMeshGenerator::generate_mesh(const StructuredGrid& grid, const grid: // match global cell indexing for the three healpix versions if (nb_pole_nodes == 1) { - cells_glb_idx(jquadcell) = jquadcell + 1; + cells_glb_idx(jquadcell) = parts_sidx + points_in_partition - nx + ix + 1; } else if (nb_pole_nodes == 8) { if (iy == 0) { @@ -979,11 +981,15 @@ void HealpixMeshGenerator::generate_mesh(const StructuredGrid& grid, const grid: } } else if (nb_pole_nodes == 4) { + if (iy == 0 or iy == ny - 1) { + continue; + } if (pentagon) { - cells_glb_idx(jpentcell) = jcell; + cells_glb_idx(jpentcell) = (mypart != 0 ? 12 * ns * ns - 3 + ix : jcell); + jcell_offset++; } else { - cells_glb_idx(jquadcell) = jcell; + cells_glb_idx(jquadcell) = parts_sidx + points_in_partition - nx - 6 + ix + (mypart != 0 ? 4 : jcell_offset); } } #if DEBUG_OUTPUT_DETAIL diff --git a/src/atlas/meshgenerator/detail/StructuredMeshGenerator.cc b/src/atlas/meshgenerator/detail/StructuredMeshGenerator.cc index c0fe3d4bf..4a4b773fe 100644 --- a/src/atlas/meshgenerator/detail/StructuredMeshGenerator.cc +++ b/src/atlas/meshgenerator/detail/StructuredMeshGenerator.cc @@ -1264,7 +1264,7 @@ void StructuredMeshGenerator::generate_mesh(const StructuredGrid& rg, const grid }; bool regular_cells_glb_idx = atlas::RegularLonLatGrid(rg); - if( options.getBool("triangulate") ) { + if( options.getBool("triangulate") || y_numbering > 0) { regular_cells_glb_idx = false; } @@ -1306,7 +1306,7 @@ void StructuredMeshGenerator::generate_mesh(const StructuredGrid& rg, const grid if (periodic_east_west) { ++nx; } - cells_glb_idx(jcell) = jlatN * nx + region.lat_begin[jlat] + jelem; + cells_glb_idx(jcell) = glb_idx( quad_nodes[0] ); } } else // This is a triag