PLUTO
|
Provide basic functionality for reading input data files. More...
#include "pluto.h"
Go to the source code of this file.
Macros | |
#define | ID_MAX_NVAR 256 |
Functions | |
void | InputDataSet (char *grid_fname, int *get_var) |
void | InputDataRead (char *data_fname, char *endianity) |
void | InputDataInterpolate (double *vs, double x1, double x2, double x3) |
void | InputDataFree (void) |
Variables | |
static int | id_nvar |
Number of variables to be read on input. More... | |
static int | id_var_indx [ID_MAX_NVAR] |
The variable index. More... | |
static int | id_nx1 |
Size of input grid in the x1 direction. More... | |
static int | id_nx2 |
Size of input grid in the x2 direction. More... | |
static int | id_nx3 |
Size of input grid in the x3 direction. More... | |
static int | id_geom |
Geometry of the input grid. More... | |
static double * | id_x1 |
Array of point coordinates of the x1 input grid. More... | |
static double * | id_x2 |
Array of point coordinates of the x2 input grid. More... | |
static double * | id_x3 |
Array of point coordinates of the x3 input grid. More... | |
static double *** | Vin [ID_MAX_NVAR] |
An array of 3D data values containing the initial data file variables. More... | |
Provide basic functionality for reading input data files.
Collects a number of functions for opening, reading and assigning initial conditions from user-supplied data file(s). The geometry and dimensions of the input grid can be different from the actual grid employed by PLUTO, as long as the coordinate geometry transformation has been implemented. The input grid and data files should employ the same format and conventions employed by PLUTO.
Datafile: variables should be written in sequence in a single binary file using single or double precision. The file extension must be ".flt" or ".dbl" for the former and the latter, respectively.
Note that not all of the variables should be present and the input array ::get_var specifies which ones are to be searched for.
The InputDataSet() initialize the module and by assigning values to global variables such as size, geometry and dimensions of the input grid. Data values are read through the function InputDataRead() while InputDataInterpolate() can be finally used to map input data onto the grid employed by PLUTO using bi- or tri-linear interpolation to fill the data array at the desired coordinate location.
Definition in file input_data.c.
#define ID_MAX_NVAR 256 |
Definition at line 36 of file input_data.c.
void InputDataFree | ( | void | ) |
Free memory stored by user-supplied data.
Definition at line 484 of file input_data.c.
void InputDataInterpolate | ( | double * | vs, |
double | x1, | ||
double | x2, | ||
double | x3 | ||
) |
Perform bi- or tri-linear interpolation on external dataset to compute vs[] at the given point {x1,x2,x3}.
[in] | vs | interpolated value |
[in] | x1 | coordinate point at which at interpolates are desired |
[in] | x2 | coordinate point at which at interpolates are desired |
[in] | x3 | coordinate point at which at interpolates are desired |
The function performs the following tasks.
Definition at line 287 of file input_data.c.
void InputDataRead | ( | char * | data_fname, |
char * | endianity | ||
) |
Read input data file and store the contents into the local storage array Vin. Memory allocation is also done here. The grid size and number of variables must have previously set by calling InputDataSet().
[in] | data_fname | the data file name |
[in] | endianity | an input string ("little" or "big") giving the byte-order of how the input data file was originally written. If an empty string is supplied, no change is made. |
Definition at line 191 of file input_data.c.
void InputDataSet | ( | char * | grid_fname, |
int * | get_var | ||
) |
Initialize access to input data file by assigning values to grid-related information (geometry, number of points, etc...). This function should be called just once for input-data initialization.
[in] | gname | the grid file name |
[in] | get_var | an array of integers specifying which variables have to be read from the input data. |
The following tasks are performed.
Definition at line 54 of file input_data.c.
|
static |
Geometry of the input grid.
Definition at line 44 of file input_data.c.
|
static |
Number of variables to be read on input.
Definition at line 38 of file input_data.c.
|
static |
Size of input grid in the x1 direction.
Definition at line 40 of file input_data.c.
|
static |
Size of input grid in the x2 direction.
Definition at line 41 of file input_data.c.
|
static |
Size of input grid in the x3 direction.
Definition at line 42 of file input_data.c.
|
static |
The variable index.
Definition at line 39 of file input_data.c.
|
static |
Array of point coordinates of the x1 input grid.
Definition at line 46 of file input_data.c.
|
static |
Array of point coordinates of the x2 input grid.
Definition at line 47 of file input_data.c.
|
static |
Array of point coordinates of the x3 input grid.
Definition at line 48 of file input_data.c.
|
static |
An array of 3D data values containing the initial data file variables.
Definition at line 50 of file input_data.c.