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