IFPACK  Development
 All Classes Files Functions Variables Enumerations Friends
euclid_common.h
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ***********************************************************************
00040 //@HEADER
00041 */
00042 
00043 #ifndef COMMON_DH
00044 #define COMMON_DH
00045 
00046 #include <stdio.h>
00047 #include <stdlib.h>
00048 #include <string.h>
00049 #include <math.h>
00050 #include <limits.h>
00051 #include <stdarg.h>
00052 
00053 #define REAL_DH double
00054 
00055 /*-----------------------------------------------------------------------
00056  * compile-time dependent includes from other libraries.
00057  * maintainer's note: this is the only place where non-Euclid
00058  * files are included.
00059  *-----------------------------------------------------------------------*/
00060 
00061 
00062 #include <mpi.h>
00063 
00064 
00065 /*-----------------------------------------------------------------------
00066  * Euclid includes
00067  *-----------------------------------------------------------------------*/
00068 
00069 #include "euclid_config.h"  /* contains various user-configurable settings;
00070                    edit this when building an interface with
00071                    other libraries.  
00072                  */
00073 
00074 #include "macros_dh.h"      /* macros for error checking, etc */
00075 
00076 /*----------------------------------------------------------- 
00077  *  Euclid classes 
00078  *-----------------------------------------------------------*/
00079 typedef struct _matgenfd *MatGenFD;
00080 typedef struct _subdomain_dh *SubdomainGraph_dh;
00081 typedef struct _timer_dh *Timer_dh;
00082 typedef struct _parser_dh *Parser_dh;
00083 typedef struct _timeLog_dh *TimeLog_dh;
00084 typedef struct _mem_dh *Mem_dh;
00085 typedef struct _mat_dh *Mat_dh;
00086 typedef struct _factor_dh *Factor_dh;
00087 typedef struct _vec_dh *Vec_dh;
00088 typedef struct _numbering_dh *Numbering_dh;
00089 typedef struct _hash_dh *Hash_dh;
00090 typedef struct _hash_i_dh *Hash_i_dh;
00091 typedef struct _mpi_interface_dh *Euclid_dh;
00092 typedef struct _sortedList_dh *SortedList_dh;
00093 typedef struct _extrows_dh *ExternalRows_dh;
00094 typedef struct _stack_dh *Stack_dh;
00095 typedef struct _queue_dh *Queue_dh;
00096 typedef struct _sortedset_dh *SortedSet_dh;
00097 
00098 /*
00099 typedef struct _localPerm_dh*       LocalPerm_dh;
00100 typedef struct _procGrid_dh*        ProcGrid_dh;
00101 typedef struct _globalPerm_dh*      GlobalPerm_dh;
00102 typedef struct _apply_dh*           Apply_dh;
00103 typedef struct _externalRows_dh*    ExternalRows_dh;
00104 */
00105 
00106 /*---------------------------------------------------------------------
00107  * misc.
00108  *---------------------------------------------------------------------*/
00109 
00110 
00111 #if defined(__cplusplus)
00112 #else
00113 typedef int bool;
00114 #define true   1
00115 #define false  0
00116 #endif
00117 
00118 /* ------------------------------------------------------------------
00119  * Globally scoped variables, error handling functions, etc.
00120  * These are all defined in /src/globalObjects.c 
00121  * ------------------------------------------------------------------*/
00122 extern Parser_dh parser_dh; /* for setting/getting runtime options */
00123 extern TimeLog_dh tlog_dh;  /* internal timing  functionality */
00124 extern Mem_dh mem_dh;       /* memory management */
00125 extern FILE *logFile;
00126 extern int np_dh;       /* number of processors and subdomains */
00127 extern int myid_dh;     /* rank of this processor (and subdomain) */
00128 extern MPI_Comm comm_dh;
00129 
00130 
00131 extern bool ignoreMe;       /* used to stop compiler complaints */
00132 extern int ref_counter;     /* for internal use only!  Reference counter
00133                    to ensure that global objects are not
00134                    destroyed when Euclid's destructor is called,
00135                    and more than one instance of Euclid has been
00136                    instantiated.
00137                  */
00138 
00139 
00140 /* Error and message handling.  These are accessed through
00141  * macros defined in "macros_dh.h"
00142  */
00143 extern bool errFlag_dh;
00144 
00145 #ifdef __cplusplus
00146 extern "C"
00147 {
00148 #endif
00149 
00150   extern void setInfo_dh (char *msg, char *function, char *file, int line);
00151   extern void setError_dh (char *msg, char *function, char *file, int line);
00152   extern void printErrorMsg (FILE * fp);
00153 
00154 #ifndef MPI_MAX_ERROR_STRING
00155 #define MPI_MAX_ERROR_STRING 256
00156 #endif
00157 
00158 #define MSG_BUF_SIZE_DH MAX(1024, MPI_MAX_ERROR_STRING)
00159   extern char msgBuf_dh[MSG_BUF_SIZE_DH];
00160 
00161 /* Each processor (may) open a logfile.
00162  * The bools are switches for controlling the amount of informational 
00163  * output, and where it gets written to.  Function trace logging is only 
00164  * enabled when compiled with the debugging (-g) option.
00165  */
00166   extern void openLogfile_dh (int argc, char *argv[]);
00167   extern void closeLogfile_dh ();
00168   extern bool logInfoToStderr;
00169   extern bool logInfoToFile;
00170   extern bool logFuncsToStderr;
00171   extern bool logFuncsToFile;
00172   extern void Error_dhStartFunc (char *function, char *file, int line);
00173   extern void Error_dhEndFunc (char *function);
00174   extern void dh_StartFunc (char *function, char *file, int line,
00175                 int priority);
00176   extern void dh_EndFunc (char *function, int priority);
00177   extern void printFunctionStack (FILE * fp);
00178 
00179   extern void EuclidInitialize (int argc, char *argv[], char *help);    /* instantiates global objects */
00180   extern void EuclidFinalize ();    /* deletes global objects */
00181   extern bool EuclidIsInitialized ();
00182   extern void printf_dh (char *fmt, ...);
00183   extern void fprintf_dh (FILE * fp, char *fmt, ...);
00184 
00185   /* echo command line invocation to stdout.
00186      The "prefix" string is for grepping; it may be NULL.
00187    */
00188   extern void echoInvocation_dh (MPI_Comm comm, char *prefix, int argc,
00189                  char *argv[]);
00190 
00191 #ifdef __cplusplus
00192 }
00193 #endif
00194 
00195 #endif
 All Classes Files Functions Variables Enumerations Friends