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

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

BUG: fixed petsc initialization (needed to include config.h)

File size: 733 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#include "../include/globals.h"
12
13void EnvironmentInit(int argc,char** argv){
14
15 /*Initialize environments: Petsc, MPI, etc...: */
16 #ifdef _HAVE_PETSC_
17 int ierr=PetscInitialize(&argc,&argv,(char*)0,"");
18 if(ierr) _error_("Could not initialize Petsc");
19 #else
20 #ifdef _HAVE_MPI_
21 MPI_Init(&argc,&argv);
22 #endif
23 #endif
24
25 /*Size and rank: */
26 #ifdef _HAVE_MPI_
27 MPI_Comm_rank(MPI_COMM_WORLD,&my_rank);
28 MPI_Comm_size(MPI_COMM_WORLD,&num_procs);
29 #endif
30}
Note: See TracBrowser for help on using the repository browser.