00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #if !defined(_AIX)
00011 #include <stdint.h>
00012 #endif
00013 #include <limits.h>
00014 #include <float.h>
00015 #include <string>
00016 #include "gcommdata_t.h"
00017
00018
00019
00020
00021 #if defined(_INT32)
00022 #define szCACHE 16
00023 #elif defined(_INT64)
00024 #define szCACHE 32
00025 #else
00026 #define szCACHE 16
00027 #endif
00028
00029 #define szCACHEMAX 128
00030 #define IS2D
00031 #define NPROCESSES_PER_NODE 4
00032
00033
00034
00035
00036
00037
00038
00039 #define GDOUBLE double
00040 #define GFLOAT float
00041 #define GQUAD long double
00042 #define GINT int
00043 #define GLONG long
00044 #define GSHORT short
00045 #define GUSHORT unsigned short
00046 #define BYTE unsigned char
00047 #define GINT4BYTE long
00048 #define GUCHAR unsigned char
00049 #define GCHAR char
00050 #define ISUB GINT
00051 #define GFPOS long long
00052 #define GIOS_MODE int
00053 #define GCHandle long
00054 #define GKEY long long
00055 #define GWORD long
00056 #define GDWORD long long
00057 #define GNODEID long long
00058 #define GCOMPID GINT
00059 #define HDFID hid_t
00060 #define HDFERR herr_t
00061 #define HDFHSIZE hsize_t
00062 #define HDFHSSIZE hssize_t
00063 #define G_NUM_ELEM_TMP 2
00064 #define PI 3.14159265358979
00065
00066
00067
00068
00069 #define GBUFF_DEF_GQUAD
00070 #define GBUFF_DEF_GSHORT
00071 #define GBUFF_DEF_GUSHORT
00072 #define GBUFF_DEF_GINT
00073 #define GBUFF_DEF_GLONG
00074 #define GBUFF_DEF_BYTE
00075 #define GBUFF_DEF_GDOUBLE
00076 #define GBUFF_DEF_BDYTYPE
00077 #define GBUFF_DEF_ELEMTYPE
00078 #define GBUFF_DEF_GKEY
00079 #if defined(_LINUX) && defined(_COMPILER_PG)
00080 # undef GBUFF_DEF_GQUAD
00081 #endif
00082
00083
00084
00085
00086
00087
00088 #if 0
00089 #define GWORD_BITSIZE (8*sizeof(GWORD))
00090 #define ONE_MASK 0xFFFFFFFFFFFFFFFF
00091 #define HI_MASK 0xFFFFFFFF00000000
00092 #define LO_MASK 0x00000000FFFFFFFF
00093 #endif
00094
00095 #if 0
00096 #define GWORD short
00097 #define GDWORD long
00098 #define GWORD_BITSIZE (8*sizeof(GWORD))
00099 #define ONE_MASK 0xFFFFFFFF
00100 #define HI_MASK 0xFFFF0000
00101 #define LO_MASK 0x0000FFFF
00102 #endif
00103
00104 #if !defined(GBASIS_TYPE_DEF)
00105 #define GBASIS_TYPE_DEF
00106 enum GBASIS_TYPE{GBASIS_GLL=0,GBASIS_GL};
00107 #endif
00108
00109
00110 typedef void* CHandle;
00111 #if !defined(G_DATATYPE_DEF)
00112 #define G_DATATYPE_DEF
00113 enum G_DATATYPE {G_GFLOAT=0,G_GDOUBLE ,G_GQUAD ,G_GINT ,G_GSHORT ,G_GUSHORT ,
00114 G_GLONG ,G_BYTE ,G_GUCHAR ,G_GWORD ,G_GDWORD ,G_GFPOS ,
00115 G_GKEY ,G_GNODEID ,G_ELEMTYPE,G_BDYTYPE};
00116 const GINT G_TYPESZ[] = {sizeof (GFLOAT),sizeof (GDOUBLE),sizeof (GQUAD),sizeof (GINT ),sizeof(GSHORT ),
00117 sizeof(GUSHORT ),sizeof (GLONG ),sizeof (BYTE),sizeof(GUCHAR),
00118 sizeof (GWORD),sizeof (GDWORD),sizeof (GFPOS),sizeof (GKEY),
00119 sizeof (GNODEID),sizeof (GINT ),sizeof (GINT )};
00120 #endif
00121
00122
00123 #if !defined(GELEM_COMP_DEFS)
00124 #define GELEM_COMP_DEFS
00125 #define GELEM_VERTEX 0
00126 #define GELEM_PARENT_EDGE 1
00127 #define GELEM_CHILD_EDGE 2
00128 #define GELEM_VVERTEX 3
00129 #define GELEM_FACE 4
00130 #endif
00131
00132
00133 #if !defined(GBOOL)
00134 #define GBOOL bool
00135 #endif
00136 #if !defined(TRUE)
00137 #define TRUE true
00138 #endif
00139 #if !defined(FALSE)
00140 #define FALSE false
00141 #endif
00142
00143
00144 #define FBAD -1.0e60
00145 #if !defined(SEHUGE)
00146
00147 # define SEHUGE 1.0e60
00148 #endif
00149 #if !defined(IHUGE)
00150 # define IHUGE INT_MAX
00151 #endif
00152 #if !defined(TINY)
00153
00154 # define TINY 1.0e-15
00155 #endif
00156 #if !defined(SFPTINY)
00157
00158 # define SFPTINY 1.0e-8
00159 #endif
00160 #define TINYTINY 1.0e-40
00161
00162
00163
00164
00165
00166 #define GFPOS_NULL ((GFPOS)(-1))
00167 #define GFPOS_NO_COORD 0
00168 #define gios GStream
00169 #define NULL_HANDLE -1
00170 #define FILE_NAME_MAX 80
00171 #define CMD_STR_MAX 80
00172 #define DELIM_MAX 4
00173 #define MAX_GDD_STRING 1024
00174 #if defined(MPI_GENERIC_DEFAULT)
00175 #define GMAX_ERROR_STRING MPI_MAX_ERROR_STRING
00176 #else
00177 #define GMAX_ERROR_STRING 1024
00178 #endif
00179 #define BITSPERBYTE 8
00180 #define MAX_OPHANDLES 1
00181 #define MAX_REFINE_LEVELS 6
00182 #define HDF_PASS 0
00183 #define MPI_PASS 0
00184 #if !defined(WORDSIZE_BITS)
00185 #if defined(_AIX)
00186 # define WORDSIZE_BITS WORD_BIT
00187 #else
00188 # define WORDSIZE_BITS __WORDSIZE
00189 #endif
00190 #endif
00191 #if !defined(WORDSIZE_BYTES)
00192 # define WORDSIZE_BYTES (WORDSIZE_BITS / BITSPERBYTE)
00193 #endif
00194
00195 #if defined(IS1D)
00196 #define GDIM 1
00197 #elif defined(IS2D)
00198 #define GDIM 2
00199 #elif defined(IS3D)
00200 #define GDIM 3
00201 #else
00202 #error "Bad Dimensionality"
00203 #endif
00204
00205
00206
00207
00208
00209 #if !defined(IO_TYPE_DEF)
00210 #define IO_TYPE_DEF
00211 enum IO_TYPE {INDEPENDENT_IO=1, COLLECTIVE_IO=2};
00212 #endif
00213
00214 #if !defined(FILE_ACCESS_DEF)
00215 #define FILE_ACCESS_DEF
00216 enum FILE_ACCESS {READ_ONLY, READ_WRITE};
00217 #endif
00218
00219 #if !defined(UTYPE_DEF)
00220 #define UTYPE_DEF
00221 union UTYPE {
00222 GUSHORT iushort;
00223 GSHORT ishort;
00224 GINT iint;
00225 GLONG ilong;
00226 GDOUBLE fdouble;
00227 GQUAD fldouble;
00228 };
00229 #endif
00230
00231
00232 #if !defined(IPOINT2DTYPE_DEF)
00233 #define IPOINT2DTYPE_DEF
00234 struct IPoint2D {
00235 GINT i1;
00236 GINT i2;
00237 };
00238 #endif
00239
00240 #if !defined(IPOINT3DTYPE_DEF)
00241 #define IPOINT3DTYPE_DEF
00242 struct IPoint3D {
00243 GINT i1;
00244 GINT i2;
00245 GINT i3;
00246 };
00247 #endif
00248
00249
00250 #if !defined(FPOINT3DTYPE_DEF)
00251 #define FPOINT3DTYPE_DEF
00252 #define Point3D Point
00253 #endif
00254
00255
00256 #if !defined(STOPCONDTYPE_DEF)
00257 #define STOPCONDTYPE_DEF
00258 enum STOPCONDTYPE {BY_TIME, BY_CYCLE};
00259 #endif
00260
00261 #if !defined(OUTPUTTYPE_DEF)
00262 #define OUTPUTTYPE_DEF
00263 enum OUTPUTTYPE {OUT_BIN, OUT_SDS};
00264 #endif
00265
00266 #if !defined(BDYTYPE_DEF)
00267 #define BDYTYPE_DEF
00268 enum BDYTYPE {DIRICHLET=0, NEUMANN, PERIODIC, NOSLIP, NONE=-1};
00269 #endif
00270
00271 #if !defined(ELEMTYPE_DEF)
00272 #define ELEMTYPE_DEF
00273 enum ELEMTYPE {DEFORMED_QUAD, RECT_QUAD, TRIANGULAR, UNDEFINED=-1};
00274 #endif
00275
00276 #if !defined(TIMEEVOLTYPE_DEF)
00277 #define TIMEEVOLTYPE_DEF
00278 enum TIME_EVOLTYPE{TE_OIFS=0, TE_ABBDF, TE_EXBDF, TE_AMFE};
00279 #endif
00280
00281
00282 #if !defined(GPC_TYPES)
00283 #define GPC_TYPES
00284 enum GPC {GPC_BLOCKJAC_HELM=0, GPC_BLOCKJAC_LAP, GPC_POINTJAC_HELM, GPC_NONE};
00285 #endif
00286
00287
00288 #if !defined(SI_FORCE_TYPES)
00289 #define SI_FORCE_TYPES
00290 enum SI_FORCE_TYPE {SI_NONE=0, SI_EV};
00291 #endif
00292
00293 #if !defined(G_OP_TYPES)
00294 #define G_OP_TYPES
00295 enum G_OP {G_OP_SUM=0, G_OP_PROD, G_OP_MAX, G_OP_MIN, G_OP_ASSIGN};
00296 #endif
00297
00298 #if !defined(GDISTANCE_DEF)
00299 #define GDISTANCE_DEF
00300 #define PDISTANCE(p1,p2) sqrt( (p2[0]-p1[0])*(p2[0]-p1[0]) \
00301 +(p2[1]-p1[1])*(p2[1]-p1[1]) \
00302 +(p2[2]-p1[2])*(p2[2]-p1[2]) )
00303 #endif
00304
00305
00306
00307 #ifndef MIN
00308 #define MIN(a,b) (a<b?a:b)
00309 #endif
00310 #ifndef min
00311 #define min(a,b) (a<b?a:b)
00312 #endif
00313 #ifndef MAX
00314 #define MAX(a,b) (a>b?a:b)
00315 #endif
00316 #ifndef max
00317 #define max(a,b) (a>b?a:b)
00318 #endif
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330 #if defined(_AIX)
00331 # define HIWORD(dw) ( (*((GWORD*)dw )) )
00332 # define LOWORD(dw) ( (*((GWORD*)dw+1)) )
00333 # define SET_HW(xdw,xhi) ( memcpy((GWORD*)xdw ,xhi,sizeof(GWORD)) )
00334 # define SET_LW(xdw,xlo) ( memcpy((GWORD*)xdw+1,xlo,sizeof(GWORD)) )
00335 # define SET_DW(xdw,xhi,xlo) memcpy((GWORD*)xdw+1,xlo,sizeof(GWORD)); memcpy((GWORD*)xdw ,xhi,sizeof(GWORD))
00336
00337
00338 # define COMPTYP(dw) ( (*((BYTE*)dw+2)) )
00339 # define COMPNUM(dw) ( (*((BYTE*)dw+1)) )
00340 # define COMPANC(dw) ( (*((BYTE*)dw )) )
00341 # define SET_COMP(xdw,xtyp,xnum,xanc) *xdw=0; memcpy((BYTE*)xdw+2,xtyp,sizeof(BYTE)); \
00342 memcpy((BYTE*)xdw+1,xnum,sizeof(BYTE)); \
00343 memcpy((BYTE*)xdw ,xanc,sizeof(BYTE))
00344 #else
00345 # define HIWORD(dw) ( (*((GWORD*)dw+1)) )
00346 # define LOWORD(dw) ( (*((GWORD*)dw )) )
00347 # define SET_HW(xdw,xhi) ( memcpy((GWORD*)xdw+1,xhi,sizeof(GWORD)) )
00348 # define SET_LW(xdw,xlo) ( memcpy((GWORD*)xdw ,xlo,sizeof(GWORD)) )
00349 # define SET_DW(xdw,xhi,xlo) memcpy((GWORD*)xdw ,xlo,sizeof(GWORD)); memcpy((GWORD*)xdw+1,xhi,sizeof(GWORD))
00350
00351
00352 # define COMPTYP(dw) ( (*((BYTE*)dw )) )
00353 # define COMPNUM(dw) ( (*((BYTE*)dw+1)) )
00354 # define COMPANC(dw) ( (*((BYTE*)dw+2)) )
00355 # define SET_COMP(xdw,xtyp,xnum,xanc) *xdw=0; memcpy((BYTE*)xdw ,xtyp,sizeof(BYTE));\
00356 memcpy((BYTE*)xdw+1,xnum,sizeof(BYTE));\
00357 memcpy((BYTE*)xdw+2,xanc,sizeof(BYTE))
00358 #endif
00359
00360
00361 #if 0
00362
00363
00364
00365
00366 #if !defined(HIWORD)
00367 # if defined(_AIX)
00368 # define HIWORD(x) ( (GWORD)( ( (GDWORD)(x) ) & LO_MASK ) )
00369 # else
00370 # define HIWORD(x) ( (GWORD)( ( (GDWORD)(x) >> GWORD_BITSIZE) & LO_MASK ) )
00371 # endif
00372 #endif
00373
00374 #if !defined(LOWORD)
00375 #if defined(_AIX)
00376 # define LOWORD(x) ( (GWORD)( ( (GDWORD)(x) >> GWORD_BITSIZE) & LO_MASK ) )
00377 # else
00378 # define LOWORD(x) ( (GWORD)( ( (GDWORD)(x) ) & LO_MASK ) )
00379 # endif
00380 #endif
00381
00382 #if !defined(SET_DW)
00383 #if defined(_AIX)
00384 # define SET_DW(xhi,xlo) ( ( ( (GDWORD)(xlo) << GWORD_BITSIZE ) & ONE_MASK ) \
00385 | ( (GDWORD)(xhi) ) )
00386 # else
00387 # define SET_DW(xhi,xlo) ( ( ( (GDWORD)(xhi) << GWORD_BITSIZE ) & HI_MASK ) \
00388 | ( (GDWORD)(xlo) & LO_MASK ) )
00389 # endif
00390 #endif
00391 #endif
00392
00393
00394 typedef std::string string;
00395