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#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 *-----------------------------------------------------------*/
79typedef struct _matgenfd *MatGenFD;
80typedef struct _subdomain_dh *SubdomainGraph_dh;
81typedef struct _timer_dh *Timer_dh;
82typedef struct _parser_dh *Parser_dh;
83typedef struct _timeLog_dh *TimeLog_dh;
84typedef struct _mem_dh *Mem_dh;
85typedef struct _mat_dh *Mat_dh;
86typedef struct _factor_dh *Factor_dh;
87typedef struct _vec_dh *Vec_dh;
88typedef struct _numbering_dh *Numbering_dh;
89typedef struct _hash_dh *Hash_dh;
90typedef struct _hash_i_dh *Hash_i_dh;
91typedef struct _mpi_interface_dh *Euclid_dh;
92typedef struct _sortedList_dh *SortedList_dh;
93typedef struct _extrows_dh *ExternalRows_dh;
94typedef struct _stack_dh *Stack_dh;
95typedef struct _queue_dh *Queue_dh;
96typedef struct _sortedset_dh *SortedSet_dh;
97
98/*
99typedef struct _localPerm_dh* LocalPerm_dh;
100typedef struct _procGrid_dh* ProcGrid_dh;
101typedef struct _globalPerm_dh* GlobalPerm_dh;
102typedef struct _apply_dh* Apply_dh;
103typedef struct _externalRows_dh* ExternalRows_dh;
104*/
105
106/*---------------------------------------------------------------------
107 * misc.
108 *---------------------------------------------------------------------*/
109
110
111#if defined(__cplusplus)
112#else
113typedef 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 * ------------------------------------------------------------------*/
122extern Parser_dh parser_dh; /* for setting/getting runtime options */
123extern TimeLog_dh tlog_dh; /* internal timing functionality */
124extern Mem_dh mem_dh; /* memory management */
125extern FILE *logFile;
126extern int np_dh; /* number of processors and subdomains */
127extern int myid_dh; /* rank of this processor (and subdomain) */
128extern MPI_Comm comm_dh;
129
130
131extern bool ignoreMe; /* used to stop compiler complaints */
132extern 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 */
143extern bool errFlag_dh;
144
145#ifdef __cplusplus
146extern "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