/home/serge/sources/hyantes/src/hyantes.c(3) core of hyantes

SYNOPSIS


Defines


#define POW2(a) ((a)*(a))

#define AMORTIZED_DISK(pot, dst, res, range) do{res=((pot)/(1+(dst)));}while (0)

#define SMOOTHING_FUN AMORTIZED_DISK

#define DISK(pot, dst, res, range) do{res=(pot);}while (0)

#define SMOOTHING_FUN DISK

#define GAUSSIAN(pot, dst, res, range) do{res=(pot)*(exp(-(M_PI/(4.*POW2(range)))*POW2(dst)));} while (0)

#define SMOOTHING_FUN GAUSSIAN

#define EXPONENTIAL(pot, dst, res, range) do{res=(pot)*(exp(-(2./(range))*(dst)));} while (0)

#define SMOOTHING_FUN EXPONENTIAL

#define PARETO(pot, dst, res, range) do{data_t tmp = POW2(dst); res=(pot)*(1./(1+(2/(range)*POW2(tmp))));} while (0)

#define SMOOTHING_FUN PARETO

Functions


static void do_run (hs_coord_t visu, data_t lonStep, data_t latStep, data_t range, size_t lonRange, size_t latRange, size_t nb, hs_potential_t plots[latRange][lonRange], hs_potential_t the_towns[nb], hs_config_t *configuration)
dispatch call to the right smoothing function
static hs_potential_t * hs_read_towns (FILE *fd, size_t *len, hs_config_t *config)
reads a file containing towns and parse it
void hs_display (size_t lonRange, size_t latRange, hs_potential_t pt[latRange][lonRange])
displays the matrix of processed potentials
hs_potential_t * hs_smooth (int _resoLat, int _resoLon, hs_coord_t visu, FILE *pFileReference)
performs the smoothing of target area inside visu, using potentials from pFileReference the smoothing is performed using smoothing method given by hs_set(HS_SMOOTH_FUNC, ... ) the resolution of the output matrix will be resoLat x resoLon
const char ** hs_list_smoothing (size_t *sz)
list all available smoothing methods that can be configured using hs_config
unsigned long hs_status ()
observer of the execution of the computation
hs_potential_t * hs_smooth_r (int _resoLat, int _resoLon, hs_coord_t visu, FILE *pFileReference, hs_config_t *configuration)
performs the smoothing of target area inside visu, using potentials from pFileReference and using given hs_config the smoothing is performed using smoothing method acording to the configuration given in the arguments the resolution of the output matrix will be resoLat x resoLon
hs_potential_t * hs_smoothing (int _resoLat, int _resoLon, const char *function_name, double function_param, hs_coord_t visu, FILE *pFileReference)
perform the smoothing of target area inside visu, using potentials from pFileReference the smoothing is performed using function_name smoothing method, with a radius of function_param the resolution of the output matrix will be resoLat x resoLon (obsolete function, use hs_smmoth_r instead)

Variables


char const *const func_names []
static array containg function names. each function must also be listed in func_ptrs in the same order
hs_config_t g_config = { NULL,0,0,0,500,0,0 }

Detailed Description

core of hyantes

Author:

Sebastien Martinez and Serge Guelton

Date:

2011-06-01

This file is part of hyantes.

hyantes is free software; you can redistribute it and/or modify it under the terms of the CeCILL-C License

You should have received a copy of the CeCILL-C License along with this program. If not, see <http://www.cecill.info/licences>.

Definition in file hyantes.c.

Function Documentation

void hs_display (size_tlonRange, size_tlatRange, hs_potential_tpt[latRange][lonRange])

displays the matrix of processed potentials Parameters:

lonRange the longitudinal resolution of the matrix
latRange the resolution of the matrix
pt the matrix of potential which is of size latRange by lonRange

Definition at line 180 of file hyantes.c.

const char** hs_list_smoothing (size_t *sz)

list all available smoothing methods that can be configured using hs_config Parameters:

pointer to the number of smoothing methods

Returns:

array of string constant of size *sz. Memory is still owned by hyantes

Definition at line 219 of file hyantes.c.

References func_names.

Referenced by vhs_set_r().

static hs_potential_t* hs_read_towns (FILE *fd, size_t *len, hs_config_t *config) [static]

reads a file containing towns and parse it Parameters:

fd file containg the towns
len pointer to the number of towns

Returns:

a vector of towns

Definition at line 120 of file hyantes.c.

References hs_config_t::herrno, hs_potential::lat, and hs_potential::lon.

Referenced by hs_smooth_r().

hs_potential_t* hs_smooth (int_resoLat, int_resoLon, hs_coord_tvisu, FILE *pFileReference)

performs the smoothing of target area inside visu, using potentials from pFileReference the smoothing is performed using smoothing method given by hs_set(HS_SMOOTH_FUNC, ... ) the resolution of the output matrix will be resoLat x resoLon Parameters:

_resoLat number of latitude points computed
_resoLon number of longitude points computed
visu visualization window
pFileReference file containg the data in the format latitude longitude potential latitude longitude potential ... latitude longitude potential where latitude and longitude are given in degrees

Returns:

an allocated array of size resoLat x resoLon containing a struct (lat, lon, pot) or NULL if an error occured

Definition at line 209 of file hyantes.c.

References hs_smooth_r().

hs_potential_t* hs_smooth_r (int_resoLat, int_resoLon, hs_coord_tvisu, FILE *pFileReference, hs_config_t *configuration)

performs the smoothing of target area inside visu, using potentials from pFileReference and using given hs_config the smoothing is performed using smoothing method acording to the configuration given in the arguments the resolution of the output matrix will be resoLat x resoLon Parameters:

_resoLat number of latitude points computed
_resoLon number of longitude points computed
visu visualization window
pFileReference file containg the data in the format latitude longitude potential latitude longitude potential ... latitude longitude potential where latitude and longitude are given in degrees
configuration configuration to use

Returns:

an allocated array of size resoLat x resoLon containing structs (lat, lon, pot) or NULL if an error occured

Definition at line 252 of file hyantes.c.

References do_run(), hs_config_t::herrno, hs_read_towns(), hs_coord::mLat, hs_coord::MLat, hs_coord::mLon, and hs_coord::MLon.

Referenced by hs_smooth(), and hs_smoothing().

hs_potential_t* hs_smoothing (int_resoLat, int_resoLon, const char *function_name, doublefunction_param, hs_coord_tvisu, FILE *pFileReference)

perform the smoothing of target area inside visu, using potentials from pFileReference the smoothing is performed using function_name smoothing method, with a radius of function_param the resolution of the output matrix will be resoLat x resoLon (obsolete function, use hs_smmoth_r instead) Parameters:

_resoLat number of latitude points computed
_resoLon number of longitude points computed
function_name name of a smoothing method listed by hs_list_smoothing
parameter (in kilometers) of the smoothing method
visu visualization window
file containg the data in the format latitude longitude potential latitude longitude potential ... latitude longitude potential where latitude and longitude are given in degrees

Returns:

an allocated array of size resoLat x resoLon containing structs (lat, lon, pot)

Definition at line 302 of file hyantes.c.

References hs_set_r(), HS_SMOOTH_FUNC, and hs_smooth_r().

unsigned long hs_status ()

observer of the execution of the computation Returns:

number of computed input potential points from the beginning of the computation

Definition at line 228 of file hyantes.c.

References hs_config_t::status.

Variable Documentation

char const* const func_names[]Initial value:

 {
    'disk',
    'amortized_disk',
    'gaussian',
    'exponential',
    'pareto'
}

static array containg function names. each function must also be listed in func_ptrs in the same order

Definition at line 29 of file hyantes.c.

Referenced by hs_list_smoothing(), and vhs_set_r().

Author

Generated automatically by Doxygen for Hyantes from the source code.