PLUTO
al_init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief ArrayLib Initialization routines
5 
6  ArrayLib Initialization routines
7 
8  \authors A. Malagoli (University of Chicago)
9 
10  \date Jul 17, 1999
11 */
12 /* ///////////////////////////////////////////////////////////////////// */
13 #include "al_hidden.h" /*I "al_hidden.h" I*/
14 
15 static int AL_initialized = AL_FALSE;
16 
17 /* ********************************************************************* */
18 int AL_Init(int *argc, char ***argv)
19 /*!
20  * Initialize the AL Tool. It contains a call to MPI_Init().
21  *
22  * \param [in] argc integer pointer to number of arguments
23  * \param [in] argv pointer to argv list
24  ********************************************************************* */
25 {
26  int myrank, nproc, errcode;
27  int flag;
28 
29  errcode = MPI_Initialized(&flag);
30 
31  if( !flag )
32  errcode = MPI_Init(argc, argv);
33 
34  MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
35  MPI_Comm_size(MPI_COMM_WORLD, &nproc);
36 
37 #ifdef DEBUG
38  printf("AL_Init: Called MPI_init from C: %d\n",errcode);
39 #endif
40 
41  /* Initialize the SZ pointers stack */
43 
44  /* Synchronize just in case */
45  MPI_Barrier(MPI_COMM_WORLD);
46 
48 
49  return errcode;
50 }
51 
52 /* ********************************************************************* */
54 /*! Test whether or not AL was initialized
55  *
56  * \return This function returns AL_TRUE if AL is initialized, AL_FALSE otherwise.
57  *********************************************************************** */
58 {
59  return AL_initialized;
60 }
61 
62 
int AL_Init(int *argc, char ***argv)
Definition: al_init.c:18
#define AL_TRUE
Definition: al_codes.h:28
static int AL_initialized
Definition: al_init.c:15
#define AL_FALSE
Definition: al_codes.h:29
Internal include file for the ArrayLib.
int AL_Init_stack_()
Definition: al_szptr_.c:33
int AL_Initialized()
Definition: al_init.c:53