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

Last change on this file since 13691 was 13691, checked in by Mathieu Morlighem, 12 years ago

CHG: PrintBanner is now done by EnvironmentInit instead of FemModel so that it is printed only once

File size: 1.1 KB
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 <stdio.h>
10#include "../include/include.h"
11#include "../toolkits/toolkits.h"
12
13COMM EnvironmentInit(int argc,char** argv){
14
15 /*Output*/
16 COMM comm = 0;
17
18 /*Initialize environments: Petsc, MPI, etc...: */
19 #if defined (_HAVE_PETSC_)
20 int ierr=PetscInitialize(&argc,&argv,(char*)0,"");
21 if(ierr) _error_("Could not initialize Petsc");
22 comm = MPI_COMM_WORLD;
23 #elif defined(_HAVE_MPI_)
24 MPI_Init(&argc,&argv);
25 comm = MPI_COMM_WORLD;
26 #else
27 comm = 1; //bogus number for comm, which does not exist anyway.
28 #endif
29
30 /*Print Banner*/
31 int my_rank = 0;
32 #ifdef _HAVE_MPI_
33 MPI_Comm_rank(comm,&my_rank);
34 #endif
35 if(!my_rank) printf("\n");
36 if(!my_rank) printf("Ice Sheet System Model (%s) version %s\n",PACKAGE_NAME,PACKAGE_VERSION);
37 if(!my_rank) printf("(website: %s contact: %s\n",PACKAGE_URL,PACKAGE_BUGREPORT);
38 if(!my_rank) printf("\n");
39
40 /*Return communicator*/
41 return comm;
42}
Note: See TracBrowser for help on using the repository browser.