27 #ifndef util_Parallel_hpp
28 #define util_Parallel_hpp
33 #include <phdmesh_config.h>
38 #if defined( HAVE_MPI )
43 typedef MPI_Comm ParallelMachine ;
44 typedef MPI_Datatype ParallelDatatype ;
46 inline ParallelMachine parallel_machine_null() {
return MPI_COMM_NULL ; }
48 inline ParallelMachine parallel_machine_init(
int * argc ,
char *** argv )
50 MPI_Init( argc , argv );
51 return MPI_COMM_WORLD ;
54 inline void parallel_machine_finalize()
71 typedef int ParallelMachine ;
72 typedef int ParallelDatatype ;
74 inline ParallelMachine parallel_machine_null() {
return 0 ; }
76 inline ParallelMachine parallel_machine_init(
int * ,
char *** )
79 inline void parallel_machine_finalize()
92 double wall_dtime(
double & );
94 unsigned parallel_machine_size( ParallelMachine m );
96 unsigned parallel_machine_rank( ParallelMachine m );
98 void parallel_machine_barrier( ParallelMachine );
112 IdentProc(
unsigned i ,
unsigned p ) : ident(i), proc(p) {}
115 { ident = rhs.ident ; proc = rhs.proc ;
return *this ; }
117 bool operator == (
const IdentProc & rhs )
const
118 {
return ident == rhs.ident && proc == rhs.proc ; }
120 bool operator != (
const IdentProc & rhs )
const
121 {
return ident != rhs.ident || proc != rhs.proc ; }
123 bool operator < (
const IdentProc & rhs )
const
124 {
return ident != rhs.ident ? ident < rhs.ident : proc < rhs.proc ; }
126 bool operator > (
const IdentProc & rhs )
const
127 {
return rhs.operator<( *this ); }
129 bool operator <= (
const IdentProc & rhs )
const
130 {
return ! rhs.operator<( *this ); }
132 bool operator >= (
const IdentProc & rhs )
const
133 {
return ! this->operator<( rhs ); }