#include "utils.h"
#include "rarray.h"
Go to the source code of this file.
Classes | |
struct | RDOM |
Domain type. More... | |
Functions | |
int | rd_a_setnull (RDOM *dom) |
Set domain (all fields) to zeros. | |
int | rd_setnull (RDOM *dom, int iarr) |
Set all fields in the specified array of the domain to zeros. | |
int | rd_a_create_s (RDOM *dom, int narr, IPNT dgs[], IPNT dn[]) |
Create all arrays in a domain (given start indices (dgs) and sizes (dn)). | |
int | rd_a_create_e (RDOM *dom, int narr, IPNT dge[], IPNT dn[]) |
Create all arrays in a domain (given end indices (dge) and sizes (dn)). | |
int | rd_a_create (RDOM *dom, int narr, IPNT dgs[], IPNT dge[]) |
Create all arrays in a domain (given start indices (dgs) and end indices (dge)). | |
int | rd_create_s (RDOM *dom, IPNT gs, IPNT n) |
Create next array in a domain (given start indices (gs) and sizes (n) of the next array). | |
int | rd_create_e (RDOM *dom, IPNT ge, IPNT n) |
Create next array in a domain (given end indices (ge) and sizes (n) of the next array). | |
int | rd_create (RDOM *dom, IPNT gs, IPNT ge) |
Create next array in a domain (given start indices (gs) and end indices (ge) of the next array). | |
int | rd_a_declare_s (RDOM *dom, int narr, IPNT dgs[], IPNT dn[]) |
Declare all arrays in a domain (given dgs and dn). | |
int | rd_a_declare_e (RDOM *dom, int narr, IPNT dge[], IPNT dn[]) |
Declare all arrays in a domain (given dge and dn). | |
int | rd_a_declare (RDOM *dom, int narr, IPNT dgs[], IPNT dge[]) |
Declare all arrays in a domain (given dgs and dge). | |
int | rd_declare_s (RDOM *dom, IPNT gs, IPNT n) |
Declare the next array in a domain (given gs and n). | |
int | rd_declare_e (RDOM *dom, IPNT ge, IPNT n) |
Declare the next array in a domain (given ge and n). | |
int | rd_declare (RDOM *dom, IPNT gs, IPNT ge) |
Declare the next array in a domain (given gs and ge). | |
int | rd_a_allocate (RDOM *dom) |
Allocate memory for all arrays in a domain. | |
int | rd_allocate (RDOM *dom, int iarr) |
Allocate memory for a specified array in a domain. | |
int | rd_a_destroy (RDOM *dom) |
Destroy domain (STORAGE DEALLOCATION). | |
int | rd_a_greset (RDOM *dom, IPNT dgs[], IPNT dge[]) |
Reset all the working (computational virtual) arrays in a domain (given dgs and dge) (NO STORAGE ALLOCATION). | |
int | rd_greset_s (RDOM *dom, int iarr, IPNT gs, IPNT n) |
Reset a specified working (computational virtual) arrays in a domain (given gs and n) (NO STORAGE ALLOCATION). | |
int | rd_greset_e (RDOM *dom, int iarr, IPNT ge, IPNT n) |
Reset a specified working (computational virtual) arrays in a domain (given ge and n) (NO STORAGE ALLOCATION). | |
int | rd_greset (RDOM *dom, int iarr, IPNT gs, IPNT ge) |
Reset a specified working (computational virtual) arrays in a domain (given gs and ge) (NO STORAGE ALLOCATION). | |
int | rd_offset_s (RDOM *dom, int iarr, IPNT os, IPNT n) |
Reset a specified working (computational virtual) array in a domain (given os and n) (NO STORAGE ALLOCATION). | |
int | rd_offset_e (RDOM *dom, int iarr, IPNT oe, IPNT n) |
Reset a specified working (computational virtual) array in a domain (given oe and n) (NO STORAGE ALLOCATION). | |
int | rd_offset (RDOM *dom, int iarr, IPNT os, IPNT oe) |
Reset a specified working (computational virtual) array in a domain (given os and oe) (NO STORAGE ALLOCATION). | |
int | rd_a_dump (const RDOM *dom, FILE *stream) |
Dump information of all arrays in a domain. | |
int | rd_dump (const RDOM *dom, int iarr, FILE *stream) |
Dump information of a specified arrays in a domain. | |
int | rd_a_print (RDOM *dom, FILE *stream) |
Output all the working (computational virtual) arrays in a domain to a stream. | |
int | rd_a_fprint (RDOM *dom, const char *path) |
Output all the working (computational virtual) arrays in a domain to a file. | |
int | rd_a_fsprint (RDOM *dom, const char *path) |
Output each the working (computational virtual) array in a domain to a corresponding file. | |
int | rd_print (RDOM *dom, int iarr, FILE *stream) |
Output a specified working (computational virtual) array in a domain to a stream. | |
int | rd_fprint (RDOM *dom, int iarr, const char *path) |
Output a specified working (computational virtual) arrays in a domain to a file. | |
int | rd_write (RDOM *dom, int iarr, FILE *stream) |
Output a specified working (computational virtual) array in a domain to a stream. | |
int | rd_fwrite (RDOM *dom, int iarr, const char *path) |
Output a specified working (computational virtual) array in a domain to a file. | |
int | rd_printslice (RDOM *dom, int iarr, FILE *stream, int idim, int islice) |
Output a slice of a specified working (computational virtual) array in a domain to a stream. | |
int | rd_fprintslice (RDOM *dom, int iarr, const char *path, int idim, int islice) |
Output a slice of a specified working (computational virtual) array in a domain to a stream. | |
int | rd_writeslice (RDOM *dom, int iarr, FILE *stream, int idim, int islice) |
Output a slice of a specified working (computational virtual) array in a domain to a binary stream. | |
int | rd_fwriteslice (RDOM *dom, int iarr, const char *path, int idim, int islice) |
Output a slice of a specified working (computational virtual) array in a domain to a binary file. | |
ireal | rd_get (const RDOM *dom, int iarr, IPNT li) |
Get value at a local index relative to gs in a specified working (computational virtual) array. | |
ireal | rd_gget (const RDOM *dom, int iarr, IPNT gi) |
Get value at a global index in a specified working (computational virtual) array. | |
void | rd_set (RDOM *dom, int iarr, IPNT li, ireal r) |
Set value at a local index relative to gs in a specified working (computational virtual) array. | |
void | rd_gset (RDOM *dom, int iarr, IPNT gi, ireal r) |
Set value at a global index in a specified working (computational virtual) array. | |
int | rd_size (RDOM *dom, int iarr, IPNT n) |
Get size of a specified working (computational virtual) array in a domain. | |
int | rd_a_size (RDOM *dom, int iarr, IPNT n) |
Get size of a specified allocated array in a domain. | |
int | rd_gse (const RDOM *dom, int iarr, IPNT gs, IPNT ge) |
Get the start and end indices of a specified working (computational virtual) array in a domain. | |
int | rd_a_gse (const RDOM *dom, int iarr, IPNT gs, IPNT ge) |
Get the start and end indices of a specified allocated array in a domain. | |
int | rd_ndim (const RDOM *dom, int iarr, int *ndim) |
Get number of dimensions of a specified array. | |
int | rd_a_narr (const RDOM *dom, int *narr) |
Get number of arrays in a domain. | |
int | rd_setempty (RDOM *dom, int iarr) |
Set a specified working (computational virtual) array in a domain empty. | |
int | rd_empty (RDOM *dom, int iarr, int *empty) |
empty query for a specified array in a domain. | |
int | rd_setexchangeinfo (RDOM *dom, int iarr, EXCHANGEINFO *einfo) |
Populates exchange info for a specified array in a domain. | |
int | rd_overlap (RDOM *dom1, int iarr1, RDOM *dom2, int iarr2, int *overlap) |
Checks if two specified working (computational virtual) arrays in two domains overlap. | |
int | rd_setoverlap (RDOM *dom1, int iarr1, RDOM *dom2, int iarr2) |
Set the first working (computational virtual) array's dimension info in dom1 to be that of the overlap part of the two working (computational virtual) arrays in dom1 and dom2. | |
int | rd_a_inner (RDOM const *dom1, RDOM const *dom2, ireal *ip) |
int | rd_a_zero (RDOM *dom) |
int | rd_a_scale (RDOM *dom, int iarr, ireal fac) |
Replicates array functions and has additional group operations.
Definition in file rdomain.h.
int rd_a_setnull | ( | RDOM * | dom | ) |
int rd_setnull | ( | RDOM * | dom, | |
int | iarr | |||
) |
Set all fields in the specified array of the domain to zeros.
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
Create all arrays in a domain (given start indices (dgs) and sizes (dn)).
[out] | dom | - (RDOM *) domain pointer |
[in] | narr | - (int) number of arrays |
[in] | dgs | - (IPNT []) an IPNT vector storing the global start indices for every array |
[in] | dn | - (IPNT []) an IPNT vector storing the sizes for every array |
Create all arrays in a domain (given end indices (dge) and sizes (dn)).
[out] | dom | - (RDOM *) domain pointer |
[in] | narr | - (int) number of arrays |
[in] | dge | - (IPNT []) an IPNT vector storing the global end indices for every array |
[in] | dn | - (IPNT []) an IPNT vector storing the sizes for every array |
Create all arrays in a domain (given start indices (dgs) and end indices (dge)).
[out] | dom | - (RDOM *) domain pointer |
[in] | narr | - (int) number of arrays |
[in] | dgs | - (IPNT []) an IPNT vector storing the global start indices for every array |
[in] | dge | - (IPNT []) an IPNT vector storing the global end indices for every array |
Create next array in a domain (given start indices (gs) and sizes (n) of the next array).
[out] | dom | - (RDOM *) domain pointer |
[in] | gs | - (IPNT) the global start indices for the next array |
[in] | n | - (IPNT) sizes of the next array in this domain |
Create next array in a domain (given end indices (ge) and sizes (n) of the next array).
[out] | dom | - (RDOM *) domain pointer |
[in] | ge | - (IPNT) the global end indices for the next array |
[in] | n | - (IPNT) sizes of the next array in this domain |
Create next array in a domain (given start indices (gs) and end indices (ge) of the next array).
[out] | dom | - (RDOM *) domain pointer |
[in] | gs | - (IPNT) the global start indices for the next array |
[in] | ge | - (IPNT) the global end indices for the next array |
Declare all arrays in a domain (given dgs and dn).
Works like create, but does not allocate memory.
[out] | dom | - (RDOM *) domain pointer |
[in] | narr | - (int) number of arrays |
[in] | dgs | - (IPNT []) an IPNT vector storing the global start indices for every array |
[in] | dn | - (IPNT []) an IPNT vector storing the sizes for every array |
Declare all arrays in a domain (given dge and dn).
Works like create, but does not allocate memory.
[out] | dom | - (RDOM *) domain pointer |
[in] | narr | - (int) number of arrays |
[in] | dge | - (IPNT []) an IPNT vector storing the global end indices for every array |
[in] | dn | - (IPNT []) an IPNT vector storing the sizes for every array |
Declare all arrays in a domain (given dgs and dge).
Works like create, but does not allocate memory.
[out] | dom | - (RDOM *) domain pointer |
[in] | narr | - (int) number of arrays |
[in] | dgs | - (IPNT []) an IPNT vector storing the global start indices for every array |
[in] | dge | - (IPNT []) an IPNT vector storing the global end indices for every array |
Declare the next array in a domain (given gs and n).
Works like create, but does not allocate memory.
[out] | dom | - (RDOM *) domain pointer |
[in] | gs | - (IPNT) the global start indices for the next array |
[in] | n | - (IPNT) sizes of the next array in this domain |
Declare the next array in a domain (given ge and n).
Works like create, but does not allocate memory.
[out] | dom | - (RDOM *) domain pointer |
[in] | ge | - (IPNT) the global end indices for the next array |
[in] | n | - (IPNT) sizes of the next array in this domain |
Declare the next array in a domain (given gs and ge).
Works like create, but does not allocate memory.
[out] | dom | - (RDOM *) domain pointer |
[in] | gs | - (IPNT) the global start indices for the next array |
[in] | ge | - (IPNT) the global end indices for the next array |
int rd_a_allocate | ( | RDOM * | dom | ) |
Allocate memory for all arrays in a domain.
[out] | dom | - (RDOM *) domain pointer |
int rd_allocate | ( | RDOM * | dom, | |
int | iarr | |||
) |
Allocate memory for a specified array in a domain.
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
int rd_a_destroy | ( | RDOM * | dom | ) |
Destroy domain (STORAGE DEALLOCATION).
Reset all the working (computational virtual) arrays in a domain (given dgs and dge) (NO STORAGE ALLOCATION).
[out] | dom | - (RDOM *) domain pointer |
[in] | dgs | - (IPNT []) an IPNT vector storing the global start indices for every working (computational virtual) array |
[in] | dge | - (IPNT []) an IPNT vector storing the global end indices for every working (computational virtual) array * |
Reset a specified working (computational virtual) arrays in a domain (given gs and n) (NO STORAGE ALLOCATION).
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | gs | - (IPNT) the global start indices for the next array |
[in] | n | - (IPNT) sizes of the next array in this domain |
Reset a specified working (computational virtual) arrays in a domain (given ge and n) (NO STORAGE ALLOCATION).
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | ge | - (IPNT) the global end indices for the next array |
[in] | (n | - (IPNT) sizes of the next array in this domain |
Reset a specified working (computational virtual) arrays in a domain (given gs and ge) (NO STORAGE ALLOCATION).
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | gs | - (IPNT) the global start indices for the next array |
[in] | ge | - (IPNT) the global end indices for the next array |
Reset a specified working (computational virtual) array in a domain (given os and n) (NO STORAGE ALLOCATION).
Refer to ra_offset_s.
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | os | - (IPNT) start index offsets (forward) of the working (computational virtual) array |
[in] | n | - (IPNT) sizes of the working (computational virtual) array |
Reset a specified working (computational virtual) array in a domain (given oe and n) (NO STORAGE ALLOCATION).
Refer to ra_offset_e.
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | oe | - (IPNT) end index offsets (backward) of the working (computational virtual) array |
[in] | n | - (IPNT) sizes of the working (computational virtual) array |
Reset a specified working (computational virtual) array in a domain (given os and oe) (NO STORAGE ALLOCATION).
Refer to ra_offset.
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | os | - (IPNT) start index offsets (forward) of the working (computational virtual) array |
[in] | oe | - (IPNT) end index offsets (backward) of the working (computational virtual) array |
int rd_a_dump | ( | const RDOM * | dom, | |
FILE * | stream | |||
) |
Dump information of all arrays in a domain.
int rd_dump | ( | const RDOM * | dom, | |
int | iarr, | |||
FILE * | stream | |||
) |
Dump information of a specified arrays in a domain.
[in] | dom | - (const RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | stream | - (FILE *) file pointer |
int rd_a_print | ( | RDOM * | dom, | |
FILE * | stream | |||
) |
Output all the working (computational virtual) arrays in a domain to a stream.
Format: formatted ASCII
[in] | dom | - (RDOM *) domain pointer |
[in] | stream | - (FILE *) file pointer |
int rd_a_fprint | ( | RDOM * | dom, | |
const char * | path | |||
) |
Output all the working (computational virtual) arrays in a domain to a file.
Format: formatted ASCII
[in] | dom | - (RDOM *) domain pointer |
[in] | path | - (const char *) file name |
int rd_a_fsprint | ( | RDOM * | dom, | |
const char * | path | |||
) |
Output each the working (computational virtual) array in a domain to a corresponding file.
the i'th array is stored in the file named 'str(path)+str(i)' Format: formatted ASCII
[in] | dom | - (RDOM *) domain pointer |
[in] | path | - (const char *) file name (general) |
int rd_print | ( | RDOM * | dom, | |
int | iarr, | |||
FILE * | stream | |||
) |
Output a specified working (computational virtual) array in a domain to a stream.
Format: formatted ASCII
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | stream | - (FILE *) file pointer |
int rd_fprint | ( | RDOM * | dom, | |
int | iarr, | |||
const char * | path | |||
) |
Output a specified working (computational virtual) arrays in a domain to a file.
Format: formatted ASCII
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | path | - (const char *) file name |
int rd_write | ( | RDOM * | dom, | |
int | iarr, | |||
FILE * | stream | |||
) |
Output a specified working (computational virtual) array in a domain to a stream.
Format: binary
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | stream | - (FILE *) file pointer |
int rd_fwrite | ( | RDOM * | dom, | |
int | iarr, | |||
const char * | path | |||
) |
Output a specified working (computational virtual) array in a domain to a file.
Format: binary
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | path | - (const char *) file name |
int rd_printslice | ( | RDOM * | dom, | |
int | iarr, | |||
FILE * | stream, | |||
int | idim, | |||
int | islice | |||
) |
Output a slice of a specified working (computational virtual) array in a domain to a stream.
check if iarr < narr. Then call ra_printslice.
int rd_fprintslice | ( | RDOM * | dom, | |
int | iarr, | |||
const char * | path, | |||
int | idim, | |||
int | islice | |||
) |
Output a slice of a specified working (computational virtual) array in a domain to a stream.
check if iarr < narr. Then call ra_fprintslice.
int rd_writeslice | ( | RDOM * | dom, | |
int | iarr, | |||
FILE * | stream, | |||
int | idim, | |||
int | islice | |||
) |
Output a slice of a specified working (computational virtual) array in a domain to a binary stream.
check if iarr < narr. Then call ra_writeslice.
int rd_fwriteslice | ( | RDOM * | dom, | |
int | iarr, | |||
const char * | path, | |||
int | idim, | |||
int | islice | |||
) |
Output a slice of a specified working (computational virtual) array in a domain to a binary file.
check if iarr < narr. Then call ra_fwriteslice.
Get value at a local index relative to gs in a specified working (computational virtual) array.
Refer to ra_get.
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | li | - (IPNT) local index relative to gs |
Get value at a global index in a specified working (computational virtual) array.
Refer to ra_gget.
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | gi | - (IPNT) global index |
Set value at a local index relative to gs in a specified working (computational virtual) array.
Refer to ra_set. [No difference with ra_gset, since gs is alway 0]
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | li | - (IPNT) local index relative to gs |
[in] | r | - (ireal) the value to be set |
Set value at a global index in a specified working (computational virtual) array.
Refer to ra_gset.
[out] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[in] | gi | - (IPNT) global index |
[in] | r | - (ireal) the value to be set |
Get size of a specified working (computational virtual) array in a domain.
Refer to ra_size.
Get size of a specified allocated array in a domain.
Refer to ra_a_size.
Get the start and end indices of a specified working (computational virtual) array in a domain.
Refer to ra_gse.
Get the start and end indices of a specified allocated array in a domain.
Refer to ra_a_gse.
int rd_ndim | ( | const RDOM * | dom, | |
int | iarr, | |||
int * | ndim | |||
) |
Get number of dimensions of a specified array.
[in] | dom | - (const RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[out] | ndim | - (int *) number of dimensions |
int rd_a_narr | ( | const RDOM * | dom, | |
int * | narr | |||
) |
Get number of arrays in a domain.
int rd_setempty | ( | RDOM * | dom, | |
int | iarr | |||
) |
Set a specified working (computational virtual) array in a domain empty.
Error arises if iarr >= narr.
int rd_empty | ( | RDOM * | dom, | |
int | iarr, | |||
int * | empty | |||
) |
empty query for a specified array in a domain.
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[out] | empty | - (int *) 0: nonempty, 1: empty |
int rd_setexchangeinfo | ( | RDOM * | dom, | |
int | iarr, | |||
EXCHANGEINFO * | einfo | |||
) |
Populates exchange info for a specified array in a domain.
Creates MPI_Datatype inside - do not forget to destroy. Refers to ra_setexchangeinfo and IMODEL::ld_r and IMODEL::ld_s.
[in] | dom | - (RDOM *) domain pointer |
[in] | iarr | - (int) array index |
[out] | einfo | - (EXCHANGEINFO *) |
Checks if two specified working (computational virtual) arrays in two domains overlap.
Refers to ra_overlap.
[in] | dom1,dom2 | - (RARR *) domain pointers |
[in] | iarr1,iarr2 | - (int) array indices |
[out] | overlap | - (int *) 0: not overlap, 1: overlap |
Set the first working (computational virtual) array's dimension info in dom1 to be that of the overlap part of the two working (computational virtual) arrays in dom1 and dom2.
Refer to ra_setoverlap.
[in,out] | dom1 | - (RDOM *) domain pointer |
[in] | dom2 | - (RDOM *) domain pointer |
[in] | iarr1,iarr2 | - (int) array indices |
int rd_a_zero | ( | RDOM * | dom | ) |