19 void send<bool>(MPI::Comm& comm,
bool& data,
int dest,
int tag)
21 int value = data ? 1 : 0;
22 send<int>(comm, value, dest, tag);
26 void recv<bool>(MPI::Comm& comm,
bool& data,
int source,
int tag)
29 recv<int>(comm, value, source, tag);
30 data = value ?
true :
false;
37 int rank = comm.Get_rank();
40 bcast<int>(comm, value, root);
42 data = value ?
true :
false;
48 void send<std::string>(MPI::Comm& comm, std::string& data,
int dest,
int tag)
52 int count = data.size() + 1;
53 send<int>(comm, count, dest, tag);
56 char* cstr =
new char[count];
57 strcpy(cstr, data.c_str());
58 send<char>(comm, cstr, count, dest, tag);
64 void recv<std::string>(MPI::Comm& comm, std::string& data,
int source,
int tag)
69 recv<int>(comm, count, source, tag);
72 char* cstr =
new char[count];
73 recv<char>(comm, cstr, count, source, tag);
80 void bcast<std::string>(MPI::Intracomm& comm, std::string& data,
int root)
82 int rank = comm.Get_rank();
87 count = data.size() + 1;
88 bcast<int>(comm, count, root);
91 char* cstr =
new char[count];
93 strcpy(cstr, data.c_str());
94 bcast<char>(comm, cstr, count, root);
void send< bool >(MPI::Comm &comm, bool &data, int dest, int tag)
Explicit specialization of send for bool data.
void bcast< bool >(MPI::Intracomm &comm, bool &data, int root)
Explicit specialization of bcast for bool data.
Utility classes for scientific computation.
This file contains templates for global functions send<T>, recv<T> and bcast<T>.
void recv< bool >(MPI::Comm &comm, bool &data, int source, int tag)
Explicit specialization of recv for bool data.