/[escript]/trunk/esys2/finley/src/finleyC/Common.h
ViewVC logotype

Contents of /trunk/esys2/finley/src/finleyC/Common.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100 - (show annotations)
Wed Dec 15 03:48:48 2004 UTC (15 years ago) by jgs
File MIME type: text/plain
File size: 3106 byte(s)
*** empty log message ***

1 /* $Id$ */
2
3 #ifndef INC_FINLEY_COMMON
4 #define INC_FINLEY_COMMON
5
6 /**************************************************************/
7
8 /* Finley finite element solver: common include file */
9
10 /**************************************************************/
11
12 /* Copyrights by ACcESS Australia, 2003 */
13 /* Version: $Id$ */
14
15 /**************************************************************/
16
17 /* some system values */
18
19 #include <float.h>
20 #include <stdio.h>
21 #include <limits.h>
22
23 #define LenString_MAX FILENAME_MAX*2
24 #define LenErrorMsg_MAX LenString_MAX
25
26 /* on some arcitectures it could be a good idea to use long rather than int */
27 /* this has not really been tested */
28
29 typedef int maybelong;
30 #define MAYBELONG_MAX INT_MAX
31 #define HUGE_VAL DBL_MAX
32 #define EPSILON DBL_EPSILON
33
34 /**************************************************************/
35
36 /* some useful functions: */
37
38 #define FALSE 0
39 #define TRUE 1
40 #define UNKNOWN -1
41 #define DBLE(_x_) (double)(_x_)
42 #define INDEX1(_X1_) (_X1_)
43 #define INDEX2(_X1_,_X2_,_N1_) ((_X1_)+(_N1_)*(_X2_))
44 #define INDEX3(_X1_,_X2_,_X3_,_N1_,_N2_) ((_X1_)+(_N1_)*INDEX2(_X2_,_X3_,_N2_))
45 #define INDEX4(_X1_,_X2_,_X3_,_X4_,_N1_,_N2_,_N3_) ((_X1_)+(_N1_)*INDEX3(_X2_,_X3_,_X4_,_N2_,_N3_))
46 #define INDEX5(_X1_,_X2_,_X3_,_X4_,_X5_,_N1_,_N2_,_N3_,_N4_) ((_X1_)+(_N1_)*INDEX4(_X2_,_X3_,_X4_,_X5_,_N2_,_N3_,_N4_))
47 #define INDEX6(_X1_,_X2_,_X3_,_X4_,_X5_,_X6_,_N1_,_N2_,_N3_,_N4_,_N5_) ((_X1_)+(_N1_)*INDEX5(_X2_,_X3_,_X4_,_X5_,_X6_,_N2_,_N3_,_N4_,_N5_))
48
49 #define MAX(_arg1_,_arg2_) ((_arg1_)>(_arg2_) ? (_arg1_) : (_arg2_))
50 #define MIN(_arg1_,_arg2_) ((_arg1_)>(_arg2_) ? (_arg2_) : (_arg1_))
51 #define ABS(_arg_) MAX((_arg_),-(_arg_))
52 /**************************************************************/
53
54 /* memory allocation: */
55
56 #define TMPMEMALLOC(_PTR_) malloc(_PTR_)
57 #define TMPMEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
58 #ifdef __ECC
59 #define MEMALLOC(_PTR_) malloc(_PTR_)
60 #define MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
61 #ifdef _OPENMP
62 #define THREAD_MEMALLOC(_PTR_) kmp_malloc(_PTR_);
63 #define THREAD_MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { kmp_free(_PTR_); (_PTR_) = NULL; }
64 #else
65 #define THREAD_MEMALLOC(_PTR_) TMPMEMALLOC(_PTR_)
66 #define THREAD_MEMFREE(_PTR_) TMPMEMFREE(_PTR_)
67 #endif
68 #else
69 #define MEMALLOC(_PTR_) malloc(_PTR_)
70 #define MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
71 #define THREAD_MEMALLOC(_PTR_) TMPMEMALLOC(_PTR_)
72 #define THREAD_MEMFREE(_PTR_) TMPMEMFREE(_PTR_)
73 #endif
74
75 #endif /* #ifndef INC_FINLEY_COMMON */
76
77 /*
78 * $Log$
79 * Revision 1.3 2004/12/15 03:48:45 jgs
80 * *** empty log message ***
81 *
82 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
83 * initial import of project esys2
84 *
85 * Revision 1.3 2004/07/02 04:21:13 gross
86 * Finley C code has been included
87 *
88 * Revision 1.2 2004/07/01 23:49:17 gross
89 * macro for copying of a double array added
90 *
91 * Revision 1.1.1.1 2004/06/24 04:00:40 johng
92 * Initial version of eys using boost-python.
93 *
94 *
95 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26