IFPACK  Development
 All Classes Namespaces Files Functions Variables Enumerations Friends Pages
euclid_config.h
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack: Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2002) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 
44 #ifndef EUCLID_CONF_DH
45 #define EUCLID_CONF_DH
46 
47 #define MAX_MPI_TASKS 50000
48 
49 /* for use in printTriples functions */
50 #define TRIPLES_FORMAT "%i %i %1.8e\n"
51 /* #define TRIPLES_FORMAT "%i %i %1.19e\n" */
52 
53 #undef PRIVATE_TIMING_DH
54  /* primarily for experimental purposes; if defined, TimeLog_dh
55  marks are entered in Mat_dh and Euclid_apply modules.
56  */
57 
58 
59  /* top-level error handlers. redefine to do what you want, or don't
60  use it at all. Intended usage for calling Euclid functions from
61  main is:
62 
63  Euclid_dhPhoo(); ERRCHKA;
64  */
65 
66 #ifdef USING_MPI
67 #define EUCLID_EXIT MPI_Abort(comm_dh, -1)
68 #else
69 #define EUCLID_EXIT exit(-1);
70 #endif
71 
72 #define EXIT_NOW(msg) \
73  { setError_dh(msg, __FUNC__, __FILE__, __LINE__); \
74  ERRCHKA; \
75  }
76 
77 #define ERRCHKA \
78  if (errFlag_dh) { \
79  setError_dh("", __FUNC__, __FILE__, __LINE__); \
80  if (logFile != NULL) { \
81  printErrorMsg(logFile); \
82  closeLogfile_dh(); \
83  } \
84  printErrorMsg(stderr); \
85  if (myid_dh == 0) { \
86  Mem_dhPrint(mem_dh, stderr, false); \
87  } \
88  EUCLID_EXIT; \
89  }
90 
91 #define ERRCHKA_CHKERRA(ierr) \
92  if (errFlag_dh) { \
93  setError_dh("", __FUNC__, __FILE__, __LINE__); \
94  if (logFile != NULL) { \
95  printErrorMsg(logFile); \
96  fprintf(logFile, "\n[%i] ierr = %i, errFlag_dh = %i\n", myid_dh, ierr, errFlag_dh); \
97  closeLogfile_dh(); \
98  } \
99  printErrorMsg(stderr); \
100  fprintf(stderr, "\n[%i] ierr = %i, errFlag_dh = %i\n", myid_dh, ierr, errFlag_dh); \
101  CHKERRA(ierr); \
102  }
103 
104 
105 #define MAX_SUBDOMAINS 20
106  /* The maximum number of subdomains into which
107  the matrix may be partitioned. Rule of thumb:
108  MAX_SUBDOMAINS >= number of threads.
109 
110  Note: this is only for shared-memory.
111  */
112 
113 
114 #define PIVOT_FIX_DEFAULT 1e-3
115 
116 /*---------------------------------------------------------------------
117  * Memory management. These macros work with functions in Mem_dh.c;
118  * Change if you want to use some memory management and reporting schemes
119  * other than that supplied with Euclid. These depend on the global
120  * object "Mem_dh mem_dh" which is defined in globalObjects.c (yuck!)
121  ---------------------------------------------------------------------*/
122 
123 #define MALLOC_DH(s) Mem_dhMalloc(mem_dh, (s))
124 #define FREE_DH(p) Mem_dhFree(mem_dh, p)
125 
126 
127  /* The actual calls used by Mem_dh objects to allocate/free memory
128  * from the heap.
129  */
130 #define PRIVATE_MALLOC malloc
131 #define PRIVATE_FREE free
132 
133 /*------------------ Memory management end -----------------------------*/
134 
135 /*
136 
137 This is currently accomplished in the makefile system;
138 If you're building an interface to a solver package,
139 you need to write EUCLID_GET_ROW() functions: see src/getRow.c
140 */
141 
142 #endif