28 MPI_Comm_rank( MPI_COMM_WORLD, & return_val);
37 MPI_Comm_size( MPI_COMM_WORLD, & return_val);
58 int communicating_node;
60 MPI_Recv( &communicating_node, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status );
61 return communicating_node;
71 std::string return_val;
75 MPI_Recv( &
len, 1, MPI_INT, source,
tag, MPI_COMM_WORLD, & stat );
76 char * str =
new char[
len + 1 ];
78 MPI_Recv( str,
len, MPI_CHAR, source,
tag, MPI_COMM_WORLD, & stat );
79 return_val = std::string( str,
len );
87 std::string
const & message
92 int len( message.size() );
93 MPI_Send( &
len, 1, MPI_INT, destination,
tag, MPI_COMM_WORLD );
94 MPI_Send( const_cast< char * > (message.c_str()),
len, MPI_CHAR, destination,
tag, MPI_COMM_WORLD );
107 MPI_Recv( &return_val, 1, MPI_CHAR, source,
tag, MPI_COMM_WORLD, & stat );
118 MPI_Send( &message, 1, MPI_CHAR, destination,
tag, MPI_COMM_WORLD );
130 MPI_Recv( &return_val, 1, MPI_INT, source,
tag, MPI_COMM_WORLD, & stat );
143 MPI_Send( &message, 1, MPI_INT, destination,
tag, MPI_COMM_WORLD );
157 MPI_Recv( &
len, 1, MPI_INT, source,
tag, MPI_COMM_WORLD, & stat );
159 return_val.resize(
len );
160 int * intarray =
new int[
len ];
161 MPI_Recv( intarray,
len, MPI_INT, source,
tag, MPI_COMM_WORLD, & stat );
162 for (
int ii = 0;
ii <
len; ++
ii ) return_val[
ii + 1 ] = intarray[
ii ];
177 int len( message.size() );
178 MPI_Send( &
len, 1, MPI_INT, destination,
tag, MPI_COMM_WORLD );
180 MPI_Send( const_cast< int * > (&message[1]),
len, MPI_INT, destination,
tag, MPI_COMM_WORLD );
190 double return_val(0);
193 MPI_Recv( &return_val, 1, MPI_DOUBLE, source,
tag, MPI_COMM_WORLD, & stat );
206 MPI_Send( &message, 1, MPI_DOUBLE, destination,
tag, MPI_COMM_WORLD );
220 MPI_Recv( &
len, 1, MPI_INT, source,
tag, MPI_COMM_WORLD, & stat );
222 return_val.resize(
len );
223 double * doublearray =
new double[
len ];
224 MPI_Recv( doublearray,
len, MPI_DOUBLE, source,
tag, MPI_COMM_WORLD, & stat );
225 for (
int ii = 0;
ii <
len; ++
ii ) return_val[
ii + 1 ] = doublearray[
ii ];
226 delete [] doublearray;
240 int len( message.size() );
241 MPI_Send( &
len, 1, MPI_INT, destination,
tag, MPI_COMM_WORLD );
243 MPI_Send( const_cast< double * > (&message[1]),
len, MPI_DOUBLE, destination,
tag, MPI_COMM_WORLD );
248 #else // USEMPI is not used
294 std::string return_val;
302 std::string
const & message)
391 double return_val = 0;
void send_double_to_node(int destination, double message)
int receive_integer_from_node(int source)
Use MPI to receive a single integer from a particular node.
static double receive_double_from_node(int source)
static void send_integer_to_node(int destination, int message)
void send_doubles_to_node(int destination, utility::vector1< double > const &message)
static bool simulate_mpi()
static void send_double_to_node(int destination, double message)
static vector1< double > receive_doubles_from_node(int source)
static int receive_integer_from_anyone()
static std::string receive_string_from_node(int source)
void send_string_to_node(int destination, std::string const &message)
static char receive_char_from_node(int source)
Fstring::size_type len(Fstring const &s)
Length.
static void send_integers_to_node(int destination, vector1< int > const &message)
void send_integer_to_node(int destination, int message)
static void send_char_to_node(int destination, char message)
utility::vector1< int > receive_integers_from_node(int source)
Use MPI to receive a vector of integers from a particular node.
char receive_char_from_node(int source)
Use MPI to receive a single char from a particular node.
int receive_integer_from_anyone()
Use MPI to wait until some node sends an integer – usually its own mpi_rank so that it can send furt...
static void send_string_to_node(int destination, std::string const &message)
static int receive_integer_from_node(int source)
void send_integers_to_node(int destination, utility::vector1< int > const &message)
utility::vector1< double > receive_doubles_from_node(int source)
Use MPI to receive a vector of doubles from a particular node.
std::string receive_string_from_node(int source)
Use MPI to receive a string from a particular node.
static vector1< int > receive_integers_from_node(int source)
void send_char_to_node(int destination, char message)
rule< Scanner, tag_closure::context_t > tag
double receive_double_from_node(int source)
Use MPI to receive a single double from a particular node.
static void send_doubles_to_node(int destination, vector1< double > const &message)