#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "crusde_api.h"
Classes | |
struct | s_load_list_elem |
struct | s_load_list |
Defines | |
#define | NIL ((load_list_elem *)0) |
Typedefs | |
typedef struct s_load_list_elem | load_list_elem |
typedef struct s_load_list | load_list |
Functions | |
static load_list_elem * | add_elem (load_list *list, int x, int y, double height) |
static double | value_at (load_list *list, int x, int y) |
static void | destroy (load_list *list) |
const char * | get_name () |
const char * | get_version () |
const char * | get_authors () |
const char * | get_description () |
PluginCategory | get_category () |
void | request_plugins () |
void | register_output_fields () |
void | run () |
void | clear () |
void | init () |
Initialize members that depend on registered values. | |
void | register_parameter () |
Register parameters this load function claims from the input. | |
double | get_value_at (int x, int y, int t) |
Returns the Load of a disk at Point (x,y) at time t. | |
void | set_history_function (loadhistory_exec_function history) |
Variables | |
double * | p_rho [100] |
char ** | p_file [100] |
double | rho |
int | dS |
double | rho_dS_const |
int | nx = -1 |
int | ny = -1 |
loadhistory_exec_function | history_function [100] |
load_list * | loads [100] |
int | my_id = 0 |
Read load from a file that must be in the following format:
Lon Lat Height
with Lon and Lat being integers in Lambert coordinates and Height determining the load height at the point (Lon,Lat).\
#define NIL ((load_list_elem *)0) |
Referenced by add_elem(), destroy(), init(), and value_at().
typedef struct s_load_list load_list |
typedef struct s_load_list_elem load_list_elem |
THE LOAD --- trying to be a little memory efficient here. Instead of saving all load values from the give to a gigantic array which is mainly filled with zeros, the values go into this list.
static load_list_elem* add_elem | ( | load_list * | list, | |
int | x, | |||
int | y, | |||
double | height | |||
) | [static] |
References s_load_list::current, s_load_list::first, s_load_list_elem::height, s_load_list::last, s_load_list_elem::next, NIL, s_load_list_elem::x, and s_load_list_elem::y.
Referenced by init().
void clear | ( | ) |
frees load array that was read from file
References crusde_get_current_load_component(), destroy(), and free().
static void destroy | ( | load_list * | list | ) | [static] |
References s_load_list::first, free(), s_load_list_elem::next, and NIL.
Referenced by clear().
const char* get_authors | ( | ) |
PluginCategory get_category | ( | ) |
References LOAD_PLUGIN.
const char* get_description | ( | ) |
const char* get_name | ( | ) |
double get_value_at | ( | int | x, | |
int | y, | |||
int | t | |||
) |
Returns the Load of a disk at Point (x,y) at time t.
Computes the euclidean distance of Point (x,y) to (center_x, center_y). If this distance is less or equal to disk_radius the load will be returned, zero otherwise.
x | The x-Coordinate of the wanted value. | |
y | The y-Coordinate of the wanted value. | |
t | The time-Coordinate of the wanted value (set to NO_TIME in non-temporal modelling environment). |
References crusde_get_current_load_component(), crusde_get_gridsize(), dS, my_id, p_rho, rho, rho_dS_const, and value_at().
const char* get_version | ( | ) |
void init | ( | ) |
Initialize members that depend on registered values.
This function must not be called before register_parameter() unless none of the necessary values depends on parameters provided by the user, which are only set after they have been registered. This function is called some time after register_parameter().
References add_elem(), crusde_debug(), crusde_error(), crusde_exit(), crusde_get_current_load_component(), crusde_get_gridsize(), crusde_get_min_x(), crusde_get_min_y(), crusde_get_size_x(), crusde_get_size_y(), crusde_info(), crusde_warning(), s_load_list::current, dS, s_load_list::first, s_load_list::last, my_id, n, NIL, nx, ny, p_file, and result.
void register_output_fields | ( | ) |
empty
void register_parameter | ( | ) |
Register parameters this load function claims from the input.
This function calls register_load_param() defined in crusde_api.h to register references to parameters this Green's function will need to operate properly. In case an XML is used to configure the experiment, the reference to this parameter will be identified by the string passed as second argument to register_green_param().
This function registers the references in the following order:
References crusde_get_current_load_component(), crusde_register_param_double(), crusde_register_param_string(), get_category(), my_id, p_file, and p_rho.
void request_plugins | ( | ) |
empty
void run | ( | ) |
empty
void set_history_function | ( | loadhistory_exec_function | history | ) |
References crusde_get_current_load_component(), and history_function.
static double value_at | ( | load_list * | list, | |
int | x, | |||
int | y | |||
) | [static] |
References s_load_list::first, s_load_list_elem::height, s_load_list_elem::next, NIL, s_load_list_elem::x, and s_load_list_elem::y.
Referenced by get_value_at().
int dS |
Area around point P(x,y) [m^2]
int my_id = 0 |
char* * p_file[100] |
load definition
double* p_rho[100] |
Density of the load [kg/m^3]
double rho |
Density of the load [kg/m^3]
double rho_dS_const |
rho_dS_const = rho * dS [kg/m]