YAC 3.12.0
Yet Another Coupler
Loading...
Searching...
No Matches
yac_compute_weights.c File Reference
#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <yaxt.h>
#include <string.h>
#include <netcdf.h>
#include "yac.h"
#include "yac_utils.h"
#include "yac_mpi_common.h"
#include "yac_mpi_internal.h"
Include dependency graph for yac_compute_weights.c:

Go to the source code of this file.

Data Structures

struct  grid_config
 
struct  time_rank
 

Macros

#define DEFAULT_INTERP_STACK
 
#define STR_USAGE
 
#define YAC_ASSERT(exp, msg)
 
#define YAC_ASSERT_F(exp, format, ...)
 

Enumerations

enum  grid_edge_type { GC_EDGES , LL_EDGES }
 

Functions

static void parse_arguments (int argc, char **argv, struct grid_config *src_grid_config, struct grid_config *tgt_grid_config, char const **weight_filename, char const **interp_stack_string, int *print_timer, char const **debug_grid_file)
 
struct yac_interp_stack_configyac_yaml_parse_interp_stack_config_string (char const *interp_stack_config, int parse_flags)
 
static struct yac_basic_gridget_basic_grid_from_config (struct grid_config *grid_config, char const *debug_grid_file)
 
static void grid_config_delete (struct grid_config grid_config)
 
static void timer_start (int print_timer)
 
static void timer_stop (int print_timer, char const *timer_name)
 
static enum grid_edge_type parse_edge_type (char const *edge_type_string)
 
static size_t parse_size_t (char const *size_t_string)
 
static double parse_double (char const *double_string)
 
static char const * get_next_token (char const *token_name)
 
size_t read_netcdf_dimension (char const *filename, char const *dim_name)
 
struct grid_config parse_grid_config_exodus ()
 
struct grid_config parse_grid_config_icon ()
 
struct grid_config parse_grid_config_scrip ()
 
struct grid_config parse_grid_config_reg2d ()
 
struct grid_config parse_grid_config_reg2drot ()
 
static struct grid_config parse_grid_config (char const *grid_config_string_, char const *src_tgt)
 
static void normalise_vector (double v[])
 
static size_t generate_cell_center_coordinates (struct yac_basic_grid *basic_grid)
 
static void generate_reg2d_vertices (size_t *nbr_vertices, double min_lon, double max_lon, double min_lat, double max_lat, double **lon_vertices, double **lat_vertices)
 
static struct yac_basic_gridgenerate_reg2d_grid (struct grid_config grid_config)
 
static struct yac_basic_gridgenerate_reg2drot_grid (struct grid_config grid_config)
 
static void grid_config_delete (struct grid_config grid_config)
 

Variables

static char const * cmd
 
int const YAC_YAML_PARSER_JSON_FORCE
 assume JSON format
 
static struct time_rank local_time_rank
 

Macro Definition Documentation

◆ DEFAULT_INTERP_STACK

#define DEFAULT_INTERP_STACK
Value:
" [\n" \
" {\"conservative\":\n" \
" {\"order\": 1,\n" \
" \"enforced_conservation\": false,\n" \
" \"partial_coverage\": false,\n" \
" \"normalisation\": \"fracarea\"}\n" \
" },\n" \
" {\"fixed\":\n" \
" {\"user_value\": -1}\n" \
" }\n" \
" ]\n"

Definition at line 22 of file yac_compute_weights.c.

◆ STR_USAGE

#define STR_USAGE

Definition at line 34 of file yac_compute_weights.c.

◆ YAC_ASSERT

#define YAC_ASSERT ( exp,
msg )
Value:
{ \
if(!((exp))) { \
fprintf(stderr, "ERROR: %s\n" STR_USAGE, msg, cmd, cmd, cmd); \
exit(EXIT_FAILURE); \
} \
}
static char const * cmd
#define STR_USAGE

Definition at line 114 of file yac_compute_weights.c.

◆ YAC_ASSERT_F

#define YAC_ASSERT_F ( exp,
format,
... )
Value:
{ \
if(!((exp))) { \
fprintf( \
stderr, "ERROR: " format "\n\n" STR_USAGE, \
__VA_ARGS__, cmd, cmd, cmd); \
exit(EXIT_FAILURE); \
} \
}

Definition at line 122 of file yac_compute_weights.c.

Enumeration Type Documentation

◆ grid_edge_type

Enumerator
GC_EDGES 
LL_EDGES 

Definition at line 132 of file yac_compute_weights.c.

Function Documentation

◆ generate_cell_center_coordinates()

static size_t generate_cell_center_coordinates ( struct yac_basic_grid * basic_grid)
static

Definition at line 579 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_reg2d_grid()

static struct yac_basic_grid * generate_reg2d_grid ( struct grid_config grid_config)
static

Definition at line 649 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_reg2d_vertices()

static void generate_reg2d_vertices ( size_t * nbr_vertices,
double min_lon,
double max_lon,
double min_lat,
double max_lat,
double ** lon_vertices,
double ** lat_vertices )
static

Definition at line 627 of file yac_compute_weights.c.

Here is the caller graph for this function:

◆ generate_reg2drot_grid()

static struct yac_basic_grid * generate_reg2drot_grid ( struct grid_config grid_config)
static

Definition at line 687 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_basic_grid_from_config()

static struct yac_basic_grid * get_basic_grid_from_config ( struct grid_config * grid_config,
char const * debug_grid_file )
static

Definition at line 725 of file yac_compute_weights.c.

Here is the call graph for this function:

◆ get_next_token()

static char const * get_next_token ( char const * token_name)
static

Definition at line 347 of file yac_compute_weights.c.

Here is the caller graph for this function:

◆ grid_config_delete() [1/2]

static void grid_config_delete ( struct grid_config grid_config)
static

◆ grid_config_delete() [2/2]

static void grid_config_delete ( struct grid_config grid_config)
static

Definition at line 791 of file yac_compute_weights.c.

◆ normalise_vector()

static void normalise_vector ( double v[])
inlinestatic

Definition at line 570 of file yac_compute_weights.c.

Here is the caller graph for this function:

◆ parse_arguments()

static void parse_arguments ( int argc,
char ** argv,
struct grid_config * src_grid_config,
struct grid_config * tgt_grid_config,
char const ** weight_filename,
char const ** interp_stack_string,
int * print_timer,
char const ** debug_grid_file )
static

Definition at line 508 of file yac_compute_weights.c.

Here is the call graph for this function:

◆ parse_double()

static double parse_double ( char const * double_string)
static

Definition at line 334 of file yac_compute_weights.c.

Here is the caller graph for this function:

◆ parse_edge_type()

static enum grid_edge_type parse_edge_type ( char const * edge_type_string)
static

Definition at line 308 of file yac_compute_weights.c.

Here is the caller graph for this function:

◆ parse_grid_config()

static struct grid_config parse_grid_config ( char const * grid_config_string_,
char const * src_tgt )
static

Definition at line 481 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_grid_config_exodus()

struct grid_config parse_grid_config_exodus ( )

Definition at line 373 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_grid_config_icon()

struct grid_config parse_grid_config_icon ( )

Definition at line 390 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_grid_config_reg2d()

struct grid_config parse_grid_config_reg2d ( )

Definition at line 431 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_grid_config_reg2drot()

struct grid_config parse_grid_config_reg2drot ( )

Definition at line 454 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_grid_config_scrip()

struct grid_config parse_grid_config_scrip ( )

Definition at line 404 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_size_t()

static size_t parse_size_t ( char const * size_t_string)
static

Definition at line 321 of file yac_compute_weights.c.

Here is the caller graph for this function:

◆ read_netcdf_dimension()

size_t read_netcdf_dimension ( char const * filename,
char const * dim_name )

Definition at line 353 of file yac_compute_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timer_start()

static void timer_start ( int print_timer)
static

Definition at line 828 of file yac_compute_weights.c.

◆ timer_stop()

static void timer_stop ( int print_timer,
char const * timer_name )
static

Definition at line 836 of file yac_compute_weights.c.

◆ yac_yaml_parse_interp_stack_config_string()

struct yac_interp_stack_config * yac_yaml_parse_interp_stack_config_string ( char const * interp_stack_config,
int parse_flags )

Parse a "0"-terminated string that contains an interpolation stack configuration

Parameters
[in]interp_stack_configstring containing interpolation stack configuration
[in]parse_flagsflags to be used for parsing the string

Definition at line 2886 of file config_yaml.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cmd

char const* cmd
static

Definition at line 21 of file yac_compute_weights.c.

◆ local_time_rank

struct time_rank local_time_rank
static

Definition at line 198 of file yac_compute_weights.c.

◆ YAC_YAML_PARSER_JSON_FORCE

int const YAC_YAML_PARSER_JSON_FORCE
extern

assume JSON format

Definition at line 70 of file config_yaml.c.