/[escript]/trunk/paso/src/Common.h
ViewVC logotype

Annotation of /trunk/paso/src/Common.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 150 - (hide annotations)
Thu Sep 15 03:44:45 2005 UTC (14 years ago) by jgs
Original Path: trunk/esys2/paso/src/Common.h
File MIME type: text/plain
File size: 3393 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

1 jgs 150 /* $Id$ */
2    
3     #ifndef INC_PASO_COMMON
4     #define INC_PASO_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     #include <stdlib.h>
23     #include <string.h>
24     #include <math.h>
25    
26     #define LenString_MAX FILENAME_MAX*2
27     #define LenErrorMsg_MAX LenString_MAX
28    
29     /* on some arcitectures it could be a good idea to use long rather than int */
30     /* this has not really been tested */
31    
32     typedef int dim_t;
33     typedef int index_t;
34     typedef int bool_t;
35     typedef int type_t;
36     typedef int err_t;
37    
38     #define INDEX_T_MAX INT_MAX
39     #define EPSILON DBL_EPSILON
40    
41     /**************************************************************/
42    
43     /* some useful functions: */
44    
45     #define FALSE 0
46     #define TRUE 1
47     #define UNKNOWN -1
48     #define DBLE(_x_) (double)(_x_)
49     #define INDEX1(_X1_) (_X1_)
50     #define INDEX2(_X1_,_X2_,_N1_) ((_X1_)+(_N1_)*(_X2_))
51     #define INDEX3(_X1_,_X2_,_X3_,_N1_,_N2_) ((_X1_)+(_N1_)*INDEX2(_X2_,_X3_,_N2_))
52     #define INDEX4(_X1_,_X2_,_X3_,_X4_,_N1_,_N2_,_N3_) ((_X1_)+(_N1_)*INDEX3(_X2_,_X3_,_X4_,_N2_,_N3_))
53     #define INDEX5(_X1_,_X2_,_X3_,_X4_,_X5_,_N1_,_N2_,_N3_,_N4_) ((_X1_)+(_N1_)*INDEX4(_X2_,_X3_,_X4_,_X5_,_N2_,_N3_,_N4_))
54     #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_))
55    
56     #define MAX(_arg1_,_arg2_) ((_arg1_)>(_arg2_) ? (_arg1_) : (_arg2_))
57     #define MIN(_arg1_,_arg2_) ((_arg1_)>(_arg2_) ? (_arg2_) : (_arg1_))
58     #define ABS(_arg_) MAX((_arg_),-(_arg_))
59     /**************************************************************/
60    
61     /* memory allocation: */
62    
63     #define TMPMEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
64     #define TMPMEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
65     #ifdef __ECC
66     #define MEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
67     #define MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
68     #ifdef _OPENMP
69     #define THREAD_MEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) kmp_malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
70     #define THREAD_MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { kmp_free(_PTR_); (_PTR_) = NULL; }
71     #else
72     #define THREAD_MEMALLOC(_LENGTH_,_TYPE_) TMPMEMALLOC(_LENGTH_,_TYPE_)
73     #define THREAD_MEMFREE(_PTR_) TMPMEMFREE(_PTR_)
74     #endif
75     #else
76     #define MEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
77     #define MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
78     #define THREAD_MEMALLOC(_LENGTH_,_TYPE_) TMPMEMALLOC(_LENGTH_,_TYPE_)
79     #define THREAD_MEMFREE(_PTR_) TMPMEMFREE(_PTR_)
80     #endif
81    
82     #endif /* #ifndef INC_PASO_COMMON */
83    
84     /*
85     * $Log$
86     * Revision 1.2 2005/09/15 03:44:38 jgs
87     * Merge of development branch dev-02 back to main trunk on 2005-09-15
88     *
89     * Revision 1.1.2.1 2005/09/05 06:29:46 gross
90     * These files have been extracted from finley to define a stand alone libray for iterative
91     * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
92     * has not been tested yet.
93     *
94     *
95     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26