30 #ifndef OOMPH_COMMUNICATOR_CLASS_HEADER 31 #define OOMPH_COMMUNICATOR_CLASS_HEADER 35 #include <oomph-lib-config.h> 68 const bool& owns_mpi_comm =
false)
72 Comm = mpi_communicator;
91 if (communicator.serial_communicator())
97 Comm = communicator.mpi_comm();
110 if (communicator_pt->serial_communicator())
116 Comm = communicator_pt->mpi_comm();
133 MPI_Comm_free(&
Comm);
144 MPI_Comm_free(&
Comm);
147 if (communicator.serial_communicator())
154 Comm = communicator.mpi_comm();
170 MPI_Comm_size(
Comm,&n_proc);
189 MPI_Comm_rank(
Comm,&My_rank);
213 MPI_Comm_compare(
Comm,other_comm.mpi_comm(),&flag);
214 if (flag == MPI_IDENT)
228 return !(*
this == other_comm);
239 std::ostringstream error_message_stream;
241 <<
"Attempted to split a serial communicator.";
243 OOMPH_CURRENT_FUNCTION,
244 OOMPH_EXCEPTION_LOCATION);
252 MPI_Comm* mpi_comm_pt =
new MPI_Comm;
255 MPI_Comm_split(
Comm,color,key,mpi_comm_pt);
263 return split_comm_pt;
270 MPI_Comm mpi_comm()
const 275 std::ostringstream error_message_stream;
277 <<
"Requested the MPI_Comm object for a serial communicator.";
279 OOMPH_CURRENT_FUNCTION,
280 OOMPH_EXCEPTION_LOCATION);
288 bool serial_communicator()
const 299 unsigned long n_long;
300 if (this->my_rank()==source)
305 n=
static_cast<int>(n_long);
309 MPI_Bcast(&n,1,MPI_INT,source,this->mpi_comm());
312 if (this->my_rank()!=source)
318 MPI_Bcast(&x[0],n,MPI_INT,source,this->mpi_comm());
327 unsigned long n_long;
328 if (this->my_rank()==source)
333 n=
static_cast<int>(n_long);
337 MPI_Bcast(&n,1,MPI_INT,source,this->mpi_comm());
340 if (this->my_rank()!=source)
346 MPI_Bcast(&x[0],n,MPI_DOUBLE,source,this->mpi_comm());
bool Serial_communicator
boolean to indicate if this communicator is for serial problems. This is true when serial codes are c...
bool Owns_mpi_comm
boolean indiacting whether this communicator owns the underlying MPI_Comm - if so the destructor will...
MPI_Comm Comm
the MPI_Comm communicator
OomphCommunicator(const MPI_Comm mpi_communicator, const bool &owns_mpi_comm=false)
OomphCommunicator()
Serial constructor.
Class for dense matrices, storing all the values of the matrix as a pointer to a pointer with assorte...
void split(const DoubleVector &in_vector, Vector< DoubleVector *> &out_vector_pt)
Split a DoubleVector into the out DoubleVectors. Let vec_A be the in Vector, and let vec_B and vec_C ...
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...