YetAnotherCoupler 3.5.2
Loading...
Searching...
No Matches
weights2vtk.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <netcdf.h>
#include "yac_utils.h"
Include dependency graph for weights2vtk.c:

Go to the source code of this file.

Data Structures

struct  link_data
 
struct  grid_config
 

Macros

#define YAC_WEIGHT_FILE_VERSION_1_0_STRING   "yac weight file 1.0"
 
#define CDO_WEIGHT_FILE_TITLE   "CDO remapping"
 
#define STR_USAGE
 
#define YAC_ASSERT(exp, msg)
 
#define YAC_ASSERT_F(exp, format, ...)
 

Enumerations

enum  weight_file_type { WGT_YAC_1_0 , WGT_CDO , WGT_UNKNOWN }
 
enum  grid_type {
  NONE , CUBE , CURVE , UNSTRUCT ,
  GAUSS , SCRIP
}
 

Functions

static void normalise_vector (double v[])
 
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 **vtk_filename)
 
static void read_link_data (char const *weight_filename, int src_address_offset, int tgt_address_offset, struct link_data **links, unsigned *num_links, enum yac_location **src_locations, enum yac_location *tgt_location, unsigned *max_src_idx, unsigned *max_tgt_idx)
 
static void write_data_to_file (char const *filename, struct yac_basic_grid_data src_grid, struct yac_basic_grid_data tgt_grid, struct link_data *links, unsigned num_links, enum yac_location *src_locations, enum yac_location tgt_location)
 
static struct yac_basic_grid_data create_grid (struct grid_config grid_config)
 
int main (int argc, char **argv)
 
static int check_global_attribute (int ncid, char const *att_name, char const *ref_att_text)
 
static enum weight_file_type determine_weight_file_type (int ncid)
 
static void get_cell_middle_point (struct yac_basic_grid_data *grid, size_t cell_index, double *point)
 
static void get_edge_middle_point (struct yac_basic_grid_data *grid, size_t edge_index, double *point)
 
static void get_point_coordinates (struct yac_basic_grid_data *grid, size_t point_index, enum yac_location location, double *point)
 
static int get_point_id (struct yac_basic_grid_data *grid, size_t point_index, enum yac_location location)
 
static void get_link_xyz_coordinates (struct link_data *links, unsigned num_links, struct yac_basic_grid_data *src_grid, struct yac_basic_grid_data *tgt_grid, enum yac_location *src_locations, enum yac_location tgt_location, yac_coordinate_pointer points)
 
static void get_grid_cell_data (struct yac_basic_grid_data *grid, unsigned *cell_data, unsigned offset)
 
static void get_link_address_data (unsigned num_links, unsigned *polygon_data, unsigned offset)
 
static void interpret_grid_arg (struct grid_config *grid_config, char *arg, char *str)
 
static double * generate_vertices (double start, double end, size_t count)
 
static struct yac_basic_grid_data generate_gauss_grid (double *first_corner, double *last_corner, size_t *num_cells)
 
static struct yac_basic_grid_data create_grid (struct grid_config grid_config)
 

Variables

static char const * cmd
 

Macro Definition Documentation

◆ CDO_WEIGHT_FILE_TITLE

#define CDO_WEIGHT_FILE_TITLE   "CDO remapping"

Definition at line 16 of file weights2vtk.c.

◆ STR_USAGE

#define STR_USAGE

Definition at line 29 of file weights2vtk.c.

◆ YAC_ASSERT

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

Definition at line 70 of file weights2vtk.c.

◆ YAC_ASSERT_F

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

Definition at line 78 of file weights2vtk.c.

◆ YAC_WEIGHT_FILE_VERSION_1_0_STRING

#define YAC_WEIGHT_FILE_VERSION_1_0_STRING   "yac weight file 1.0"

Definition at line 15 of file weights2vtk.c.

Enumeration Type Documentation

◆ grid_type

enum grid_type
Enumerator
NONE 
CUBE 
CURVE 
UNSTRUCT 
GAUSS 
SCRIP 

Definition at line 104 of file weights2vtk.c.

◆ weight_file_type

Enumerator
WGT_YAC_1_0 
WGT_CDO 
WGT_UNKNOWN 

Definition at line 22 of file weights2vtk.c.

Function Documentation

◆ check_global_attribute()

static int check_global_attribute ( int ncid,
char const * att_name,
char const * ref_att_text )
static

Definition at line 208 of file weights2vtk.c.

Here is the caller graph for this function:

◆ create_grid() [1/2]

static struct yac_basic_grid_data create_grid ( struct grid_config grid_config)
static
Here is the caller graph for this function:

◆ create_grid() [2/2]

static struct yac_basic_grid_data create_grid ( struct grid_config grid_config)
static

Definition at line 877 of file weights2vtk.c.

Here is the call graph for this function:

◆ determine_weight_file_type()

static enum weight_file_type determine_weight_file_type ( int ncid)
static

Definition at line 236 of file weights2vtk.c.

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

◆ generate_gauss_grid()

static struct yac_basic_grid_data generate_gauss_grid ( double * first_corner,
double * last_corner,
size_t * num_cells )
static

Definition at line 857 of file weights2vtk.c.

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

◆ generate_vertices()

static double * generate_vertices ( double start,
double end,
size_t count )
static

Definition at line 844 of file weights2vtk.c.

Here is the caller graph for this function:

◆ get_cell_middle_point()

static void get_cell_middle_point ( struct yac_basic_grid_data * grid,
size_t cell_index,
double * point )
static

Definition at line 423 of file weights2vtk.c.

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

◆ get_edge_middle_point()

static void get_edge_middle_point ( struct yac_basic_grid_data * grid,
size_t edge_index,
double * point )
static
Examples
test_gcxgc.c, test_latcxlatc.c, and test_pxgc.c.

Definition at line 441 of file weights2vtk.c.

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

◆ get_grid_cell_data()

static void get_grid_cell_data ( struct yac_basic_grid_data * grid,
unsigned * cell_data,
unsigned offset )
static

Definition at line 520 of file weights2vtk.c.

Here is the caller graph for this function:

◆ get_link_address_data()

static void get_link_address_data ( unsigned num_links,
unsigned * polygon_data,
unsigned offset )
static

Definition at line 534 of file weights2vtk.c.

Here is the caller graph for this function:

◆ get_link_xyz_coordinates()

static void get_link_xyz_coordinates ( struct link_data * links,
unsigned num_links,
struct yac_basic_grid_data * src_grid,
struct yac_basic_grid_data * tgt_grid,
enum yac_location * src_locations,
enum yac_location tgt_location,
yac_coordinate_pointer points )
static

Definition at line 504 of file weights2vtk.c.

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

◆ get_point_coordinates()

static void get_point_coordinates ( struct yac_basic_grid_data * grid,
size_t point_index,
enum yac_location location,
double * point )
static

Definition at line 457 of file weights2vtk.c.

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

◆ get_point_id()

static int get_point_id ( struct yac_basic_grid_data * grid,
size_t point_index,
enum yac_location location )
static

Definition at line 479 of file weights2vtk.c.

Here is the caller graph for this function:

◆ interpret_grid_arg()

static void interpret_grid_arg ( struct grid_config * grid_config,
char * arg,
char * str )
static

Definition at line 709 of file weights2vtk.c.

Here is the caller graph for this function:

◆ main()

int main ( int argc,
char ** argv )

Definition at line 154 of file weights2vtk.c.

Here is the call graph for this function:

◆ normalise_vector()

static void normalise_vector ( double v[])
inlinestatic

Definition at line 86 of file weights2vtk.c.

Here is the caller graph for this function:

◆ parse_arguments()

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 ** vtk_filename )
static

Definition at line 763 of file weights2vtk.c.

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

◆ read_link_data()

static void read_link_data ( char const * weight_filename,
int src_address_offset,
int tgt_address_offset,
struct link_data ** links,
unsigned * num_links,
enum yac_location ** src_locations,
enum yac_location * tgt_location,
unsigned * max_src_idx,
unsigned * max_tgt_idx )
static

Definition at line 251 of file weights2vtk.c.

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

◆ write_data_to_file()

static void write_data_to_file ( char const * filename,
struct yac_basic_grid_data src_grid,
struct yac_basic_grid_data tgt_grid,
struct link_data * links,
unsigned num_links,
enum yac_location * src_locations,
enum yac_location tgt_location )
static

Definition at line 541 of file weights2vtk.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 28 of file weights2vtk.c.