IFPACK  Development
 All Classes Namespaces Files Functions Variables Enumerations Friends Pages
euclid_common.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 #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;
80 typedef struct _subdomain_dh *SubdomainGraph_dh;
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
Definition: Mat_dh.h:62
Definition: Vec_dh.h:52
Definition: Mem_dh.c:60