A test for the generation of cubed sphere grids used in several toy models.
#include <unistd.h>
#include "tests.h"
{
unsigned n = 20;
PUT_ERR("ERROR: wrong number of cells\n");
PUT_ERR("ERROR: wrong number of grid vertices\n")
#ifdef WRITE_VTK_GRID_FILE
#endif
}
{
unsigned n = 32;
unsigned ref_num_core_cells = n * n * 6;
int sizes[] = {1,3,6,11};
for (size_t i = 0; i < (sizeof(sizes)/sizeof(sizes[0])); ++i) {
unsigned num_core_cells = 0;
for (int rank = 0, size = sizes[i]; rank < size; ++rank) {
unsigned nbr_vertices;
unsigned nbr_cells;
double * x_vertices;
double * y_vertices;
double * x_cells;
double * y_cells;
int * global_cell_id;
int * cell_core_mask;
int * global_corner_id;
int * corner_core_mask;
&x_vertices, &y_vertices, &x_cells, &y_cells,
&global_cell_id, &cell_core_mask, &global_corner_id, &corner_core_mask,
rank, size);
for (unsigned j = 0; j < nbr_cells; ++j)
if (cell_core_mask[j]) ++num_core_cells;
free(x_vertices);
free(y_vertices);
free(x_cells);
free(y_cells);
free(global_cell_id);
free(cell_core_mask);
free(global_corner_id);
free(corner_core_mask);
}
if (ref_num_core_cells != num_core_cells)
PUT_ERR("wrong number of cells");
}
}
{
char const * grid_filename = "test_generate_cubed_sphere.nc";
unsigned n = 20;
PUT_ERR("ERROR: wrong number of cells\n");
PUT_ERR("ERROR: wrong number of grid vertices\n")
#ifdef WRITE_VTK_GRID_FILE
#endif
unlink(grid_filename);
}
return TEST_EXIT_CODE;
}
void yac_basic_grid_data_free(struct yac_basic_grid_data grid)
int main(int argc, char **argv)
void yac_generate_part_cube_grid_information(unsigned n, unsigned *nbr_vertices, unsigned *nbr_cells, unsigned **num_vertices_per_cell, unsigned **cell_to_vertex, double **x_vertices, double **y_vertices, double **x_cells, double **y_cells, int **global_cell_id, int **cell_core_mask, int **global_corner_id, int **corner_core_mask, int rank, int size)
void yac_write_cubed_sphere_grid(unsigned n, char const *filename)
struct yac_basic_grid_data yac_generate_cubed_sphere_grid(unsigned n)
void yac_write_basic_grid_data_to_file(struct yac_basic_grid_data *grid, char const *name)
struct yac_basic_grid_data yac_read_icon_basic_grid_data(char const *filename)
int * num_vertices_per_cell