/*! \file IssmComm.cpp * \brief file containing the methods for IssmComm.h */ #ifdef HAVE_CONFIG_H #include #else #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" #endif #include "./IssmComm.h" #include "../include/types.h" #include "../include/macros.h" #include "../shared/Exceptions/exceptions.h" void IssmComm::SetComm(COMM incomm){ /*{{{*/ /*A comm is provided, we are running in parallel (this is not a module)*/ parallel = true; comm = incomm; }/*}}}*/ void IssmComm::SetComm(void){ /*{{{*/ /*no comm provided, This is a matlab/python module*/ parallel = false; /*No need to initialise comm*/ }/*}}}*/ COMM IssmComm::GetComm(){ /*{{{*/ if(!parallel) _error_("Cannot return comm in serial mode"); return comm; }/*}}}*/ int IssmComm::GetRank(){ /*{{{*/ int my_rank = 0; /*for matlab and python modules*/ if(!parallel) return my_rank; #ifdef _HAVE_MPI_ MPI_Comm_rank(comm,&my_rank); #endif return my_rank; }/*}}}*/ int IssmComm::GetSize(){ /*{{{*/ int size = 1; /*for matlab and python modules*/ if(!parallel) return size; #ifdef _HAVE_MPI_ MPI_Comm_size(comm,&size); #endif return size; }/*}}}*/