/* -*- Mode: C++; c-basic-offset:4 ; -*- */ /* * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. * * This file is automatically generated by buildiface -nosep * DO NOT EDIT */ /* style: c++ header */ #ifdef MPI #error "You cannot define MPI; that name is reserved for the MPI namespace" #endif // There is a name conflict between stdio.h and the MPI C++ binding // with respect to the names SEEK_SET, SEEK_CUR, and SEEK_END. MPI // wants these in the MPI namespace, but stdio.h will #define these // to integer values. #undef'ing these can cause obscure problems // with other include files (such as iostream), so we instead use // #error to indicate a fatal error. Users can either #undef // the names before including mpi.h or include mpi.h *before* stdio.h // or iostream. #ifndef MPICH_IGNORE_CXX_SEEK #ifdef SEEK_SET #error "SEEK_SET is #defined but must not be for the C++ binding of MPI" //#undef SEEK_SET #endif #ifdef SEEK_CUR #error "SEEK_CUR is #defined but must not be for the C++ binding of MPI" //#undef SEEK_CUR #endif #ifdef SEEK_END //#undef SEEK_END #error "SEEK_END is #defined but must not be for the C++ binding of MPI" #endif #endif namespace MPI { #if 1 #define MPIX_CALL( fnc ) \ {int err; err = fnc ; if (err) throw Exception(err);} #else #define MPIX_CALL( fnc ) (void)fnc #endif // Typedefs for basic int types typedef MPI_Offset Offset; typedef MPI_Aint Aint; typedef MPI_Fint Fint; // Forward class declarations class Comm; class Nullcomm; class Intercomm; class Intracomm; class Cartcomm; class Graphcomm; extern int Detach_buffer( void *&v1 ) ; extern bool Is_initialized( void ) ; extern void Get_processor_name( char * v1, int &v2 ) ; extern void Get_error_string( int v1, char * v2, int &v3 ) ; extern void Compute_dims( int v1, int v2, int * v3 ) ; extern void Get_version( int &v1, int &v2 ) ; extern void Finalize( void ) ; extern void Pcontrol( const int v1, ... ) ; extern void Attach_buffer( void* v1, int v2 ) ; extern int Get_error_class( int v1 ) ; class Exception { protected: int the_real_exception; public: // new/delete inline Exception(int obj) : the_real_exception(obj) {} inline Exception(void) : the_real_exception(0) {} virtual ~Exception() {} // copy/assignment Exception(const Exception &obj) : the_real_exception(obj.the_real_exception){} Exception& operator=(const Exception &obj) { the_real_exception = obj.the_real_exception; return *this; } // logical bool operator== (const Exception &obj) { return (the_real_exception == obj.the_real_exception); } bool operator!= (const Exception &obj) { return (the_real_exception != obj.the_real_exception); } // C/C++ cast and assignment inline operator int*() { return &the_real_exception; } inline operator int() const { return the_real_exception; } Exception& operator=(const int& obj) { the_real_exception = obj; return *this; } protected: char the_error_message[MPI_MAX_ERROR_STRING]; public: int Get_error_code(void) { return the_real_exception; } int Get_error_class(void) { return MPI::Get_error_class(the_real_exception); } const char *Get_error_string(void) { int len; MPI_Error_string(the_real_exception, the_error_message, &len); return the_error_message; } }; class Datatype { friend class Comm; friend class Status; friend class Intracomm; friend class Intercomm; friend class Win; friend class File; protected: MPI_Datatype the_real_datatype; public: // new/delete inline Datatype(MPI_Datatype obj) : the_real_datatype(obj) {} inline Datatype(void) : the_real_datatype(MPI_DATATYPE_NULL) {} virtual ~Datatype() {} // copy/assignment Datatype(const Datatype &obj) : the_real_datatype(obj.the_real_datatype){} Datatype& operator=(const Datatype &obj) { the_real_datatype = obj.the_real_datatype; return *this; } // logical bool operator== (const Datatype &obj) { return (the_real_datatype == obj.the_real_datatype); } bool operator!= (const Datatype &obj) { return (the_real_datatype != obj.the_real_datatype); } // C/C++ cast and assignment inline operator MPI_Datatype*() { return &the_real_datatype; } inline operator MPI_Datatype() const { return the_real_datatype; } Datatype& operator=(const MPI_Datatype& obj) { the_real_datatype = obj; return *this; } virtual void Commit( void ) { MPIX_CALL( MPI_Type_commit( (MPI_Datatype *) &the_real_datatype )); } virtual void Free( void ) { MPIX_CALL( MPI_Type_free( (MPI_Datatype *) &the_real_datatype )); } virtual Datatype Create_indexed( int v1, const int * v2, const int * v3 ) const { Datatype v5; MPIX_CALL( MPI_Type_indexed( v1, (int *)v2, (int *)v3, (MPI_Datatype) the_real_datatype, &(v5.the_real_datatype) )); return v5; } virtual Datatype Create_contiguous( int v1 ) const { Datatype v3; MPIX_CALL( MPI_Type_contiguous( v1, (MPI_Datatype) the_real_datatype, &(v3.the_real_datatype) )); return v3; } virtual Datatype Create_vector( int v1, int v2, int v3 ) const { Datatype v5; MPIX_CALL( MPI_Type_vector( v1, v2, v3, (MPI_Datatype) the_real_datatype, &(v5.the_real_datatype) )); return v5; } static Datatype Create_struct( int v1, int v2[], MPI_Aint v3[], const Datatype v4[] ) { Datatype v5; MPI_Datatype *l4 = new MPI_Datatype[v1]; { int i4; for (i4=0;i4