Skip to content

Commit

Permalink
Merge branch 'hotfix/0.31.1'
Browse files Browse the repository at this point in the history
* hotfix/0.31.1:
  Version 0.31.1
  Fix healpix global numbering for pentagon pole elements in parallel
  Fix validity check of atlas::HealpixGrid
  Fix bug introduced in StructuredMeshGenerator global numbering with release 0.31.0 in commit a63fc62
  • Loading branch information
wdeconinck committed Nov 11, 2022
2 parents 93f41b8 + 91c1c2f commit 214ff20
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.31.0
0.31.1
7 changes: 5 additions & 2 deletions src/atlas/grid/StructuredGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "atlas/grid/detail/grid/Healpix.h"
#include "atlas/grid/detail/grid/Structured.h"


namespace atlas {

//---------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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_;
Expand Down
14 changes: 10 additions & 4 deletions src/atlas/meshgenerator/detail/HealpixMeshGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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\"."
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/atlas/meshgenerator/detail/StructuredMeshGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 214ff20

Please sign in to comment.