Rev | Line | |
---|
[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] | 13 | COMM EnvironmentInit(int argc,char** argv){
|
---|
[13530] | 14 |
|
---|
[13691] | 15 | /*Output*/
|
---|
| 16 | COMM comm = 0;
|
---|
| 17 |
|
---|
[13530] | 18 | /*Initialize environments: Petsc, MPI, etc...: */
|
---|
[13691] | 19 | #if defined (_HAVE_PETSC_)
|
---|
[13533] | 20 | int ierr=PetscInitialize(&argc,&argv,(char*)0,"");
|
---|
[13530] | 21 | if(ierr) _error_("Could not initialize Petsc");
|
---|
[13691] | 22 | comm = MPI_COMM_WORLD;
|
---|
| 23 | #elif defined(_HAVE_MPI_)
|
---|
[13530] | 24 | MPI_Init(&argc,&argv);
|
---|
[13691] | 25 | comm = MPI_COMM_WORLD;
|
---|
[13589] | 26 | #else
|
---|
[13691] | 27 | comm = 1; //bogus number for comm, which does not exist anyway.
|
---|
[13530] | 28 | #endif
|
---|
[13691] | 29 |
|
---|
| 30 | /*Print Banner*/
|
---|
| 31 | int my_rank = 0;
|
---|
| 32 | #ifdef _HAVE_MPI_
|
---|
| 33 | MPI_Comm_rank(comm,&my_rank);
|
---|
[13530] | 34 | #endif
|
---|
[13691] | 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");
|
---|
[13589] | 39 |
|
---|
[13691] | 40 | /*Return communicator*/
|
---|
| 41 | return comm;
|
---|
[13530] | 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.