This contains a test of the proc_sphere_part grid search algorithm.
#include <stdlib.h>
#include <mpi.h>
#include "tests.h"
#include "test_common.h"
MPI_Init(NULL, NULL);
int comm_rank, comm_size;
MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank);
MPI_Comm_size(MPI_COMM_WORLD, &comm_size);
YAC_ASSERT(comm_size == 5,
"ERROR wrong number of processes (has to be 5)")
{
double x_vertices[18] = {0,20,40,60,80,
100,120,140,160,180,
200,220,240,260,280,
300,320,340};
double y_vertices[9] = {-80,-60,-40,-20,0,20,40,60,80};
size_t local_start[5][2] = {{0,0},{7,0},{0,0},{0,3},{7,3}};
size_t local_count[5][2] = {{10,6},{10,6},{0,0},{10,6},{10,6}};
size_t num_cells = local_count[comm_rank][0] * local_count[comm_rank][1];
for (size_t i = 0, k = 0; i < local_count[comm_rank][1]; ++i)
for (size_t j = 0; j < local_count[comm_rank][0]; ++j, ++k)
x_vertices[local_start[comm_rank][0]+j],
y_vertices[local_start[comm_rank][1]+i], cells[k].
coord);
free(cells);
}
{
double coords[5][2][3] =
{{{1,0,0},{-1,0,0}},
{{0,1,0}},
{{0,-1,0}},
{{0,0,1}},
{{0,0,-1}}};
size_t num_cells[5] = {2,1,1,1,1};
for (int i = 0; i < num_cells[comm_rank]; ++i)
for (int j = 0; j < 3; ++j)
cells[i].
coord[j] = coords[comm_rank][i][j];
free(cells);
}
{
size_t num_cells = 0;
}
MPI_Finalize();
return TEST_EXIT_CODE;
}
static void LLtoXYZ_deg(double lon, double lat, double p_out[])
void yac_proc_sphere_part_node_delete(struct proc_sphere_part_node *node)
struct proc_sphere_part_node * yac_redistribute_cells(struct dist_cell **cells, size_t *num_cells, MPI_Comm comm)
int main(int argc, char **argv)
#define YAC_ASSERT(exp, msg)