Last change
on this file since 14310 was 14310, checked in by Mathieu Morlighem, 12 years ago |
merged trunk-jpl and trunk for revision 14308
|
File size:
1.2 KB
|
Line | |
---|
1 | /*! \file IssmComm.cpp
|
---|
2 | * \brief file containing the methods for IssmComm.h
|
---|
3 | */
|
---|
4 |
|
---|
5 | #ifdef HAVE_CONFIG_H
|
---|
6 | #include <config.h>
|
---|
7 | #else
|
---|
8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | #include "./IssmComm.h"
|
---|
12 | #include "../include/types.h"
|
---|
13 | #include "../include/macros.h"
|
---|
14 | #include "../shared/Exceptions/exceptions.h"
|
---|
15 |
|
---|
16 | void IssmComm::SetComm(COMM incomm){ /*{{{*/
|
---|
17 |
|
---|
18 | /*A comm is provided, we are running in parallel (this is not a module)*/
|
---|
19 | parallel = true;
|
---|
20 | comm = incomm;
|
---|
21 |
|
---|
22 | }/*}}}*/
|
---|
23 | void IssmComm::SetComm(void){ /*{{{*/
|
---|
24 |
|
---|
25 | /*no comm provided, This is a matlab/python module*/
|
---|
26 | parallel = false;
|
---|
27 |
|
---|
28 | /*No need to initialise comm*/
|
---|
29 |
|
---|
30 | }/*}}}*/
|
---|
31 | COMM IssmComm::GetComm(){ /*{{{*/
|
---|
32 | if(!parallel) _error_("Cannot return comm in serial mode");
|
---|
33 | return comm;
|
---|
34 | }/*}}}*/
|
---|
35 | int IssmComm::GetRank(){ /*{{{*/
|
---|
36 |
|
---|
37 | int my_rank = 0;
|
---|
38 |
|
---|
39 | /*for matlab and python modules*/
|
---|
40 | if(!parallel) return my_rank;
|
---|
41 |
|
---|
42 | #ifdef _HAVE_MPI_
|
---|
43 | MPI_Comm_rank(comm,&my_rank);
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | return my_rank;
|
---|
47 |
|
---|
48 | }/*}}}*/
|
---|
49 | int IssmComm::GetSize(){ /*{{{*/
|
---|
50 |
|
---|
51 | int size = 1;
|
---|
52 |
|
---|
53 | /*for matlab and python modules*/
|
---|
54 | if(!parallel) return size;
|
---|
55 |
|
---|
56 | #ifdef _HAVE_MPI_
|
---|
57 | MPI_Comm_size(comm,&size);
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | return size;
|
---|
61 |
|
---|
62 | }/*}}}*/
|
---|
Note:
See
TracBrowser
for help on using the repository browser.