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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 631 - (show annotations)
Thu Mar 23 04:27:32 2006 UTC (13 years, 5 months ago) by dhawcroft
File MIME type: text/plain
File size: 4040 byte(s)
Prepended all paso source files with new Copyright notice
1 /* $Id$ */
2
3 /*
4 ********************************************************************************
5 * Copyright © 2006 by ACcESS MNRF *
6 * *
7 * http://www.access.edu.au *
8 * Primary Business: Queensland, Australia *
9 * Licensed under the Open Software License version 3.0 *
10 * http://www.opensource.org/licenses/osl-3.0.php *
11 ********************************************************************************
12 */
13
14 #ifndef INC_PASO_COMMON
15 #define INC_PASO_COMMON
16
17
18
19 /**************************************************************/
20
21 /* Finley finite element solver: common include file */
22
23 /**************************************************************/
24
25 /* Copyrights by ACcESS Australia, 2003 */
26 /* Version: $Id$ */
27
28 /**************************************************************/
29
30 /* some system values */
31
32 #include <float.h>
33 #include <stdio.h>
34 #include <limits.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <math.h>
38
39 #define LenString_MAX FILENAME_MAX*2
40 #define LenErrorMsg_MAX LenString_MAX
41
42 /* on some arcitectures it could be a good idea to use long rather than int */
43 /* this has not really been tested */
44
45 typedef int dim_t;
46 typedef int index_t;
47 typedef int bool_t;
48 typedef int type_t;
49 typedef int err_t;
50
51 #define INDEX_T_MAX INT_MAX
52 #define EPSILON DBL_EPSILON
53
54 /**************************************************************/
55
56 /* some useful functions: */
57
58 #define FALSE 0
59 #define TRUE 1
60 #define UNKNOWN -1
61 #define DBLE(_x_) (double)(_x_)
62 #define INDEX1(_X1_) (_X1_)
63 #define INDEX2(_X1_,_X2_,_N1_) ((_X1_)+(_N1_)*(_X2_))
64 #define INDEX3(_X1_,_X2_,_X3_,_N1_,_N2_) ((_X1_)+(_N1_)*INDEX2(_X2_,_X3_,_N2_))
65 #define INDEX4(_X1_,_X2_,_X3_,_X4_,_N1_,_N2_,_N3_) ((_X1_)+(_N1_)*INDEX3(_X2_,_X3_,_X4_,_N2_,_N3_))
66 #define INDEX5(_X1_,_X2_,_X3_,_X4_,_X5_,_N1_,_N2_,_N3_,_N4_) ((_X1_)+(_N1_)*INDEX4(_X2_,_X3_,_X4_,_X5_,_N2_,_N3_,_N4_))
67 #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_))
68
69 #define MAX(_arg1_,_arg2_) ((_arg1_)>(_arg2_) ? (_arg1_) : (_arg2_))
70 #define MIN(_arg1_,_arg2_) ((_arg1_)>(_arg2_) ? (_arg2_) : (_arg1_))
71 #define ABS(_arg_) MAX((_arg_),-(_arg_))
72 /**************************************************************/
73
74 /* memory allocation: */
75
76 #define TMPMEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
77 #define TMPMEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
78 #ifdef __ECC
79 #define MEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
80 #define MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
81 #ifdef _OPENMP
82 #define THREAD_MEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) kmp_malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
83 #define THREAD_MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { kmp_free(_PTR_); (_PTR_) = NULL; }
84 #else
85 #define THREAD_MEMALLOC(_LENGTH_,_TYPE_) TMPMEMALLOC(_LENGTH_,_TYPE_)
86 #define THREAD_MEMFREE(_PTR_) TMPMEMFREE(_PTR_)
87 #endif
88 #else
89 #define MEMALLOC(_LENGTH_,_TYPE_) (_TYPE_*) malloc(((size_t)(_LENGTH_))*sizeof(_TYPE_))
90 #define MEMFREE(_PTR_) if ((void *)(_PTR_) != NULL ) { free(_PTR_); (_PTR_) = NULL; }
91 #define THREAD_MEMALLOC(_LENGTH_,_TYPE_) TMPMEMALLOC(_LENGTH_,_TYPE_)
92 #define THREAD_MEMFREE(_PTR_) TMPMEMFREE(_PTR_)
93 #endif
94
95 #endif /* #ifndef INC_PASO_COMMON */
96
97 /*
98 * $Log$
99 * Revision 1.2 2005/09/15 03:44:38 jgs
100 * Merge of development branch dev-02 back to main trunk on 2005-09-15
101 *
102 * Revision 1.1.2.1 2005/09/05 06:29:46 gross
103 * These files have been extracted from finley to define a stand alone libray for iterative
104 * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
105 * has not been tested yet.
106 *
107 *
108 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26