// -*- c++ -*- // // $HEADER$ // // // ======== Cartcomm member functions ======== // inline MPI::Cartcomm::Cartcomm(const MPI_Comm& data) { int status; if (MPI::Is_initialized() && (data != MPI_COMM_NULL)) { (void)MPI_Topo_test(data, &status) ; if (status == MPI_CART) mpi_comm = data; else mpi_comm = MPI_COMM_NULL; } else { mpi_comm = data; } } // // Groups, Contexts, and Communicators // inline MPI::Cartcomm MPI::Cartcomm::Dup() const { MPI_Comm newcomm; (void)MPI_Comm_dup(mpi_comm, &newcomm); return newcomm; } // // Process Topologies // inline int MPI::Cartcomm::Get_dim() const { int ndims; (void)MPI_Cartdim_get(mpi_comm, &ndims); return ndims; } inline void MPI::Cartcomm::Get_topo(int maxdims, int dims[], bool periods[], int coords[]) const { int *int_periods = new int [maxdims]; int i; for (i=0; i