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

Go to the source code of this file.

Functions

DOUBLEMATRIXdoublemap_from_longmap (LONGMATRIX *lmap, long novalue, double dnovalue)
 
DOUBLEVECTORinterpolete_volume2lines (DOUBLEVECTOR *v, GRID *grid)
 
DOUBLEMATRIXget_doublemap_spav (LONGMATRIX *lmap, long novalue, double dnovalue, long dr, long dc, DOUBLEMATRIX *Msource)
 
DOUBLEVECTORget_doublevector_for_lines (LONGMATRIX *h_addresses, LONGMATRIX *v_addresses, DOUBLEMATRIX *mh, DOUBLEMATRIX *mv, double novalue)
 
int write_raster_from_doublevector_v2 (char *filename, DOUBLEVECTOR *v, long n0, T_INIT *UVref, LONGMATRIX *indices, DOUBLEMATRIX *Mref, short float_type, short map_format)
 
int write_line_map (char *filename, DOUBLEVECTOR *v, long n_horizontal, T_INIT *UVref, LONGMATRIX *indices_h, LONGMATRIX *indices_v, DOUBLEMATRIX *Mref_h, DOUBLEMATRIX *Mref_v, short float_type, short map_format)
 
int write_lines (char *filename, long n_lines, long n_horizontal, T_INIT *UVref, LONGMATRIX *indices_h, LONGMATRIX *indices_v, DOUBLEMATRIX *Mref_h, DOUBLEMATRIX *Mref_v, short float_type, short map_format)
 
int write_cell (char *filename, long n_cells, T_INIT *UVref, LONGMATRIX *indices, DOUBLEMATRIX *Mref, short float_type, short map_format)
 
int zeros (DOUBLEVECTOR *v)
 
int check_matrices (DOUBLEMATRIX *M1, LONGMATRIX *L1, double dnull, long lnull, short print)
 
double get_value_from_doublevector (long k, DOUBLEVECTOR *v)
 
int write_doublevector_in_a_ascii_ft_format_single_file (char *fileneme, DOUBLEVECTOR *v)
 
DOUBLEVECTORread_doublevector_from_a_ft_format_single_file (char *filename, short print)
 

Detailed Description

Author
Emanuele Cordano
Attention

This file is part of Boussinesq.

Boussinesq is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Boussinesq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Boussinesq. If not, see http://www.gnu.org/licenses/.

Definition in file b_utilities.h.

Function Documentation

int check_matrices ( DOUBLEMATRIX M1,
LONGMATRIX L1,
double  dnull,
long  lnull,
short  print 
)
Author
Emanule Cordano
Date
26 April 2009

Definition at line 392 of file b_utilities.c.

References DOUBLEMATRIX::nch, LONGMATRIX::nch, DOUBLEMATRIX::ncl, DOUBLEMATRIX::nrh, LONGMATRIX::nrh, and DOUBLEMATRIX::nrl.

DOUBLEMATRIX* doublemap_from_longmap ( LONGMATRIX lmap,
long  novalue,
double  dnovalue 
)
Author
Emanuele Cordano
Date
April 2009
Parameters
lmap- (LONGMATRIX *) - mask
novalue- (long) null value (long)
dnovalue- (double) null value (double)
Returns
DOUBLEMATRIX

Definition at line 39 of file b_utilities.c.

References LONGMATRIX::nch, LONGMATRIX::ncl, new_doublematrix(), LONGMATRIX::nrh, and LONGMATRIX::nrl.

Referenced by main().

DOUBLEMATRIX* get_doublemap_spav ( LONGMATRIX lmap,
long  novalue,
double  dnovalue,
long  dr,
long  dc,
DOUBLEMATRIX Msource 
)
Author
Emanuele Cordano
Date
17 April 2009
Parameters
lmap- (LONGMATRIX *) - mask
novalue- (long) null value (long)
dnovalue- (double) null value (double)
dr- (long) dr step at row with which function get_doublemap_spav calculates the average (-1 horizontal, 0 vertical)
dc- (long) dc step at column with which function get_doublemap_spav calculates the average (0 horizontal, -1 vertical)
Msource- (DOUBLEMATRIX *) Msources
Returns
a map whose values are taken from Msource and whose mask is taken from lmap

Definition at line 111 of file b_utilities.c.

References DOUBLEMATRIX::nch, LONGMATRIX::nch, DOUBLEMATRIX::ncl, LONGMATRIX::ncl, new_doublematrix(), DOUBLEMATRIX::nrh, LONGMATRIX::nrh, DOUBLEMATRIX::nrl, and LONGMATRIX::nrl.

DOUBLEVECTOR* get_doublevector_for_lines ( LONGMATRIX h_addresses,
LONGMATRIX v_addresses,
DOUBLEMATRIX mh,
DOUBLEMATRIX mv,
double  novalue 
)
Author
Emanuele Cordano
Date
17 April 2009

No

Parameters
n_horizontal(long) - number of horizontal lines No
n_lins(long) - number of lines
h_addresses- (LONGMATRIX *) adresses of horizotal lines;
v_addresses- (LONGMATRIX *) adresses of vertical lines;
mh- (DOUBLEMATRIX *) matrix for horizontal lines;
mv- (DOUBLEMATRIX *) matrix for vertical lines;
novalue- (double) novalue

Definition at line 165 of file b_utilities.c.

References free_doublevector(), get_doublevector_from_doublematrix(), LONGMATRIX::ncl, new_doublevector(), DOUBLEVECTOR::nh, DOUBLEVECTOR::nl, and LONGMATRIX::nrl.

double get_value_from_doublevector ( long  k,
DOUBLEVECTOR v 
)
Author
Emanuele Cordano
Date
14 October 2009
Parameters
k(long) - element requested
v(DOUBLECTOR *)
Returns
the k-th element of the vector v, an error value (-9999) in case k exceeds the size of v

Definition at line 417 of file b_utilities.c.

References DOUBLEVECTOR::nh, and DOUBLEVECTOR::nl.

Referenced by read_b_parameters_ft().

DOUBLEVECTOR* interpolete_volume2lines ( DOUBLEVECTOR v,
GRID grid 
)

!

Author
Emanuele Cordano
Date
April 2009
Parameters
v- (DOUBLEVECTOR *) - vector of the quantiatyies related to the polygons
Returns
a vector of quantity v referred and intarpolated in the lines between two polygons

Definition at line 69 of file b_utilities.c.

References GRID::boundary_indicator, polygon_connection_attributes::connections, D_INIT_VALUE, POLYGON::edge_indices, POLYGONVECTOR::element, polygon_connection_attribute_array::element, GRID::lines, GRID::links, new_doublevector(), LINEVECTOR::nh, POLYGONVECTOR::nh, DOUBLEVECTOR::nh, LONGVECTOR::nl, DOUBLEVECTOR::nl, and GRID::polygons.

Referenced by main().

DOUBLEVECTOR* read_doublevector_from_a_ft_format_single_file ( char *  filename,
short  print 
)
Author
Emanuele Cordano
Date
18 March 2010

Definition at line 467 of file b_utilities.c.

References read_doublearray(), and read_index().

Referenced by main().

int write_cell ( char *  filename,
long  n_cells,
T_INIT UVref,
LONGMATRIX indices,
DOUBLEMATRIX Mref,
short  float_type,
short  map_format 
)
Author
Emanuele Cordano
Date
April 2008
Parameters
filename(char *) name of the file
ncells- (long) number of cells
UVref- (T_INIT *) T_IIT struct containg ewres and nwres information
indices(LONGVECTOR *) - matrix of indices
Mref- (DOUBLEMATRIX *) - reference raster
float_type- float type for printed values (floating = 0, recommended)
map_format- map asccii format (FLUIDTURLE, GRASSASCI or ESRIASCII) (GRASSASCI=2 recommended)

Definition at line 352 of file b_utilities.c.

References free_doublevector(), new_doublevector(), DOUBLEVECTOR::nl, and write_raster_from_doublevector_v2().

Referenced by main().

int write_doublevector_in_a_ascii_ft_format_single_file ( char *  fileneme,
DOUBLEVECTOR v 
)

Definition at line 440 of file b_utilities.c.

References DOUBLEVECTOR::nh, DOUBLEVECTOR::nl, t_fclose(), and t_fopen().

Referenced by write_map_results().

int write_line_map ( char *  filename,
DOUBLEVECTOR v,
long  n_horizontal,
T_INIT UVref,
LONGMATRIX indices_h,
LONGMATRIX indices_v,
DOUBLEMATRIX Mref_h,
DOUBLEMATRIX Mref_v,
short  float_type,
short  map_format 
)
Author
Emanuele Cordano
Date
March 2009
Parameters
filename(char *) name of the file
v- (DOUBLECTOR *) - vector to be mapped
nhorizontal- (long) - number of horizontal lines
UVref- (T_INIT *) T_IIT struct containg ewres and nwres information
indices_h(LONGVECTOR *) - matrix of indices for horizontal lines
indices_v(LONGVECTOR *) - matrix of indices for vertical lines
Mref_h- (DOUBLEMATRIX *) - reference raster for horizotal lines
Mref_v- (DOUBLEMATRIX *) - reference raster for vertical lines
float_type- float type for printed values (floating = 0, recommended)
map_format- map asccii format (FLUIDTURLE, GRASSASCI or ESRIASCII) (GRASSASCI=2 recommended)

Definition at line 267 of file b_utilities.c.

References free_doublevector(), join_strings(), new_doublevector(), DOUBLEVECTOR::nh, DOUBLEVECTOR::nl, and write_raster_from_doublevector_v2().

Referenced by write_lines().

int write_lines ( char *  filename,
long  n_lines,
long  n_horizontal,
T_INIT UVref,
LONGMATRIX indices_h,
LONGMATRIX indices_v,
DOUBLEMATRIX Mref_h,
DOUBLEMATRIX Mref_v,
short  float_type,
short  map_format 
)
Author
Emanuele Cordano
Date
April 2009
Parameters
filename(char *) name of the file
n_lines- (long) - number of lines
nhorizontal- (long) - number of horizontal lines
UVref- (T_INIT *) T_IIT struct containg ewres and nwres information
indices_h(LONGVECTOR *) - matrix of indices for horizontal lines
indices_v(LONGVECTOR *) - matrix of indices for vertical lines
Mref_h- (DOUBLEMATRIX *) - reference raster for horizotal lines
Mref_v- (DOUBLEMATRIX *) - reference raster for vertical lines
float_type- float type for printed values (floating = 0, recommended)
map_format- map asccii format (FLUIDTURLE, GRASSASCI or ESRIASCII) (GRASSASCI=2 recommended)

write the addresse map for lines

Definition at line 319 of file b_utilities.c.

References free_doublevector(), new_doublevector(), DOUBLEVECTOR::nl, and write_line_map().

Referenced by main().

int write_raster_from_doublevector_v2 ( char *  filename,
DOUBLEVECTOR v,
long  n0,
T_INIT UVref,
LONGMATRIX indices,
DOUBLEMATRIX Mref,
short  float_type,
short  map_format 
)
Author
Emanuele Cordano
Date
March 2009
Parameters
filename(char *) name of the file
v- (DOUBLECTOR *) - vector to be mapped
n0- (long) starting point of v (i-th element of v is put in the pixels whose index (in indices matrix) is i+n0)
UVref- (T_INIT *) T_IIT struct containg ewres and nwres information
indices(LONGVECTOR *) - matrix of indices
Mref- (DOUBLEMATRIX *) - reference raster
float_type- float type for printed values (floating = 0, recommended)
map_format- map asccii format (FLUIDTURLE, GRASSASCI or ESRIASCII) (GRASSASCI=2 recommended)

it writes a map from a vector using get_doublematrix_from_doublevecto and write_map

Definition at line 224 of file b_utilities.c.

References free_doublematrix(), get_doublematrix_from_doublevector(), LONGMATRIX::ncl, LONGMATRIX::nrl, T_INIT::V, and write_map().

Referenced by write_cell(), and write_line_map().

int zeros ( DOUBLEVECTOR v)
Author
Emanuele Cordanp
Date
19 April 2009

Definition at line 378 of file b_utilities.c.

References DOUBLEVECTOR::nl.