/[escript]/trunk/paso/src/Paso.c
ViewVC logotype

Diff of /trunk/paso/src/Paso.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 782 by bcumming, Tue Jul 18 00:47:47 2006 UTC revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
 /* $Id$ */  
1    
2    /* $Id$ */
3    
4  /*  /*******************************************************
5  ********************************************************************************   *
6  *               Copyright   2006 by ACcESS MNRF                                *   *           Copyright 2003-2007 by ACceSS MNRF
7  *                                                                              *   *       Copyright 2007 by University of Queensland
8  *                 http://www.access.edu.au                                     *   *
9  *           Primary Business: Queensland, Australia                            *   *                http://esscc.uq.edu.au
10  *     Licensed under the Open Software License version 3.0             *   *        Primary Business: Queensland, Australia
11  *        http://www.opensource.org/licenses/osl-3.0.php                        *   *  Licensed under the Open Software License version 3.0
12  ********************************************************************************   *     http://www.opensource.org/licenses/osl-3.0.php
13  */   *
14     *******************************************************/
15    
16  /**************************************************************/  /**************************************************************/
17    
# Line 24  Line 25 
25  /**************************************************************/  /**************************************************************/
26    
27  #include "Paso.h"  #include "Paso.h"
28    
29  #ifdef _OPENMP  #ifdef _OPENMP
30  #include <omp.h>  #include <omp.h>
31  #else  #endif
 #ifdef PASO_MPI  
32    
33    #ifdef PASO_MPI
34    #include "mpi_C.h"
35  #else  #else
36  #include <time.h>  #include <time.h>
37  #endif  #endif
 #endif  
38    
39  Paso_ErrorCodeType Paso_ErrorCode_=NO_ERROR;  Paso_ErrorCodeType Paso_ErrorCode_=NO_ERROR;
40  char Paso_ErrorMsg_[LenErrorMsg_MAX]={'\0'};  char Paso_ErrorMsg_[LenErrorMsg_MAX]={'\0'};
# Line 46  void Paso_resetError(void) { Line 48  void Paso_resetError(void) {
48  void Paso_setError(Paso_ErrorCodeType err,char* msg) {  void Paso_setError(Paso_ErrorCodeType err,char* msg) {
49    size_t lenMsg=strlen(msg);    size_t lenMsg=strlen(msg);
50    if (Paso_noError()) {    if (Paso_noError()) {
51    printf("error set = %d %s",err,msg);
52       Paso_ErrorCode_=err;       Paso_ErrorCode_=err;
53       strncpy(Paso_ErrorMsg_,msg,MIN(LenErrorMsg_MAX,lenMsg));       strncpy(Paso_ErrorMsg_,msg,MIN(LenErrorMsg_MAX,lenMsg));
54       Paso_ErrorMsg_[MIN(LenErrorMsg_MAX,lenMsg)]='\0';       Paso_ErrorMsg_[MIN(LenErrorMsg_MAX,lenMsg)]='\0';
# Line 95  Paso_ErrorCodeType Paso_getErrorType(voi Line 98  Paso_ErrorCodeType Paso_getErrorType(voi
98  char* Paso_getErrorMessage(void) {  char* Paso_getErrorMessage(void) {
99     return Paso_ErrorMsg_;     return Paso_ErrorMsg_;
100  }  }
   
 #ifdef PASO_MPI  
 /* checks that there is no error accross all processes in a communicator */  
 /* NOTE : does not make guarentee consistency of error string on each process */  
 bool_t Paso_MPI_noError( Paso_MPIInfo *mpi_info )  
 {  
   int errorLocal=0, errorGlobal=0;  
   
   errorLocal = (int)Paso_noError();  
   MPI_Allreduce( &errorLocal, &errorGlobal, 1, MPI_INT, MPI_LAND, mpi_info->comm  );  
   
     // take care of the case where the error was on another processor  
     if( errorLocal && !errorGlobal )  
         Paso_setError( PASO_MPI_ERROR, "Paso_MPI_noError() : there was an error on another MPI process" );  
   return errorGlobal;  
 }  
 #endif  
101  /**************************************************************/  /**************************************************************/

Legend:
Removed from v.782  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26