Skip to content

Commit

Permalink
Merge pull request #20 from twsearle/feature/mpi-halo-resize
Browse files Browse the repository at this point in the history
Refactor to allow halo > 0 decomposition of the mesh
  • Loading branch information
wdeconinck authored Sep 4, 2024
2 parents d9ff4d3 + 18f3137 commit 3352e60
Show file tree
Hide file tree
Showing 18 changed files with 1,663 additions and 417 deletions.
4 changes: 4 additions & 0 deletions src/atlas-orca/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ ecbuild_add_library(
grid/OrcaGridBuilder.cc
meshgenerator/OrcaMeshGenerator.cc
meshgenerator/OrcaMeshGenerator.h
meshgenerator/SurroundingRectangle.cc
meshgenerator/SurroundingRectangle.h
meshgenerator/LocalOrcaGrid.cc
meshgenerator/LocalOrcaGrid.h
util/AtlasIOReader.h
util/ComputeCachedPath.h
util/ComputeUid.h
Expand Down
5 changes: 5 additions & 0 deletions src/atlas-orca/grid/Orca.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "atlas-orca/util/OrcaData.h"
#include "atlas-orca/util/OrcaDataFile.h"
#include "atlas-orca/util/OrcaPeriodicity.h"
#include "atlas-orca/util/PointIJ.h"


namespace atlas::grid::detail::grid {
Expand Down Expand Up @@ -83,6 +84,10 @@ gidx_t Orca::periodicIndex( idx_t i, idx_t j ) const {
return index( p.i - imin_, p.j - jmin_ );
}

orca::PointIJ Orca::periodicIJ( idx_t i, idx_t j ) const {
return periodicity_->compute( i + imin_, j + jmin_ );
}

Orca::Orca( const Config& config ) :
Orca( spec_name( config, spec_uid( config, config.getString( "name", "" ) ) ), config ) {}

Expand Down
3 changes: 2 additions & 1 deletion src/atlas-orca/grid/Orca.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "atlas/runtime/Exception.h"
#include "atlas/util/Config.h"
#include "atlas/util/Point.h"
#include "atlas-orca/util/PointIJ.h"

namespace atlas {
class Mesh;
Expand Down Expand Up @@ -165,7 +166,6 @@ class Orca final : public Grid {
/// Constructor taking a name/uid and a configuration (spec)
Orca( const std::string& name_or_uid, const Config& );

public:
idx_t size() const override;

Spec spec() const override;
Expand Down Expand Up @@ -196,6 +196,7 @@ class Orca final : public Grid {
bool invalidElement( idx_t i, idx_t j ) const { return invalid_element_[( imin_ + i ) + ( jmin_ + j ) * jstride_]; }

gidx_t periodicIndex( idx_t i, idx_t j ) const;
atlas::orca::PointIJ periodicIJ( idx_t i, idx_t j ) const;

void index2ij( gidx_t gidx, idx_t& i, idx_t& j ) const {
//gidx = jstride_ * (jmin_+j) + (imin_+i);
Expand Down
2 changes: 2 additions & 0 deletions src/atlas-orca/grid/OrcaGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "Orca.h"
#include "atlas/grid/Grid.h"
#include "atlas-orca/util/PointIJ.h"


namespace atlas {
Expand Down Expand Up @@ -53,6 +54,7 @@ class OrcaGrid : public Grid {
int haloSouth() const { return grid_->haloSouth(); }

gidx_t periodicIndex( idx_t i, idx_t j ) const { return grid_->periodicIndex( i, j ); }
orca::PointIJ periodicIJ( idx_t i, idx_t j ) const { return grid_->periodicIJ( i, j ); }

void index2ij( gidx_t gidx, idx_t& i, idx_t& j ) const { grid_->index2ij( gidx, i, j ); }

Expand Down
Loading

0 comments on commit 3352e60

Please sign in to comment.