TheBoussinesqModel  3.2.1
 All Data Structures Files Functions Variables Typedefs Macros Pages
bigcells2.h File Reference

Go to the source code of this file.

Data Structures

struct  GRID
 
struct  SQUARE_GRID
 
struct  LONGMATRIX_VECTOR
 
struct  DOUBLESQUARE_GRID
 
struct  RASTER_MAP
 
struct  DOUBLERASTER_MAP
 

Functions

SQUARE_GRIDget_square_grid (DOUBLEMATRIX *DTM, T_INIT *UV, char *file_resume_lines, char *file_resume_polygons, char *file_resume_connections, long(*index_pixel_from_a_bin)(long r, long c, LONGVECTOR *s_index), int(*check_novalues)(double x, DOUBLEVECTOR *V), long displacement, short print)
 
void write_grid (GRID *grid)
 
void free_longmatrix_vector (LONGMATRIX_VECTOR *lmv)
 
RASTER_MAPnew_raster_map (long nh)
 
int add_map_to_raster (long index, char *filename, RASTER_MAP *raster, short a, short print)
 
DOUBLERASTER_MAPget_doubleraster_map (long n_coarsemaps, long n_finemaps, char *coarse_mapname, char *fine_mapname, short print)
 
DOUBLESQUARE_GRIDget_doublesquare_grid (DOUBLERASTER_MAP *draster, char *resume_filenames, long(*index_pixel_from_a_bin_coarse)(long r, long c, LONGVECTOR *s_index), long(*index_pixel_from_a_bin_fine)(long r, long c, LONGVECTOR *s_index), long d_coarse, long d_fine, short print)
 
LONGMATRIX_VECTORnew_longmatrix_vector (long nh)
 
LONGMATRIX_VECTORget_fine_indices (LONGMATRIX *fine, LONGMATRIX *coarse, long i_firstcell, long i_lastcell, long novalue, short print)
 
LONGBINget_fine_line_indices (LONGMATRIX *h_fine, LONGMATRIX *h_coarse, LONGMATRIX *v_fine, LONGMATRIX *v_coarse, long n_horizontal, long n_lines, long novalue, short print)
 
int write_longmatrix_vector (LONGMATRIX_VECTOR *lmv, char *filename)
 
int write_doublesquare_grid (DOUBLESQUARE_GRID *dsq)
 
void free_grid (GRID *grid)
 
void free_square_grid (SQUARE_GRID *sq)
 
void free_raster_map (RASTER_MAP *raster)
 
void free_doubleraster_map (DOUBLERASTER_MAP *draster)
 
void free_doublesquare_grid (DOUBLESQUARE_GRID *dsq)
 
char * strcpy2 (char *dest, const char *src)
 
char * copy_string (char *origin)
 

Function Documentation

int add_map_to_raster ( long  index,
char *  filename,
RASTER_MAP raster,
short  a,
short  print 
)
Author
Emanuele Cordano
Date
April 2008
Parameters
index(param) - index at which he map is added in the raster map class;
filename(char *) - filename of the map in asccii format
raster(RASTER_MAP *) - raster map class
a- (short) parameter to check boundary and novalue (0: nocheck, 1: check boundary, 2: check boundary and novaule (if raster->reference_index_map is set to NULL, a=0 by default)
print(short) - print parameter

add a map from asccii format to a raster_map class

Definition at line 161 of file bigcells2.c.

References free_doublematrix(), INTEGER_NULL, RASTER_MAP::layer, DOUBLEMATRIX::nch, new_doublematrix(), RASTER_MAP::nh, DOUBLEMATRIX::nrh, read_map(), RASTER_MAP::reference_index_map, and RASTER_MAP::UV.

Referenced by get_doubleraster_map().

char* copy_string ( char *  origin)
void free_doubleraster_map ( DOUBLERASTER_MAP draster)
Author
Emanuele Cordano
Date
April 2009

Definition at line 651 of file bigcells2.c.

References DOUBLERASTER_MAP::coarse, DOUBLERASTER_MAP::fine, free_raster_map(), DOUBLERASTER_MAP::mapname_coarse, and DOUBLERASTER_MAP::mapname_fine.

Referenced by main().

void free_longmatrix_vector ( LONGMATRIX_VECTOR lmv)

free function

Author
Emanuele Cordano
Date
April 2009

Definition at line 560 of file bigcells2.c.

References LONGMATRIX_VECTOR::element, free_longmatrix(), LONGMATRIX_VECTOR::nh, and LONGMATRIX_VECTOR::nl.

Referenced by free_doublesquare_grid(), and get_fine_line_indices().

void free_raster_map ( RASTER_MAP raster)
Author
Emanuele Cordano
Date
April 2008

Definition at line 629 of file bigcells2.c.

References free_doublematrix(), free_doublevector(), RASTER_MAP::layer, RASTER_MAP::nl, T_INIT::U, RASTER_MAP::UV, and T_INIT::V.

Referenced by free_doubleraster_map().

void free_square_grid ( SQUARE_GRID sq)
Author
Emanuele Cordano
Date
April 2009 An attemp was made to free a non dynamic matrix free_longmatrix

Definition at line 606 of file bigcells2.c.

References free_grid(), free_longmatrix(), SQUARE_GRID::grid, SQUARE_GRID::indices_horizontal_lines, SQUARE_GRID::indices_pixel, SQUARE_GRID::indices_vertex, and SQUARE_GRID::indices_vertical_lines.

Referenced by free_doublesquare_grid().

DOUBLERASTER_MAP* get_doubleraster_map ( long  n_coarsemaps,
long  n_finemaps,
char *  coarse_mapname,
char *  fine_mapname,
short  print 
)
Author
Emanuele Cordano
Date
April 2009
Parameters
-(long) number of coarse-grid maps
-(long) number of fine-grid maps
-(char *) - name of the file containing the coarse grid map (reference map)
-(char *) - name of the file containing the fine grid map (reference map);
(short)print;
Returns
a DOUBLERASTER_MAP

Definition at line 372 of file bigcells2.c.

References add_map_to_raster(), DOUBLERASTER_MAP::coarse, copy_string(), draster, DOUBLERASTER_MAP::fine, DOUBLERASTER_MAP::mapname_coarse, DOUBLERASTER_MAP::mapname_fine, new_raster_map(), RASTER_MAP::nl, and t_error().

Referenced by main().

DOUBLESQUARE_GRID* get_doublesquare_grid ( DOUBLERASTER_MAP draster,
char *  resume_filenames,
long(*)(long r, long c, LONGVECTOR *s_index)  index_pixel_from_a_bin_coarse,
long(*)(long r, long c, LONGVECTOR *s_index)  index_pixel_from_a_bin_fine,
long  d_coarse,
long  d_fine,
short  print 
)
Author
Emanuele Cordano
Date
April 2009
Parameters
-DOUBLERASTER_MAP *draster
-(char *) root neme of textfiles containing the struct information.
long(*index_pixel_from_a_bin_coarse)(long r, long c,LONGVECTOR *s_index) - equation of the filling curve for the pixel of a coarse grid
long(*index_pixel_from_a_bin_fine)(long r, long c,LONGVECTOR *s_index),long d_coarse,long d_fine,short print) - equation of the filling curve for the pixel of a fine grid
(long)d_coarse - displacement for coarse grid
(long)d_fine - displacement for fine grid
(short)print

Definition at line 421 of file bigcells2.c.

References DOUBLESQUARE_GRID::big, RASTER_MAP::check_novalues, DOUBLERASTER_MAP::coarse, copy_string(), dsq, DOUBLESQUARE_GRID::file_resume_c_line, DOUBLESQUARE_GRID::file_resume_c_polygon, DOUBLESQUARE_GRID::fine, DOUBLERASTER_MAP::fine, get_fine_indices(), get_fine_line_indices(), get_square_grid(), SQUARE_GRID::grid, SQUARE_GRID::indices_horizontal_lines, SQUARE_GRID::indices_pixel, SQUARE_GRID::indices_vertical_lines, join_strings(), RASTER_MAP::layer, GRID::lines, LINEVECTOR::nh, POLYGONVECTOR::nh, SQUARE_GRID::nhorizontal_lines, POLYGONVECTOR::nl, SQUARE_GRID::novalue, GRID::polygons, RASTER_MAP::reference_index_map, DOUBLESQUARE_GRID::small_content_line, DOUBLESQUARE_GRID::small_content_polygon, t_error(), and RASTER_MAP::UV.

Referenced by main().

LONGMATRIX_VECTOR* get_fine_indices ( LONGMATRIX fine,
LONGMATRIX coarse,
long  i_firstcell,
long  i_lastcell,
long  novalue,
short  print 
)
Author
Emanuele Cordano
Date
April 2009
Parameters
(LONGMATRIX*)fine;
(LONGMATRIX*)coarse;
(long)i_firstcell;
(long)I_lastcells;
(long)novalue;
(short)print;
Returns
a LONGMATRIX_VECTOR which has the addresses of the

Definition at line 229 of file bigcells2.c.

References LONGMATRIX_VECTOR::element, LONGMATRIX::nch, LONGMATRIX::ncl, new_longmatrix(), new_longmatrix_vector(), LONGMATRIX_VECTOR::nh, LONGMATRIX_VECTOR::nl, LONGMATRIX::nrh, LONGMATRIX::nrl, and t_error().

Referenced by get_doublesquare_grid(), and get_fine_line_indices().

LONGBIN* get_fine_line_indices ( LONGMATRIX h_fine,
LONGMATRIX h_coarse,
LONGMATRIX v_fine,
LONGMATRIX v_coarse,
long  n_horizontal,
long  n_lines,
long  novalue,
short  print 
)
SQUARE_GRID* get_square_grid ( DOUBLEMATRIX DTM,
T_INIT UV,
char *  file_resume_lines,
char *  file_resume_polygons,
char *  file_resume_connections,
long(*)(long r, long c, LONGVECTOR *s_index)  index_pixel_from_a_bin,
int(*)(double x, DOUBLEVECTOR *V)  check_novalues,
long  displacement,
short  print 
)

232: LONGMATRIX *m_indices_from_mask(DOUBLEMATRIX *mask,long row_shift,long col_shift,long novalue,long IBASE,long (*index_pixel_from_a_bin)(long r, long c,LONGVECTOR *s_index),DOUBLEVECTOR *V, int (*check_novalues)(double x, DOUBLEVECTOR *V)){

Author
Emanuele Cordano
Date
April and July 2008
Parameters
-DTM (DOUBLEMATRIX *) - reference map
-UV (T_INIT *) - T_INIT information
-(char *) - name of file_resume_lines
-(char *) - name of file_resume_polygons
-(char *) - name of file_resume_connections;
-long (*index_pixel_from_a_bin)(long r, long c,LONGVECTOR *s_index)
-int (*check_novalues)(double x, DOUBLEVECTOR *V)
displacement_index(long), displacement amang which connected polygon are searched
-print (short)
Returns
a square grid

build lines and polygons

chech the simmetry of the connections

Definition at line 44 of file bigcells2.c.

References BOUNDARY, GRID::boundary_indicator, connections_symmetry(), copy_string(), EWRES, GRID::file_resume_connections, GRID::file_resume_lines, GRID::file_resume_polygons, get_connection_array_squares(), get_linevector_from_raster_grid(), get_polygonvector_from_raster(), SQUARE_GRID::grid, index_pixel_from_a_bin(), SQUARE_GRID::indices_horizontal_lines, SQUARE_GRID::indices_pixel, SQUARE_GRID::indices_vertex, SQUARE_GRID::indices_vertical_lines, INTEGER_NULL, GRID::lines, GRID::links, m_indices_from_mask(), LONGMATRIX::ncl, LINEVECTOR::nh, POLYGONVECTOR::nh, SQUARE_GRID::nhorizontal_lines, SQUARE_GRID::novalue, LONGMATRIX::nrl, NSRES, GRID::polygons, t_error(), T_INIT::U, T_INIT::V, X_BOTTOMLEFTCORNER, and Y_BOTTOMLEFTCORNER.

Referenced by get_doublesquare_grid().

LONGMATRIX_VECTOR* new_longmatrix_vector ( long  nh)
Author
Emanuele Cordano
Date
April 2009
Parameters
nh(long) - number of elements;

Definition at line 201 of file bigcells2.c.

References LONGMATRIX_VECTOR::element, LONGMATRIX_VECTOR::nh, LONGMATRIX_VECTOR::nl, NL, NR_END, t_error(), and vector().

Referenced by get_fine_indices(), and read_fine_indices().

RASTER_MAP* new_raster_map ( long  nh)
Author
Emanuele Cordano
Date
April 2009

nh - number of layers;

and allocates a RASTER_MAP class

Definition at line 129 of file bigcells2.c.

References RASTER_MAP::check_novalues, INTEGER_NULL, RASTER_MAP::layer, RASTER_MAP::nh, NL, RASTER_MAP::nl, no_value_function(), NR_END, RASTER_MAP::reference_index_map, t_error(), and RASTER_MAP::UV.

Referenced by get_doubleraster_map().

char* strcpy2 ( char *  dest,
const char *  src 
)

proof utilities

Definition at line 692 of file bigcells2.c.

int write_longmatrix_vector ( LONGMATRIX_VECTOR lmv,
char *  filename 
)

write functions

Parameters
(LONGMATRIX_VECTOR*) lmv
(char*) filename
Author
Emanuele Cordano
Date
April 2009

Definition at line 482 of file bigcells2.c.

References LONGMATRIX_VECTOR::element, MAX_COL, LONGMATRIX::nch, LONGMATRIX_VECTOR::nh, LONGMATRIX_VECTOR::nl, LONGMATRIX::nrh, t_fclose(), t_fopen(), and write_longmatrix_elements().

Referenced by write_doublesquare_grid().