Provide basic functionality for reading input data files. More...
#include "pluto.h"
Functions | |
void | InputDataSet (char *grid_fname, int *get_var) |
void | InputDataRead (char *data_fname) |
void | InputDataInterpolate (double *vs, double x1, double x2, double x3) |
void | InputDataFree (void) |
Variables | |
static int | id_nvar |
static int | id_var_indx [256] |
static int | id_nx1 |
static int | id_nx2 |
static int | id_nx3 |
static int | id_geom |
static double * | id_x1 |
static double * | id_x2 |
static double * | id_x3 |
static double *** | Vin [256] |
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 one 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.
void InputDataFree | ( | void | ) |
Free memory stored by user-supplied data.
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.
void InputDataRead | ( | char * | data_fname | ) |
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 |
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.
|
static |
Geometry of the input grid.
|
static |
Number of variables to be read on input.
|
static |
Size of input grid in the x1 direction.
|
static |
Size of input grid in the x2 direction.
|
static |
Size of input grid in the x3 direction.
|
static |
The variable index.
|
static |
Array of point coordinates of the x1 input grid.
|
static |
Array of point coordinates of the x2 input grid.
|
static |
Array of point coordinates of the x3 input grid.
|
static |
An array of 3D data values containing the initial data file variables.