![]() |
YAC 3.7.0
Yet Another Coupler
|
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <mpi.h>
#include "read_scrip_grid.h"
#include "geometry.h"
#include "utils_common.h"
#include "io_utils.h"
#include "yac_mpi_internal.h"
#include <netcdf.h>
Go to the source code of this file.
Data Structures | |
struct | point_with_index |
struct | cell_vertices_with_index |
struct | cell_vertex_ids_with_index |
Functions | |
static void | remove_duplicated_vertices (double **vertex_lon, double **vertex_lat, size_t *nbr_vertices, int *old_to_new_id) |
static void | remove_duplicated_vertices_parallel (double **vertex_lon, double **vertex_lat, size_t *nbr_vertices, int *old_to_new_id, yac_int **vertex_ids, MPI_Comm comm) |
static void | detect_duplicated_cells (int *cell_to_vertex, int *num_vertices_per_cell, int *cell_mask, size_t nbr_cells, size_t **duplicated_cell_idx, size_t **orig_cell_idx, size_t *nbr_duplicated_cells) |
static void | detect_duplicated_cells_parallel (int *cell_to_vertex, int *num_vertices_per_cell, int *cell_mask, yac_int *cell_ids, size_t num_cells, yac_int *vertex_ids, MPI_Comm comm, size_t **duplicated_cell_idx, yac_int **orig_cell_ids, size_t *num_duplicated_cells_) |
static int | compare_int (const void *a, const void *b) |
static int | compare_yac_int (const void *a, const void *b) |
static int | compare_cell_vertex_ids_with_index_ids (const void *a_, const void *b_) |
static int | compare_cell_vertex_ids_with_index_ids_id (const void *a_, const void *b_) |
static int | compare_point_with_index_coord_id (const void *a_, const void *b_) |
static int | compare_point_with_index_coord (const void *a_, const void *b_) |
static int | compare_point_with_index_rank (const void *a_, const void *b_) |
static int | compare_point_with_index_i (const void *a_, const void *b_) |
static void | yac_read_scrip_basic_grid_information (const char *filename, const char *grid_name, size_t cell_mask_size, int *cell_mask, size_t *num_vertices_, size_t *num_cells_, int **num_vertices_per_cell_, int **cell_to_vertex_, double **x_vertices, double **y_vertices, double **x_cells, double **y_cells, size_t **duplicated_cell_idx_, size_t **orig_cell_idx_, size_t *nbr_duplicated_cells_, int with_vertices) |
static void | yac_read_part_scrip_basic_grid_information (const char *filename, const char *grid_name, size_t cell_mask_size, int *cell_mask, size_t *num_vertices_, size_t *num_cells_, int **num_vertices_per_cell_, int **cell_to_vertex_, double **x_vertices_, double **y_vertices_, yac_int **vertex_ids_, double **x_cells_, double **y_cells_, yac_int **cell_ids_, size_t **duplicated_cell_idx_, yac_int **orig_cell_ids_, size_t *nbr_duplicated_cells_, int io_rank_idx, int num_io_ranks, MPI_Comm comm, int with_vertices) |
static void | yac_read_scrip_mask_information (const char *filename, const char *grid_name, size_t *num_cells_, int **cell_mask) |
static void | yac_read_part_scrip_mask_information (const char *filename, const char *grid_name, size_t *num_cells_, int **cell_mask, int io_rank_idx, int num_io_ranks) |
static void | yac_read_scrip_grid_information_ (char const *grid_filename, char const *mask_filename, char const *grid_name, int valid_mask_value, size_t *num_vertices, size_t *num_cells, int **num_vertices_per_cell, double **x_vertices, double **y_vertices, double **x_cells, double **y_cells, int **cell_to_vertex, int **cell_core_mask, size_t **duplicated_cell_idx, size_t **orig_cell_idx, size_t *nbr_duplicated_cells, int with_vertices) |
void | yac_read_scrip_grid_information (char const *grid_filename, char const *mask_filename, char const *grid_name, int valid_mask_value, size_t *num_vertices, size_t *num_cells, int **num_vertices_per_cell, double **x_vertices, double **y_vertices, double **x_cells, double **y_cells, int **cell_to_vertex, int **cell_core_mask, size_t **duplicated_cell_idx, size_t **orig_cell_idx, size_t *nbr_duplicated_cells) |
static int | get_io_configuration (MPI_Comm comm, int *io_rank_idx, int *num_io_ranks) |
static void | yac_read_part_scrip_grid_information (char const *grid_filename, char const *mask_filename, MPI_Comm comm, char const *grid_name, int valid_mask_value, size_t *num_vertices, size_t *num_cells, int **num_vertices_per_cell, double **x_vertices, double **y_vertices, yac_int **vertex_ids, double **x_cells, double **y_cells, yac_int **cell_ids, int **cell_to_vertex, int **cell_core_mask, size_t **duplicated_cell_idx, yac_int **orig_cell_ids, size_t *nbr_duplicated_cells, int with_vertices) |
static struct yac_basic_grid_data | yac_read_scrip_basic_grid_data_ (char const *grid_filename, char const *mask_filename, MPI_Comm comm, char const *grid_name, int valid_mask_value, int use_ll, double **x_cells, double **y_cells, size_t **duplicated_cell_idx, yac_int **orig_cell_global_ids, size_t *nbr_duplicated_cells) |
struct yac_basic_grid_data | yac_read_scrip_basic_grid_data (char const *grid_filename, char const *mask_filename, char const *grid_name, int valid_mask_value, int use_ll_edges) |
struct yac_basic_grid * | yac_read_scrip_basic_grid_parallel (char const *grid_filename, char const *mask_filename, MPI_Comm comm, char const *grid_name, int valid_mask_value, char const *name, int use_ll_edges, size_t *cell_coord_idx, size_t **duplicated_cell_idx, yac_int **orig_cell_global_ids, size_t *nbr_duplicated_cells) |
struct yac_basic_grid * | yac_read_scrip_basic_grid_parallel_f2c (char const *grid_filename, char const *mask_filename, MPI_Fint comm, char const *grid_name, int valid_mask_value, char const *name, int use_ll_edges, size_t *cell_coord_idx, size_t **duplicated_cell_idx, yac_int **orig_cell_global_ids, size_t *nbr_duplicated_cells) |
struct yac_basic_grid * | yac_read_scrip_basic_grid (char const *grid_filename, char const *mask_filename, char const *grid_name, int valid_mask_value, char const *name, int use_ll_edges, size_t *cell_coord_idx, size_t **duplicated_cell_idx, yac_int **orig_cell_global_ids, size_t *nbr_duplicated_cells) |
static struct yac_basic_grid_data | yac_read_scrip_cloud_basic_grid_data_ (char const *grid_filename, char const *mask_filename, MPI_Comm comm, char const *grid_name, int valid_mask_value, size_t **duplicated_vertex_idx, yac_int **orig_vertex_global_ids, size_t *nbr_duplicated_vertices) |
struct yac_basic_grid_data | yac_read_scrip_cloud_basic_grid_data (char const *grid_filename, char const *mask_filename, char const *grid_name, int valid_mask_value) |
struct yac_basic_grid * | yac_read_scrip_cloud_basic_grid_parallel (char const *grid_filename, char const *mask_filename, MPI_Comm comm, char const *grid_name, int valid_mask_value, char const *name, size_t *vertex_coord_idx, size_t **duplicated_vertex_idx, yac_int **orig_vertex_global_ids, size_t *nbr_duplicated_vertices) |
struct yac_basic_grid * | yac_read_scrip_cloud_basic_grid_parallel_f2c (char const *grid_filename, char const *mask_filename, MPI_Fint comm, char const *grid_name, int valid_mask_value, char const *name, size_t *vertex_coord_idx, size_t **duplicated_vertex_idx, yac_int **orig_vertex_global_ids, size_t *nbr_duplicated_vertices) |
struct yac_basic_grid * | yac_read_scrip_cloud_basic_grid (char const *grid_filename, char const *mask_filename, char const *grid_name, int valid_mask_value, char const *name, size_t *vertex_coord_idx, size_t **duplicated_vertex_idx, yac_int **orig_vertex_global_ids, size_t *nbr_duplicated_vertices) |
static int | check_corner_information (char const *grid_filename, MPI_Comm comm, char const *grid_name) |
struct yac_basic_grid * | yac_read_scrip_generic_basic_grid_parallel (char const *grid_filename, char const *mask_filename, MPI_Comm comm, char const *grid_name, int valid_mask_value, char const *name, int use_ll_edges, size_t *point_coord_idx, size_t **duplicated_point_idx, yac_int **orig_point_global_ids, size_t *nbr_duplicated_points, int *point_location) |
struct yac_basic_grid * | yac_read_scrip_generic_basic_grid_parallel_f2c (char const *grid_filename, char const *mask_filename, MPI_Fint comm, char const *grid_name, int valid_mask_value, char const *name, int use_ll_edges, size_t *point_coord_idx, size_t **duplicated_point_idx, yac_int **orig_point_global_ids, size_t *nbr_duplicated_points, int *point_location) |
static int | compare_cell_vertices_with_index (const void *a, const void *b) |
static struct point_with_index * | remove_duplicated_vertices_ (double **vertex_lon, double **vertex_lat, yac_int **vertex_ids, size_t *nbr_vertices, int *old_to_new_id) |
unsigned long | djb2_hash (unsigned char *values, size_t count) |
static int | compute_bucket (void *data, size_t data_size, int comm_size) |
static MPI_Datatype | get_point_with_index_mpi_datatype (MPI_Comm comm) |
static MPI_Datatype | get_cell_to_vertex_ids_mpi_datatype (MPI_Comm comm, size_t count) |
|
static |
Definition at line 1215 of file read_scrip_grid.c.
|
inlinestatic |
|
inlinestatic |
Definition at line 96 of file read_scrip_grid.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
Definition at line 1402 of file read_scrip_grid.c.
|
static |
Definition at line 1533 of file read_scrip_grid.c.
|
static |
Definition at line 1599 of file read_scrip_grid.c.
unsigned long djb2_hash | ( | unsigned char * | values, |
size_t | count ) |
|
static |
|
static |
Definition at line 849 of file read_scrip_grid.c.
|
static |
Definition at line 1409 of file read_scrip_grid.c.
|
static |
Definition at line 1380 of file read_scrip_grid.c.
|
static |
Definition at line 1313 of file read_scrip_grid.c.
|
static |
Definition at line 1433 of file read_scrip_grid.c.
|
static |
Definition at line 382 of file read_scrip_grid.c.
|
static |
Definition at line 870 of file read_scrip_grid.c.
|
static |
Definition at line 717 of file read_scrip_grid.c.
struct yac_basic_grid * yac_read_scrip_basic_grid | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
int | use_ll_edges, | ||
size_t * | cell_coord_idx, | ||
size_t ** | duplicated_cell_idx, | ||
yac_int ** | orig_cell_global_ids, | ||
size_t * | nbr_duplicated_cells ) |
reads in grid data from a SCRIP formated file
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells as valid |
[in] | name | name of the grid |
[in] | use_ll_edges | if possible represent all edges using lon/lat circles |
[out] | cell_coord_idx | index at which cell centers are registerd in the basic grid |
[out] | duplicated_cell_idx | indices of all duplicated cells |
[out] | orig_cell_global_ids | global ids of the original cells |
[out] | nbr_duplicated_cells | number of duplicated cells |
Definition at line 1098 of file read_scrip_grid.c.
struct yac_basic_grid_data yac_read_scrip_basic_grid_data | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
int | use_ll_edges ) |
reads in an grid in SCRIP format
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells as valid |
[in] | use_ll_edges | if possible represent all edges using lon/lat circles |
Definition at line 1034 of file read_scrip_grid.c.
|
static |
Definition at line 962 of file read_scrip_grid.c.
|
static |
Definition at line 152 of file read_scrip_grid.c.
struct yac_basic_grid * yac_read_scrip_basic_grid_parallel | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
MPI_Comm | comm, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
int | use_ll_edges, | ||
size_t * | cell_coord_idx, | ||
size_t ** | duplicated_cell_idx, | ||
yac_int ** | orig_cell_global_ids, | ||
size_t * | nbr_duplicated_cells ) |
reads in grid data from a SCRIP formated file in parallel and applies a IO decomposition to it
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | comm | MPI communicator containing all proceses that will get a part of the grid |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells as valid |
[in] | name | name of the grid |
[in] | use_ll_edges | if possible represent all edges using lon/lat circles |
[out] | cell_coord_idx | index at which cell centers are registerd in the basic grid |
[out] | duplicated_cell_idx | indices of all duplicated cells |
[out] | orig_cell_global_ids | global ids of the original cells |
[out] | nbr_duplicated_cells | number of duplicated cells |
Definition at line 1045 of file read_scrip_grid.c.
struct yac_basic_grid * yac_read_scrip_basic_grid_parallel_f2c | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
MPI_Fint | comm, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
int | use_ll_edges, | ||
size_t * | cell_coord_idx, | ||
size_t ** | duplicated_cell_idx, | ||
yac_int ** | orig_cell_global_ids, | ||
size_t * | nbr_duplicated_cells ) |
struct yac_basic_grid * yac_read_scrip_cloud_basic_grid | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
size_t * | vertex_coord_idx, | ||
size_t ** | duplicated_vertex_idx, | ||
yac_int ** | orig_vertex_global_ids, | ||
size_t * | nbr_duplicated_vertices ) |
reads in grid data from a SCRIP formated file Only the cell centers are read in and are set as the vertices of the grid. The grid will contain no cells.
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells as valid |
[in] | name | name of the grid |
[out] | vertex_coord_idx | index at which cell centers from the file/ vertices of the basic grid grid are registerd |
[out] | duplicated_vertex_idx | indices of all duplicated vertices |
[out] | orig_vertex_global_ids | global ids of the original vertices |
[out] | nbr_duplicated_vertices | number of duplicated vertices |
Definition at line 1202 of file read_scrip_grid.c.
struct yac_basic_grid_data yac_read_scrip_cloud_basic_grid_data | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
char const * | grid_name, | ||
int | valid_mask_value ) |
reads in an grid in SCRIP format Only the cell centers are read in and are set as the vertices of the grid. The grid will contain no cells.
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells as valid |
Definition at line 1147 of file read_scrip_grid.c.
|
static |
Definition at line 1112 of file read_scrip_grid.c.
struct yac_basic_grid * yac_read_scrip_cloud_basic_grid_parallel | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
MPI_Comm | comm, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
size_t * | vertex_coord_idx, | ||
size_t ** | duplicated_vertex_idx, | ||
yac_int ** | orig_vertex_global_ids, | ||
size_t * | nbr_duplicated_vertices ) |
reads in grid data from a SCRIP formated file in parallel and applies a IO decomposition to it
Only the cell centers are read in and are set as the vertices of the grid. The grid will contain no cells.
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | comm | MPI communicator containing all proceses that will get a part of the grid |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells in the file as valid |
[in] | name | name of the grid |
[out] | vertex_coord_idx | index at which cell centers from the file/ vertices of the basic grid grid are registerd |
[out] | duplicated_vertex_idx | indices of all duplicated vertices |
[out] | orig_vertex_global_ids | global ids of the original vertices |
[out] | nbr_duplicated_vertices | number of duplicated vertices |
Definition at line 1157 of file read_scrip_grid.c.
struct yac_basic_grid * yac_read_scrip_cloud_basic_grid_parallel_f2c | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
MPI_Fint | comm, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
size_t * | vertex_coord_idx, | ||
size_t ** | duplicated_vertex_idx, | ||
yac_int ** | orig_vertex_global_ids, | ||
size_t * | nbr_duplicated_vertices ) |
struct yac_basic_grid * yac_read_scrip_generic_basic_grid_parallel | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
MPI_Comm | comm, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
int | use_ll_edges, | ||
size_t * | point_coord_idx, | ||
size_t ** | duplicated_point_idx, | ||
yac_int ** | orig_point_global_ids, | ||
size_t * | nbr_duplicated_points, | ||
int * | point_location ) |
reads in grid data from a SCRIP formated file in parallel and applies a IO decomposition to it In case the grid files contains corner information for the specified grid, this reader will behave as yac_read_scrip_basic_grid_parallel otherwise it will return a cloud grid, as if yac_read_scrip_cloud_basic_grid_parallel was called.
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | comm | MPI communicator containing all proceses that will get a part of the grid |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells as valid |
[in] | name | name of the grid |
[in] | use_ll_edges | if possible represent all edges using lon/lat circles |
[out] | point_coord_idx | index at which cell centers/vertices are registerd in the basic grid |
[out] | duplicated_point_idx | indices of all duplicated cells |
[out] | orig_point_global_ids | global ids of the original cells |
[out] | nbr_duplicated_points | number of duplicated cells |
[out] | point_location | YAC_LOC_CELL or YAC_LOC_CORNER, depending on whether corner information was available or not |
Definition at line 1256 of file read_scrip_grid.c.
struct yac_basic_grid * yac_read_scrip_generic_basic_grid_parallel_f2c | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
MPI_Fint | comm, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
char const * | name, | ||
int | use_ll_edges, | ||
size_t * | point_coord_idx, | ||
size_t ** | duplicated_point_idx, | ||
yac_int ** | orig_point_global_ids, | ||
size_t * | nbr_duplicated_points, | ||
int * | point_location ) |
void yac_read_scrip_grid_information | ( | char const * | grid_filename, |
char const * | mask_filename, | ||
char const * | grid_name, | ||
int | valid_mask_value, | ||
size_t * | num_vertices, | ||
size_t * | num_cells, | ||
int ** | num_vertices_per_cell, | ||
double ** | x_vertices, | ||
double ** | y_vertices, | ||
double ** | x_cells, | ||
double ** | y_cells, | ||
int ** | cell_to_vertex, | ||
int ** | cell_core_mask, | ||
size_t ** | duplicated_cell_idx, | ||
size_t ** | orig_cell_idx, | ||
size_t * | nbr_duplicated_cells ) |
reads in an grid in SCRIP format
[in] | grid_filename | name of the SCRIP grid netcdf file |
[in] | mask_filename | name of the SCRIP mask netcdf file |
[in] | grid_name | name of the grid in the file |
[in] | valid_mask_value | value that marks cells as valid |
[out] | num_vertices | number of vertices in the grid |
[out] | num_cells | number of cells in the grid |
[out] | num_vertices_per_cell | number of vertices per cell |
[out] | x_vertices | longitude coordinates of the vertices |
[out] | y_vertices | latitude coordinates of the vertices |
[out] | x_cells | longitude coordinates of cell points |
[out] | y_cells | latitude coordinates of cell points |
[out] | cell_to_vertex | vertices indices per cell |
[out] | cell_core_mask | cell core mask |
[out] | duplicated_cell_idx | indices of all duplicated cells |
[out] | orig_cell_idx | indices of the original cells |
[out] | nbr_duplicated_cells | number of duplicated cells |
Definition at line 833 of file read_scrip_grid.c.
|
static |
Definition at line 785 of file read_scrip_grid.c.
|
static |
Definition at line 669 of file read_scrip_grid.c.