IFPACK Development
Loading...
Searching...
No Matches
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#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 *-----------------------------------------------------------*/
85typedef struct _matgenfd *MatGenFD;
86typedef struct _subdomain_dh *SubdomainGraph_dh;
87typedef struct _timer_dh *Timer_dh;
88typedef struct _parser_dh *Parser_dh;
89typedef struct _timeLog_dh *TimeLog_dh;
90typedef struct _mem_dh *Mem_dh;
91typedef struct _mat_dh *Mat_dh;
92typedef struct _factor_dh *Factor_dh;
93typedef struct _vec_dh *Vec_dh;
94typedef struct _numbering_dh *Numbering_dh;
95typedef struct _hash_dh *Hash_dh;
96typedef struct _hash_i_dh *Hash_i_dh;
97typedef struct _mpi_interface_dh *Euclid_dh;
98typedef struct _sortedList_dh *SortedList_dh;
99typedef struct _extrows_dh *ExternalRows_dh;
100typedef struct _stack_dh *Stack_dh;
101typedef struct _queue_dh *Queue_dh;
102typedef struct _sortedset_dh *SortedSet_dh;
103
104/*
105typedef struct _localPerm_dh* LocalPerm_dh;
106typedef struct _procGrid_dh* ProcGrid_dh;
107typedef struct _globalPerm_dh* GlobalPerm_dh;
108typedef struct _apply_dh* Apply_dh;
109typedef struct _externalRows_dh* ExternalRows_dh;
110*/
111
112/*---------------------------------------------------------------------
113 * misc.
114 *---------------------------------------------------------------------*/
115
116
117#if defined(__cplusplus)
118#else
119typedef 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 * ------------------------------------------------------------------*/
128extern Parser_dh parser_dh; /* for setting/getting runtime options */
129extern TimeLog_dh tlog_dh; /* internal timing functionality */
130extern Mem_dh mem_dh; /* memory management */
131extern FILE *logFile;
132extern int np_dh; /* number of processors and subdomains */
133extern int myid_dh; /* rank of this processor (and subdomain) */
134extern MPI_Comm comm_dh;
135
136
137extern bool ignoreMe; /* used to stop compiler complaints */
138extern 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 */
149extern bool errFlag_dh;
150
151#ifdef __cplusplus
152extern "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