utils.h File Reference

Author: Igor Terentyev. More...

#include "cstd.h"
#include "usempi.h"

Go to the source code of this file.

Classes

struct  s_SIZEDSTRING
 String with size. More...

Defines

#define inline
#define restrict
#define DT_CSTRING   1
#define DT_CHAR   2
#define DT_SHORT   3
#define DT_INT   4
#define DT_LONG   5
#define DT_FLOAT   6
#define DT_DOUBLE   7
#define DT_USHORT   9
#define DT_UINT   10
#define DT_ULONG   11
#define DT_REAL   DT_FLOAT
 Real type and consts.
#define ireal   float
 ** real type >
#define REAL_NAN   0.0f
#define REAL_ZERO   0.0f
#define REAL_ONE   1.0f
#define REAL_EPS   FLT_EPSILON
#define REAL_MIN   FLT_MIN
#define REAL_MAX   FLT_MAX
#define IWAVE_MPI_REAL   MPI_FLOAT
#define RDOM_MAX_NARR   30
 Maximum number of arrays in any domain.
#define RARR_MAX_NDIM   7
 Maximum number of dimensions in any array.
#define IWAVE_NDIM   3
#define IWAVE_3NDIM   27
#define IWAVE_NNEI   (IWAVE_3NDIM - 1)
#define IX   0
#define IY   1
#define IZ   2
#define RARR_DUMP_POINTERS   0
#define IARR_MAX_NDIM   7
#define RARR_MAX_3NDIM   2187
#define _IPNT   IPNT
#define _RPNT   RPNT
#define CHECK_BOUNDS
#define PS_SEP   '='
#define PS_QUO   '"'
#define iwave_min(a, b)   ((a) < (b) ? (a) : (b))
#define iwave_max(a, b)   ((a) > (b) ? (a) : (b))
#define iwave_abs(a)   ((a) < REAL_ZERO ? (-a) : (a))
#define E_SUCCESS   0
 no error
#define E_INTERNAL   1000
 internal error, should not happen
#define E_OTHER   2000
 some other error
#define E_ALLOC   1
 cannot (re/m/c)alloc, etc
#define E_BADINPUT   2
 incorrect input data
#define E_OUTOFBOUNDS   3
 if array bound check failed
#define E_BADINDEX   4
 wrong index
#define E_BADARRINDEX   5
 wrong array index in the domain
#define E_BADDIMINDEX   6
 wrong dimension index in the array
#define E_FILE   7
 problem with file operations
#define E_FILEOPEN   8
 problem opening file
#define E_MPI   9
 mpi function returned error code
#define E_DOMAINDECOMP   10
 could not do domain decomposition
#define E_PARSE   11
 problem with parsing parameter file
#define E_PARSENONAME   12
 name not found
#define E_PARSENOVALUE   13
 value not found
#define E_PARSECONVERT   14
 cannot convert
#define E_ALREADYALLOC   15
 allocating already allocated array
#define E_RANGE   -2
 out of range
#define E_OVERFLOW   -3
 out of range - overflow
#define E_UNDERFLOW   -4
 out of range - underflow
#define E_NOTIMESTEP   -100
 no time step needed for array
#define E_NOTINGRID   -200
 process with these indices not in domain decomposition grid
#define SEAMX_BIG_ENDIAN   0
#define SEAMX_LITTLE_ENDIAN   1

Typedefs

typedef int IPNT [IARR_MAX_NDIM]
typedef ireal RPNT [RARR_MAX_NDIM]
typedef s_SIZEDSTRING SIZEDSTRING
 String with size.

Functions

int * IASN (IPNT l, const IPNT r)
 Assignment of IPNT r to IPNT l.
ireal * RASN (RPNT l, const RPNT r)
 Assignment of RPNT r to RPNT l.
void * usermalloc_ (size_t size)
 Modified malloc/free functions.
void userfree_ (void *ptr)
int gen_3n1 (int ndim, int *n)
int gen_i2pnt (int ndim, int i, IPNT p)
int gen_pnt2i (int ndim, const IPNT p, int *i)
void storeRank (int rk)
int retrieveRank ()
void storeSize (int sz)
int retrieveSize ()
void storeComm (MPI_Comm cm)
MPI_Comm retrieveComm ()
void storeOutstream (FILE *stream)
FILE * retrieveOutstream ()
void storeGlobalRank (int rk)
int retrieveGlobalRank ()
void storeGlobalSize (int sz)
int retrieveGlobalSize ()
void storeGlobalComm (MPI_Comm cm)
MPI_Comm retrieveGlobalComm ()
void storeThreadSupp (int ts)
int retrieveThreadSupp ()
void storeGroupID (int)
int retrieveGroupID ()
void storeNumGroups (int)
int retrieveNumGroups ()
void storeRemComm (MPI_Comm cm)
MPI_Comm retrieveRemComm ()
int getMachineEndianness ()
void swapBytes (unsigned char *arr, int arrsize, int atomsize)
int getBoundaryFlags (IPNT lbc, IPNT rbc, int dim)


Detailed Description

Author: Igor Terentyev.

Utilities:

Constants. Data type [ireal]. Data type flags. Point arrays. Aligned malloc. Separator, delimiter for parser. All error codes.

Definition in file utils.h.


Define Documentation

#define inline

Definition at line 28 of file utils.h.

#define restrict

Definition at line 34 of file utils.h.

#define DT_CSTRING   1

Definition at line 40 of file utils.h.

#define DT_CHAR   2

Definition at line 41 of file utils.h.

#define DT_SHORT   3

Definition at line 42 of file utils.h.

#define DT_INT   4

Definition at line 43 of file utils.h.

#define DT_LONG   5

Definition at line 44 of file utils.h.

#define DT_FLOAT   6

Definition at line 45 of file utils.h.

#define DT_DOUBLE   7

Definition at line 46 of file utils.h.

#define DT_USHORT   9

Definition at line 47 of file utils.h.

#define DT_UINT   10

Definition at line 48 of file utils.h.

#define DT_ULONG   11

Definition at line 49 of file utils.h.

#define DT_REAL   DT_FLOAT

Real type and consts.

Definition at line 55 of file utils.h.

#define ireal   float

** real type >

Definition at line 69 of file utils.h.

#define REAL_NAN   0.0f

Definition at line 71 of file utils.h.

#define REAL_ZERO   0.0f

Definition at line 72 of file utils.h.

#define REAL_ONE   1.0f

Definition at line 73 of file utils.h.

#define REAL_EPS   FLT_EPSILON

Definition at line 74 of file utils.h.

#define REAL_MIN   FLT_MIN

Definition at line 75 of file utils.h.

#define REAL_MAX   FLT_MAX

Definition at line 76 of file utils.h.

#define IWAVE_MPI_REAL   MPI_FLOAT

Definition at line 77 of file utils.h.

#define RDOM_MAX_NARR   30

Maximum number of arrays in any domain.

Definition at line 86 of file utils.h.

#define RARR_MAX_NDIM   7

Maximum number of dimensions in any array.

If set > 3, note that RARR_MAX_3NDIM (below) will require redefinition.

Definition at line 92 of file utils.h.

#define IWAVE_NDIM   3

Definition at line 100 of file utils.h.

#define IWAVE_3NDIM   27

Definition at line 116 of file utils.h.

#define IWAVE_NNEI   (IWAVE_3NDIM - 1)

Definition at line 121 of file utils.h.

#define IX   0

Definition at line 130 of file utils.h.

#define IY   1

Definition at line 131 of file utils.h.

#define IZ   2

Definition at line 132 of file utils.h.

#define RARR_DUMP_POINTERS   0

Definition at line 138 of file utils.h.

#define IARR_MAX_NDIM   7

IPNT

Integer arrays of at least space dimension - index into grid

Definition at line 144 of file utils.h.

#define RARR_MAX_3NDIM   2187

Definition at line 197 of file utils.h.

#define _IPNT   IPNT

Definition at line 210 of file utils.h.

#define _RPNT   RPNT

Definition at line 211 of file utils.h.

#define CHECK_BOUNDS

Definition at line 217 of file utils.h.

#define PS_SEP   '='

Definition at line 237 of file utils.h.

#define PS_QUO   '"'

Definition at line 238 of file utils.h.

#define iwave_min ( a,
 )     ((a) < (b) ? (a) : (b))

Definition at line 255 of file utils.h.

#define iwave_max ( a,
 )     ((a) > (b) ? (a) : (b))

Definition at line 256 of file utils.h.

#define iwave_abs (  )     ((a) < REAL_ZERO ? (-a) : (a))

Definition at line 257 of file utils.h.

#define SEAMX_BIG_ENDIAN   0

Definition at line 356 of file utils.h.

#define SEAMX_LITTLE_ENDIAN   1

Definition at line 357 of file utils.h.


Typedef Documentation

typedef int IPNT[IARR_MAX_NDIM]

Definition at line 149 of file utils.h.

typedef ireal RPNT[RARR_MAX_NDIM]

RPNT

Real arrays of space dimension - grid coordinates, vector field values.

Definition at line 154 of file utils.h.

typedef struct s_SIZEDSTRING SIZEDSTRING

String with size.

Has size n (0,...,n-1) and extra terminating null character at n-th position. May have null characters in the middle.

long n : string length (not including null terminator). char *s : string pointer (has additional null terminator).


Function Documentation

int* IASN ( IPNT  l,
const IPNT  r 
)

Assignment of IPNT r to IPNT l.

ireal* RASN ( RPNT  l,
const RPNT  r 
)

Assignment of RPNT r to RPNT l.

void* usermalloc_ ( size_t  size  ) 

Modified malloc/free functions.

Currently implemented as 16 byte aligned pointers. TO CHANGE BY USER in utils.c.

size_t size : size in bytes. void * return/ptr : pointer to the allocated memory. >

void userfree_ ( void *  ptr  ) 

int gen_3n1 ( int  ndim,
int *  n 
)

int gen_i2pnt ( int  ndim,
int  i,
IPNT  p 
)

int gen_pnt2i ( int  ndim,
const IPNT  p,
int *  i 
)

void storeRank ( int  rk  ) 

int retrieveRank (  ) 

void storeSize ( int  sz  ) 

int retrieveSize (  ) 

void storeComm ( MPI_Comm  cm  ) 

MPI_Comm retrieveComm (  ) 

void storeOutstream ( FILE *  stream  ) 

FILE* retrieveOutstream (  ) 

void storeGlobalRank ( int  rk  ) 

int retrieveGlobalRank (  ) 

void storeGlobalSize ( int  sz  ) 

int retrieveGlobalSize (  ) 

void storeGlobalComm ( MPI_Comm  cm  ) 

MPI_Comm retrieveGlobalComm (  ) 

void storeThreadSupp ( int  ts  ) 

int retrieveThreadSupp (  ) 

void storeGroupID ( int   ) 

int retrieveGroupID (  ) 

void storeNumGroups ( int   ) 

int retrieveNumGroups (  ) 

void storeRemComm ( MPI_Comm  cm  ) 

MPI_Comm retrieveRemComm (  ) 

int getMachineEndianness (  ) 

void swapBytes ( unsigned char *  arr,
int  arrsize,
int  atomsize 
)

int getBoundaryFlags ( IPNT  lbc,
IPNT  rbc,
int  dim 
)


Generated on 5 Jan 2017 for IWAVEBASE by  doxygen 1.4.7