source: issm/trunk-jpl/src/c/solutions/EnvironmentInit.cpp@ 13589

Last change on this file since 13589 was 13589, checked in by Eric.Larour, 12 years ago

CHG: starting transition to model runs where the MPI_Comm is independent
of MPI_COMM_WORLD. To do so, we design a static class IssmComm, which
encapsulate the communicator for the FemModel. FemModel can set its communicator
using a SetStaticComm method.
Adapted EnvironmentInit to return the comm accordingly.
Also put PrintBanner inside the FemModel constructor, as it needs to know about the
communicator to print the banner.

File size: 694 bytes
Line 
1/*!\file: EnvironmentInit.cpp
2 * \brief: initialize Petsc, MPI, you name it
3 */
4#ifdef HAVE_CONFIG_H
5 #include <config.h>
6#else
7#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
8#endif
9#include "../include/include.h"
10#include "../toolkits/toolkits.h"
11
12COMM EnvironmentInit(int argc,char** argv){
13
14 /*Initialize environments: Petsc, MPI, etc...: */
15 #ifdef _HAVE_PETSC_
16 int ierr=PetscInitialize(&argc,&argv,(char*)0,"");
17 if(ierr) _error_("Could not initialize Petsc");
18 return MPI_COMM_WORLD;
19 #else
20 #ifdef _HAVE_MPI_
21 MPI_Init(&argc,&argv);
22 return MPI_COMM_WORLD;
23 #else
24 return 1; //return bogus number for comm, which does not exist anyway.
25 #endif
26 #endif
27
28
29}
Note: See TracBrowser for help on using the repository browser.