IFPACK Development
euclid_common.h
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2009) 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 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #ifndef COMMON_DH
00031 #define COMMON_DH
00032 
00033 #include <stdio.h>
00034 #include <stdlib.h>
00035 #include <string.h>
00036 #include <math.h>
00037 #include <limits.h>
00038 #include <stdarg.h>
00039 
00040 #define REAL_DH double
00041 
00042 /*-----------------------------------------------------------------------
00043  * compile-time dependent includes from other libraries.
00044  * maintainer's note: this is the only place where non-Euclid
00045  * files are included.
00046  *-----------------------------------------------------------------------*/
00047 
00048 
00049 #include <mpi.h>
00050 
00051 
00052 /*-----------------------------------------------------------------------
00053  * Euclid includes
00054  *-----------------------------------------------------------------------*/
00055 
00056 #include "euclid_config.h"  /* contains various user-configurable settings;
00057                    edit this when building an interface with
00058                    other libraries.  
00059                  */
00060 
00061 #include "macros_dh.h"      /* macros for error checking, etc */
00062 
00063 /*----------------------------------------------------------- 
00064  *  Euclid classes 
00065  *-----------------------------------------------------------*/
00066 typedef struct _matgenfd *MatGenFD;
00067 typedef struct _subdomain_dh *SubdomainGraph_dh;
00068 typedef struct _timer_dh *Timer_dh;
00069 typedef struct _parser_dh *Parser_dh;
00070 typedef struct _timeLog_dh *TimeLog_dh;
00071 typedef struct _mem_dh *Mem_dh;
00072 typedef struct _mat_dh *Mat_dh;
00073 typedef struct _factor_dh *Factor_dh;
00074 typedef struct _vec_dh *Vec_dh;
00075 typedef struct _numbering_dh *Numbering_dh;
00076 typedef struct _hash_dh *Hash_dh;
00077 typedef struct _hash_i_dh *Hash_i_dh;
00078 typedef struct _mpi_interface_dh *Euclid_dh;
00079 typedef struct _sortedList_dh *SortedList_dh;
00080 typedef struct _extrows_dh *ExternalRows_dh;
00081 typedef struct _stack_dh *Stack_dh;
00082 typedef struct _queue_dh *Queue_dh;
00083 typedef struct _sortedset_dh *SortedSet_dh;
00084 
00085 /*
00086 typedef struct _localPerm_dh*       LocalPerm_dh;
00087 typedef struct _procGrid_dh*        ProcGrid_dh;
00088 typedef struct _globalPerm_dh*      GlobalPerm_dh;
00089 typedef struct _apply_dh*           Apply_dh;
00090 typedef struct _externalRows_dh*    ExternalRows_dh;
00091 */
00092 
00093 /*---------------------------------------------------------------------
00094  * misc.
00095  *---------------------------------------------------------------------*/
00096 
00097 
00098 #if defined(__cplusplus)
00099 #else
00100 typedef int bool;
00101 #define true   1
00102 #define false  0
00103 #endif
00104 
00105 /* ------------------------------------------------------------------
00106  * Globally scoped variables, error handling functions, etc.
00107  * These are all defined in /src/globalObjects.c 
00108  * ------------------------------------------------------------------*/
00109 extern Parser_dh parser_dh; /* for setting/getting runtime options */
00110 extern TimeLog_dh tlog_dh;  /* internal timing  functionality */
00111 extern Mem_dh mem_dh;       /* memory management */
00112 extern FILE *logFile;
00113 extern int np_dh;       /* number of processors and subdomains */
00114 extern int myid_dh;     /* rank of this processor (and subdomain) */
00115 extern MPI_Comm comm_dh;
00116 
00117 
00118 extern bool ignoreMe;       /* used to stop compiler complaints */
00119 extern int ref_counter;     /* for internal use only!  Reference counter
00120                    to ensure that global objects are not
00121                    destroyed when Euclid's destructor is called,
00122                    and more than one instance of Euclid has been
00123                    instantiated.
00124                  */
00125 
00126 
00127 /* Error and message handling.  These are accessed through
00128  * macros defined in "macros_dh.h"
00129  */
00130 extern bool errFlag_dh;
00131 
00132 #ifdef __cplusplus
00133 extern "C"
00134 {
00135 #endif
00136 
00137   extern void setInfo_dh (char *msg, char *function, char *file, int line);
00138   extern void setError_dh (char *msg, char *function, char *file, int line);
00139   extern void printErrorMsg (FILE * fp);
00140 
00141 #ifndef MPI_MAX_ERROR_STRING
00142 #define MPI_MAX_ERROR_STRING 256
00143 #endif
00144 
00145 #define MSG_BUF_SIZE_DH MAX(1024, MPI_MAX_ERROR_STRING)
00146   extern char msgBuf_dh[MSG_BUF_SIZE_DH];
00147 
00148 /* Each processor (may) open a logfile.
00149  * The bools are switches for controlling the amount of informational 
00150  * output, and where it gets written to.  Function trace logging is only 
00151  * enabled when compiled with the debugging (-g) option.
00152  */
00153   extern void openLogfile_dh (int argc, char *argv[]);
00154   extern void closeLogfile_dh ();
00155   extern bool logInfoToStderr;
00156   extern bool logInfoToFile;
00157   extern bool logFuncsToStderr;
00158   extern bool logFuncsToFile;
00159   extern void Error_dhStartFunc (char *function, char *file, int line);
00160   extern void Error_dhEndFunc (char *function);
00161   extern void dh_StartFunc (char *function, char *file, int line,
00162                 int priority);
00163   extern void dh_EndFunc (char *function, int priority);
00164   extern void printFunctionStack (FILE * fp);
00165 
00166   extern void EuclidInitialize (int argc, char *argv[], char *help);    /* instantiates global objects */
00167   extern void EuclidFinalize ();    /* deletes global objects */
00168   extern bool EuclidIsInitialized ();
00169   extern void printf_dh (char *fmt, ...);
00170   extern void fprintf_dh (FILE * fp, char *fmt, ...);
00171 
00172   /* echo command line invocation to stdout.
00173      The "prefix" string is for grepping; it may be NULL.
00174    */
00175   extern void echoInvocation_dh (MPI_Comm comm, char *prefix, int argc,
00176                  char *argv[]);
00177 
00178 #ifdef __cplusplus
00179 }
00180 #endif
00181 
00182 #endif
 All Classes Files Functions Variables Enumerations Friends