Changeset 14290


Ignore:
Timestamp:
01/25/13 16:11:11 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added SetComm(void) for matlab and python module. There is now a flag 'parallel' in IssmComm so that we always no wether MPI should be invoked

Location:
issm/trunk-jpl/src/c/classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/IssmComm.cpp

    r14287 r14290  
    1313
    1414void IssmComm::SetComm(COMM incomm){ /*{{{*/
    15         comm=incomm;
     15
     16        /*A comm is provided, we are running in parallel (this is not a module)*/
     17        parallel = true;
     18        comm     = incomm;
     19
     20}/*}}}*/
     21void IssmComm::SetComm(void){ /*{{{*/
     22
     23        /*no comm provided, This is a matlab/python module*/
     24        parallel = true;
     25        comm     = incomm;
     26
    1627}/*}}}*/
    1728COMM IssmComm::GetComm(){  /*{{{*/
     29        if(!parallel) _error_("Cannot return comm in serial mode");
    1830        return comm;
    1931}/*}}}*/
    2032int IssmComm::GetRank(){  /*{{{*/
     33
    2134        int my_rank = 0;
     35       
     36        /*for matlab and python modules*/
     37        if(!parallel) return my_rank;
    2238
    23        
    2439        #ifdef _HAVE_MPI_
    2540        MPI_Comm_rank(comm,&my_rank);
    26         #else
    27         /*for matlab and python modules, comm == -1*/
    28         if((int)comm==-1) return my_rank;
    2941        #endif
    3042
     
    3648        int size = 1;
    3749
     50        /*for matlab and python modules*/
     51        if(!parallel) return size;
     52
    3853        #ifdef _HAVE_MPI_
    3954        MPI_Comm_size(comm,&size);
  • issm/trunk-jpl/src/c/classes/IssmComm.h

    r13589 r14290  
    2121        private:
    2222                static COMM comm;
     23                static bool parallel;
    2324
    2425        public:
    2526                static void SetComm(COMM incomm);
    26                 static COMM GetComm();
    27                 static int GetRank();
    28                 static int GetSize();
     27                static void SetComm(void);
     28                static COMM GetComm(void);
     29                static int GetRank(void);
     30                static int GetSize(void);
    2931};
    3032
Note: See TracChangeset for help on using the changeset viewer.