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

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

CHG: pushed PetscInitialize and Finalize phases into FemModel constructors and destructors.
MPI_Init and MPI_Finalize are still done in EnvironmentInit and EnvironmentFinalize.
This ensures that we split our communicators and run fully communicator oriented!

File size: 927 bytes
RevLine 
[13530]1/*!\file: EnvironmentInit.cpp
2 * \brief: initialize Petsc, MPI, you name it
3 */
[13532]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
[13691]9#include <stdio.h>
[13533]10#include "../include/include.h"
11#include "../toolkits/toolkits.h"
[13530]12
[13589]13COMM EnvironmentInit(int argc,char** argv){
[13530]14
[13691]15 /*Output*/
16 COMM comm = 0;
17
[13736]18 /*Initialize MPI environment: */
19 #if defined(_HAVE_MPI_)
[13530]20 MPI_Init(&argc,&argv);
[13691]21 comm = MPI_COMM_WORLD;
[13589]22 #else
[13691]23 comm = 1; //bogus number for comm, which does not exist anyway.
[13530]24 #endif
[13691]25
26 /*Print Banner*/
27 int my_rank = 0;
28 #ifdef _HAVE_MPI_
29 MPI_Comm_rank(comm,&my_rank);
[13530]30 #endif
[13691]31 if(!my_rank) printf("\n");
32 if(!my_rank) printf("Ice Sheet System Model (%s) version %s\n",PACKAGE_NAME,PACKAGE_VERSION);
33 if(!my_rank) printf("(website: %s contact: %s\n",PACKAGE_URL,PACKAGE_BUGREPORT);
34 if(!my_rank) printf("\n");
[13589]35
[13691]36 /*Return communicator*/
37 return comm;
[13530]38}
Note: See TracBrowser for help on using the repository browser.