Skip to content

Commit

Permalink
Add test for mpi_comm with functionspace::BlockStructuredColumns
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Sep 21, 2023
1 parent 87764de commit 1d98b4b
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/tests/functionspace/test_functionspace_splitcomm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "tests/AtlasTestEnvironment.h"
#include "atlas/functionspace/NodeColumns.h"
#include "atlas/functionspace/StructuredColumns.h"
#include "atlas/functionspace/BlockStructuredColumns.h"
#include "atlas/grid/Partitioner.h"
#include "atlas/field/for_each.h"

Expand Down Expand Up @@ -64,7 +65,6 @@ struct Fixture {
}
};


void field_init(Field& field) {
auto fs = field.functionspace();
auto f = array::make_view<double,1>(field);
Expand Down Expand Up @@ -141,6 +141,36 @@ CASE("test FunctionSpace StructuredColumns") {
EXPECT_EQ(checksum, expected_checksum());
}

CASE("test FunctionSpace BlockStructuredColumns") {
Fixture fixture;

auto fs = functionspace::BlockStructuredColumns(grid(),atlas::option::halo(1)|option::mpi_split_comm());
EXPECT_EQUAL(fs.part(),mpi::comm("split").rank());
EXPECT_EQUAL(fs.nb_parts(),mpi::comm("split").size());

auto field = fs.createField<double>();
// field_init(field);

// HaloExchange
// field.haloExchange();
// TODO CHECK

// Gather
auto fieldg = fs.createField<double>(atlas::option::global());
// fs.gather(field,fieldg);

// if (fieldg.size()) {
// idx_t g{0};
// field::for_each_value(fieldg,[&](double x) {
// EXPECT_EQ(++g,x);
// });
// }

// // Checksum
// auto checksum = fs.checksum(field);
// EXPECT_EQ(checksum, expected_checksum());
}

//-----------------------------------------------------------------------------

CASE("test FunctionSpace StructuredColumns with MatchingPartitioner") {
Expand Down

0 comments on commit 1d98b4b

Please sign in to comment.