Skip to content

Commit

Permalink
Add FunctionSpace::partition() field
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Sep 19, 2023
1 parent 4f9b29c commit b87aa4a
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/atlas/functionspace/CellColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,10 @@ Field CellColumns::ghost() const {
return mesh_.cells().field("ghost");
}

Field CellColumns::partition() const {
return mesh_.cells().partition();
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/functionspace/CellColumns.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class CellColumns : public functionspace::FunctionSpaceImpl {

Field ghost() const override;

Field partition() const override;

private: // methods
idx_t config_size(const eckit::Configuration& config) const;
array::DataType config_datatype(const eckit::Configuration&) const;
Expand Down
4 changes: 4 additions & 0 deletions src/atlas/functionspace/EdgeColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ Field EdgeColumns::remote_index() const {
return edges().remote_index();
};

Field EdgeColumns::partition() const {
return edges().partition();
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/functionspace/EdgeColumns.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class EdgeColumns : public functionspace::FunctionSpaceImpl {

Field remote_index() const override;

Field partition() const override;

private: // methods
idx_t config_size(const eckit::Configuration& config) const;
array::DataType config_datatype(const eckit::Configuration&) const;
Expand Down
4 changes: 4 additions & 0 deletions src/atlas/functionspace/FunctionSpace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ Field FunctionSpace::remote_index() const {
return get()->remote_index();
}

Field FunctionSpace::partition() const {
return get()->partition();
}

void FunctionSpace::haloExchange(const FieldSet& fields, bool on_device) const {
get()->haloExchange(fields, on_device);
}
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/functionspace/FunctionSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class FunctionSpace : DOXYGEN_HIDE(public util::ObjectHandle<functionspace::Func

Field remote_index() const;

Field partition() const;

const parallel::GatherScatter& gather() const;
const parallel::GatherScatter& scatter() const;
};
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/functionspace/NodeColumns.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ class NodeColumns : public functionspace::FunctionSpaceImpl {

Field remote_index() const override { return nodes_.remote_index(); }

Field partition() const override { return nodes_.partition(); }

const util::PartitionPolygon& polygon(idx_t halo = 0) const override { return mesh_.polygon(halo); }

const util::PartitionPolygons& polygons() const override { return mesh_.polygons(); }
Expand Down
1 change: 1 addition & 0 deletions src/atlas/functionspace/PointCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class PointCloud : public functionspace::FunctionSpaceImpl {
Field ghost() const override;
Field remote_index() const override { return remote_index_; }
Field global_index() const override { return global_index_; }
Field partition() const override { return partition_; }
virtual idx_t size() const override { return lonlat_.shape(0); }

using FunctionSpaceImpl::createField;
Expand Down
2 changes: 1 addition & 1 deletion src/atlas/functionspace/detail/BlockStructuredColumns.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class BlockStructuredColumns : public FunctionSpaceImpl {
Field lonlat() const override { return structuredcolumns_->lonlat(); }
Field xy() const { return structuredcolumns_->xy(); }
Field z() const { return structuredcolumns_->z(); }
Field partition() const { return structuredcolumns_->partition(); }
Field partition() const override { return structuredcolumns_->partition(); }
Field global_index() const override { return structuredcolumns_->global_index(); }
Field remote_index() const override { return structuredcolumns_->remote_index(); }
Field index_i() const { return structuredcolumns_->index_i(); }
Expand Down
4 changes: 4 additions & 0 deletions src/atlas/functionspace/detail/FunctionSpaceImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Field FunctionSpaceImpl::remote_index() const {
ATLAS_NOTIMPLEMENTED;
}

Field FunctionSpaceImpl::partition() const {
ATLAS_NOTIMPLEMENTED;
}

Field FunctionSpaceImpl::global_index() const {
ATLAS_NOTIMPLEMENTED;
}
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/functionspace/detail/FunctionSpaceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class FunctionSpaceImpl : public util::Object {

virtual atlas::Field remote_index() const;

virtual atlas::Field partition() const;

virtual atlas::Field global_index() const;

virtual const util::PartitionPolygons& polygons() const;
Expand Down
2 changes: 1 addition & 1 deletion src/atlas/functionspace/detail/StructuredColumns.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class StructuredColumns : public FunctionSpaceImpl {
Field lonlat() const override { return field_xy_; }
Field xy() const { return field_xy_; }
Field z() const { return field_z_; }
Field partition() const { return field_partition_; }
Field partition() const override { return field_partition_; }
Field global_index() const override { return field_global_index_; }
Field remote_index() const override {
if (not field_remote_index_) {
Expand Down

0 comments on commit b87aa4a

Please sign in to comment.