Ifpack Package Browser (Single Doxygen Collection)  Development
euclid_common.h
Go to the documentation of this file.
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 #ifndef COMMON_DH
44 #define COMMON_DH
45 
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <string.h>
49 #include <math.h>
50 #include <limits.h>
51 #include <stdarg.h>
52 
53 #define REAL_DH double
54 
55 /*-----------------------------------------------------------------------
56  * compile-time dependent includes from other libraries.
57  * maintainer's note: this is the only place where non-Euclid
58  * files are included.
59  *-----------------------------------------------------------------------*/
60 
61 
62 #include <mpi.h>
63 
64 
65 /*-----------------------------------------------------------------------
66  * Euclid includes
67  *-----------------------------------------------------------------------*/
68 
69 #include "euclid_config.h" /* contains various user-configurable settings;
70  edit this when building an interface with
71  other libraries.
72  */
73 
74 #include "macros_dh.h" /* macros for error checking, etc */
75 
76 /*-----------------------------------------------------------
77  * Euclid classes
78  *-----------------------------------------------------------*/
79 typedef struct _matgenfd *MatGenFD;
81 typedef struct _timer_dh *Timer_dh;
82 typedef struct _parser_dh *Parser_dh;
83 typedef struct _timeLog_dh *TimeLog_dh;
84 typedef struct _mem_dh *Mem_dh;
85 typedef struct _mat_dh *Mat_dh;
86 typedef struct _factor_dh *Factor_dh;
87 typedef struct _vec_dh *Vec_dh;
88 typedef struct _numbering_dh *Numbering_dh;
89 typedef struct _hash_dh *Hash_dh;
90 typedef struct _hash_i_dh *Hash_i_dh;
91 typedef struct _mpi_interface_dh *Euclid_dh;
92 typedef struct _sortedList_dh *SortedList_dh;
93 typedef struct _extrows_dh *ExternalRows_dh;
94 typedef struct _stack_dh *Stack_dh;
95 typedef struct _queue_dh *Queue_dh;
96 typedef struct _sortedset_dh *SortedSet_dh;
97 
98 /*
99 typedef struct _localPerm_dh* LocalPerm_dh;
100 typedef struct _procGrid_dh* ProcGrid_dh;
101 typedef struct _globalPerm_dh* GlobalPerm_dh;
102 typedef struct _apply_dh* Apply_dh;
103 typedef struct _externalRows_dh* ExternalRows_dh;
104 */
105 
106 /*---------------------------------------------------------------------
107  * misc.
108  *---------------------------------------------------------------------*/
109 
110 
111 #if defined(__cplusplus)
112 #else
113 typedef int bool;
114 #define true 1
115 #define false 0
116 #endif
117 
118 /* ------------------------------------------------------------------
119  * Globally scoped variables, error handling functions, etc.
120  * These are all defined in /src/globalObjects.c
121  * ------------------------------------------------------------------*/
122 extern Parser_dh parser_dh; /* for setting/getting runtime options */
123 extern TimeLog_dh tlog_dh; /* internal timing functionality */
124 extern Mem_dh mem_dh; /* memory management */
125 extern FILE *logFile;
126 extern int np_dh; /* number of processors and subdomains */
127 extern int myid_dh; /* rank of this processor (and subdomain) */
128 extern MPI_Comm comm_dh;
129 
130 
131 extern bool ignoreMe; /* used to stop compiler complaints */
132 extern int ref_counter; /* for internal use only! Reference counter
133  to ensure that global objects are not
134  destroyed when Euclid's destructor is called,
135  and more than one instance of Euclid has been
136  instantiated.
137  */
138 
139 
140 /* Error and message handling. These are accessed through
141  * macros defined in "macros_dh.h"
142  */
143 extern bool errFlag_dh;
144 
145 #ifdef __cplusplus
146 extern "C"
147 {
148 #endif
149 
150  extern void setInfo_dh (char *msg, char *function, char *file, int line);
151  extern void setError_dh (char *msg, char *function, char *file, int line);
152  extern void printErrorMsg (FILE * fp);
153 
154 #ifndef MPI_MAX_ERROR_STRING
155 #define MPI_MAX_ERROR_STRING 256
156 #endif
157 
158 #define MSG_BUF_SIZE_DH MAX(1024, MPI_MAX_ERROR_STRING)
159  extern char msgBuf_dh[MSG_BUF_SIZE_DH];
160 
161 /* Each processor (may) open a logfile.
162  * The bools are switches for controlling the amount of informational
163  * output, and where it gets written to. Function trace logging is only
164  * enabled when compiled with the debugging (-g) option.
165  */
166  extern void openLogfile_dh (int argc, char *argv[]);
167  extern void closeLogfile_dh ();
168  extern bool logInfoToStderr;
169  extern bool logInfoToFile;
170  extern bool logFuncsToStderr;
171  extern bool logFuncsToFile;
172  extern void Error_dhStartFunc (char *function, char *file, int line);
173  extern void Error_dhEndFunc (char *function);
174  extern void dh_StartFunc (char *function, char *file, int line,
175  int priority);
176  extern void dh_EndFunc (char *function, int priority);
177  extern void printFunctionStack (FILE * fp);
178 
179  extern void EuclidInitialize (int argc, char *argv[], char *help); /* instantiates global objects */
180  extern void EuclidFinalize (); /* deletes global objects */
181  extern bool EuclidIsInitialized ();
182  extern void printf_dh (char *fmt, ...);
183  extern void fprintf_dh (FILE * fp, char *fmt, ...);
184 
185  /* echo command line invocation to stdout.
186  The "prefix" string is for grepping; it may be NULL.
187  */
188  extern void echoInvocation_dh (MPI_Comm comm, char *prefix, int argc,
189  char *argv[]);
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif
Factor_dh
struct _factor_dh * Factor_dh
Definition: euclid_common.h:86
_subdomain_dh
Definition: SubdomainGraph_dh.h:68
EuclidInitialize
void EuclidInitialize(int argc, char *argv[], char *help)
Definition: globalObjects.c:357
Queue_dh
struct _queue_dh * Queue_dh
Definition: euclid_common.h:95
fprintf_dh
void fprintf_dh(FILE *fp, char *fmt,...)
Definition: globalObjects.c:473
EuclidIsInitialized
bool EuclidIsInitialized()
Definition: globalObjects.c:349
logInfoToFile
bool logInfoToFile
Definition: globalObjects.c:76
setInfo_dh
void setInfo_dh(char *msg, char *function, char *file, int line)
Definition: globalObjects.c:161
MSG_BUF_SIZE_DH
#define MSG_BUF_SIZE_DH
Definition: euclid_common.h:158
_timer_dh
Definition: Timer_dh.h:98
_vec_dh
Definition: Vec_dh.h:52
myid_dh
int myid_dh
Definition: globalObjects.c:63
parser_dh
Parser_dh parser_dh
Definition: globalObjects.c:57
SortedSet_dh
struct _sortedset_dh * SortedSet_dh
Definition: euclid_common.h:96
logInfoToStderr
bool logInfoToStderr
Definition: globalObjects.c:75
dh_StartFunc
void dh_StartFunc(char *function, char *file, int line, int priority)
Definition: globalObjects.c:181
SortedList_dh
struct _sortedList_dh * SortedList_dh
Definition: euclid_common.h:92
MatGenFD
struct _matgenfd * MatGenFD
Definition: euclid_common.h:79
ignoreMe
bool ignoreMe
Definition: globalObjects.c:80
euclid_config.h
printErrorMsg
void printErrorMsg(FILE *fp)
Definition: globalObjects.c:254
macros_dh.h
TimeLog_dh
struct _timeLog_dh * TimeLog_dh
Definition: euclid_common.h:83
_mat_dh
Definition: Mat_dh.h:62
EuclidFinalize
void EuclidFinalize()
Definition: globalObjects.c:411
_factor_dh
Definition: Factor_dh.h:53
Mat_dh
struct _mat_dh * Mat_dh
Definition: euclid_common.h:85
_timeLog_dh
Definition: TimeLog_dh.c:50
msgBuf_dh
char msgBuf_dh[MSG_BUF_SIZE_DH]
Definition: globalObjects.c:61
dh_EndFunc
void dh_EndFunc(char *function, int priority)
Definition: globalObjects.c:206
ref_counter
int ref_counter
Definition: globalObjects.c:81
logFuncsToStderr
bool logFuncsToStderr
Definition: globalObjects.c:77
Error_dhEndFunc
void Error_dhEndFunc(char *function)
Definition: globalObjects.c:332
ExternalRows_dh
struct _extrows_dh * ExternalRows_dh
Definition: euclid_common.h:93
Mem_dh
struct _mem_dh * Mem_dh
Definition: euclid_common.h:84
Euclid_dh
struct _mpi_interface_dh * Euclid_dh
Definition: euclid_common.h:91
_sortedset_dh
Definition: SortedSet_dh.h:53
openLogfile_dh
void openLogfile_dh(int argc, char *argv[])
Definition: globalObjects.c:102
Timer_dh
struct _timer_dh * Timer_dh
Definition: euclid_common.h:81
Vec_dh
struct _vec_dh * Vec_dh
Definition: euclid_common.h:87
mem_dh
Mem_dh mem_dh
Definition: globalObjects.c:59
_sortedList_dh
Definition: SortedList_dh.c:50
errFlag_dh
bool errFlag_dh
Definition: globalObjects.c:56
_mem_dh
Definition: Mem_dh.c:60
Error_dhStartFunc
void Error_dhStartFunc(char *function, char *file, int line)
Definition: globalObjects.c:299
printf_dh
void printf_dh(char *fmt,...)
Definition: globalObjects.c:456
_numbering_dh
Definition: Numbering_dh.h:59
logFile
FILE * logFile
Definition: globalObjects.c:72
Numbering_dh
struct _numbering_dh * Numbering_dh
Definition: euclid_common.h:88
tlog_dh
TimeLog_dh tlog_dh
Definition: globalObjects.c:58
SubdomainGraph_dh
struct _subdomain_dh * SubdomainGraph_dh
Definition: euclid_common.h:80
Hash_dh
struct _hash_dh * Hash_dh
Definition: euclid_common.h:89
bool
int bool
Definition: euclid_common.h:113
np_dh
int np_dh
Definition: globalObjects.c:62
comm_dh
MPI_Comm comm_dh
Definition: globalObjects.c:64
_mpi_interface_dh
Definition: Euclid_dh.h:136
logFuncsToFile
bool logFuncsToFile
Definition: globalObjects.c:78
_parser_dh
Definition: Parser_dh.c:48
echoInvocation_dh
void echoInvocation_dh(MPI_Comm comm, char *prefix, int argc, char *argv[])
Definition: globalObjects.c:491
setError_dh
void setError_dh(char *msg, char *function, char *file, int line)
Definition: globalObjects.c:228
closeLogfile_dh
void closeLogfile_dh()
Definition: globalObjects.c:148
_hash_i_dh
Definition: Hash_i_dh.c:79
_hash_dh
Definition: Hash_dh.h:75
_extrows_dh
Definition: ExternalRows_dh.h:61
Parser_dh
struct _parser_dh * Parser_dh
Definition: euclid_common.h:82
Hash_i_dh
struct _hash_i_dh * Hash_i_dh
Definition: euclid_common.h:90
printFunctionStack
void printFunctionStack(FILE *fp)
Definition: globalObjects.c:276
Stack_dh
struct _stack_dh * Stack_dh
Definition: euclid_common.h:94
_matgenfd
Definition: MatGenFD.h:94