The set_* and get_* functions
Note
If you are not completely sure if you should use these functions or not, read this page first!
- group setget_param
-
interface set_param
Generic function for setting values to the
paramgroup of variables. Actual implementation in file: set_param.f90. The returned valueierrhas value zero on normal execution, and negative on error.Fortran:
! signature: ! function set_param( name, val ) result( ierr ) ! ! description: ! name : character(*), name of variable ! val : the value to set ! ierr : integer, negative on error, zero otherwise use d_artn_params, only: set_param integer :: ierr ierr = set_param( "nperp_limitation", [6,10,14,18,-1] )
The C-wrapper has some additional arguments:
// signature: // int set_param( const char * const name, const int rank, const int* size, const void *val ); // // description: // name : string of variable name // rank : rank of data in `val` // size : array of size `rank`, each element is size of `val` on each dimension // val : ptr to data #include artn.h double f_thr = 0.01; int ierr = set_param( "forc_thr", 0, 0, &f_thr );
-
interface get_param
Generic routine for getting the
paramgroup variables. Actual implementation in file: get_param.f90.Fortran:
! signature: ! subroutine get_param( name, val, ierr ) ! ! description: ! name : character(*), name of variable ! val : the obtained value ! ierr : integer, negative on error, zero otherwise use d_artn_params, only: get_param integer :: ierr integer, allocatable :: p_id(:) call get_param( "push_ids", p_id, ierr )
The C-wrapper:
// signature: // int get_param ( const char *name, void* val ); // // description: // name : string of variable name // val : void ptr to obtained data #include artn.h void *c_val; int ierr = get_param( "forc_thr", &c_val ); // read the double value from void * double forc_thr = *(double *) c_val;
-
interface set_param
- group setget_data
-
interface set_data
Generic function for setting values to the
datagroup of variables. Actual implementation in file: set_data.f90. The returned valueierrhas value zero on normal execution, and negative on error.Fortran:
! signature: ! function set_data( name, val ) result( ierr ) ! ! description: ! name : character(*), name of variable ! val : the value to set ! ierr : integer, negative on error, zero otherwise use d_artn_data, only: set_data integer :: ierr ierr = set_data( "natoms", 123 )
The C-wrapper has some additional arguments:
// signature: // int set_data( const char * const name, const int rank, const int* size, const void *val ); // // description: // name : string of variable name // rank : rank of data in `val` // size : array of size `rank`, each element is size of `val` on each dimension // val : ptr to data #include artn.h double eval2 = 0.8; int ierr = set_data( "eigval_min2", 0, 0, &eval2 );
-
interface get_data
Generic routine for getting the
datagroup variables. Actual implementation in file: get_data.f90.Fortran:
! signature: ! subroutine get_data( name, val, ierr ) ! ! description: ! name : character(*), name of variable ! val : the obtained value ! ierr : integer, negative on error, zero otherwise use d_artn_data, only: get_data use h_artn_precision, only: dp integer :: ierr real(DP), allocatable :: pos_sad(:,:) call get_data( "tau_sad", pos_sad, ierr )
The C-wrapper:
// signature: // int get_data( const char *name, void* val ); // // description: // name : string of variable name // val : void ptr to obtained data #include artn.h void *c_val; int ierr = get_data( "eigval_sad", &c_val ); // read the double value from void * double eval_sad = *(double *) c_val;
-
interface set_data
- group setget_runparam
-
interface set_runparam
Generic function for setting values to the
runparamgroup of variables. Actual implementation in file: set_runparam.f90. The returned valueierrhas value zero on normal execution, and negative on error.Fortran:
! signature: ! function set_runparam( name, val ) result( ierr ) ! ! description: ! name : character(*), name of variable ! val : the value to set ! ierr : integer, negative on error, zero otherwise use d_artn_params, only: set_runparam integer :: ierr ierr = set_runparam( "llanczos", .true. )
The C-wrapper has some additional arguments:
// signature: // int set_runparam( const char * const name, const int rank, const int* size, const void *val ); // // description: // name : string of variable name // rank : rank of data in `val` // size : array of size `rank`, each element is size of `val` on each dimension // val : ptr to data #include artn.h int istep = 4; int ierr = set_runparam( "istep", 0, 0, &istep );
-
interface get_runparam
Generic routine for getting the
runparamgroup variables. Actual implementation in file: get_runparam.f90.Fortran:
! signature: ! subroutine get_runparam( name, val, ierr ) ! ! description: ! name : character(*), name of variable ! val : the obtained value ! ierr : integer, negative on error, zero otherwise use d_artn_params, only: get_runparam integer :: ierr character, allocatable :: errmsg call get_runparam( "errmsg", errmsg, ierr )
The C-wrapper:
// signature: // int get_runparam ( const char *name, void* val ); // // description: // name : string of variable name // val : void ptr to obtained data #include artn.h // obtain data on current eigenvec value; the memory is allocated in pARTn // the 2D array of ARTn is reshaped into contiguous 1D array. void *c_val; int ierr = get_runparam( "eigenvec", &c_val ); // read double* value from void * double * eigvec1d = (double *) c_val; // reshape into 2D vec if needed. // get drank, dsize, use that to help in reshaping (artn_get_drank, artn_get_dsize) // NOTE: the size of C-array needs to be transposed free(c_val);
-
interface set_runparam