PLUTO
al_sz_init.c File Reference

Allocate and initialize a distributed array descriptor. More...

#include "al_hidden.h"
Include dependency graph for al_sz_init.c:

Go to the source code of this file.

Functions

int AL_Sz_init (MPI_Comm comm, int *sz_ptr)
 

Variables

SZsz_stack [AL_MAX_ARRAYS]
 
int stack_ptr [AL_MAX_ARRAYS]
 

Detailed Description

Allocate and initialize a distributed array descriptor.

Author
A. Malagoli (University of Chicago)
Date
Jul 28, 1999

Definition in file al_sz_init.c.

Function Documentation

int AL_Sz_init ( MPI_Comm  comm,
int *  sz_ptr 
)

Allocate and initialize a distributed array descriptor

Parameters
[in]commMPI communicator the array is associated with
[out]sz_ptrInteger pointer to the array descriptor
Returns
AL_SUCCESS if the array descriptor is correct initialized, AL_FAILURE otherwise.

Definition at line 22 of file al_sz_init.c.

32 {
33  int myrank, nproc;
34  register int i;
35 
36  /*
37  If this process does not belong to the communicator,
38  or if the communicator is MPI_COMM_NULL, return a
39  AL_UNDEFINED pointer
40  */
41  if( comm == MPI_COMM_NULL ) {
42  *sz_ptr = AL_UNDEFINED;
43  return AL_FAILURE;
44  }
45 
46  /*
47  Allocate the SZ structure
48  */
49  *sz_ptr = AL_Allocate_sz_();
50 
51  MPI_Comm_rank(comm, &myrank);
52  MPI_Comm_size(comm, &nproc);
53 
54  /*
55  Set the initial entries
56  */
57  sz_stack[*sz_ptr]->compiled = AL_FALSE; /* The array is not compiled yet */
58  sz_stack[*sz_ptr]->comm = comm;
59  sz_stack[*sz_ptr]->rank = myrank;
60  sz_stack[*sz_ptr]->size = nproc;
61 
62  /*
63  Set some defaults
64  */
65  sz_stack[*sz_ptr]->type = MPI_DOUBLE;
66  for(i=0;i<AL_MAX_DIM;i++){
67  sz_stack[*sz_ptr]->isparallel[i] = AL_TRUE;
68  sz_stack[*sz_ptr]->isperiodic[i] = AL_TRUE;
69  sz_stack[*sz_ptr]->isstaggered[i] = AL_FALSE;
70  sz_stack[*sz_ptr]->larrdim_gp[i]=1;
71  sz_stack[*sz_ptr]->larrdim[i]=1;
72  sz_stack[*sz_ptr]->arrdim[i]=1;
73  sz_stack[*sz_ptr]->beg[i]=0;
74  sz_stack[*sz_ptr]->end[i]=0;
75  sz_stack[*sz_ptr]->lbeg[i]=0;
76  sz_stack[*sz_ptr]->lend[i]=0;
77  sz_stack[*sz_ptr]->bg[i]=0;
78  sz_stack[*sz_ptr]->eg[i]=0;
79  sz_stack[*sz_ptr]->offset[i]=1;
80  sz_stack[*sz_ptr]->stride[i]=1;
81  }
82 
83  sz_stack[*sz_ptr]->begs = NULL;
84  sz_stack[*sz_ptr]->ends = NULL;
85 
86  return (int) AL_SUCCESS;
87 }
int isperiodic[AL_MAX_DIM]
Definition: al_hidden.h:80
#define AL_MAX_DIM
Definition: al_codes.h:18
int end[AL_MAX_DIM]
Definition: al_hidden.h:60
int isparallel[AL_MAX_DIM]
Definition: al_hidden.h:78
int AL_Allocate_sz_()
Definition: al_szptr_.c:58
int offset[AL_MAX_DIM]
Definition: al_hidden.h:76
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_TRUE
Definition: al_codes.h:28
int * begs
Definition: al_hidden.h:63
int arrdim[AL_MAX_DIM]
Definition: al_hidden.h:53
int larrdim_gp[AL_MAX_DIM]
Definition: al_hidden.h:56
int larrdim[AL_MAX_DIM]
Definition: al_hidden.h:54
int rank
Definition: al_hidden.h:44
int * ends
Definition: al_hidden.h:63
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int stride[AL_MAX_DIM]
Definition: al_hidden.h:77
int bg[AL_MAX_DIM]
Definition: al_hidden.h:72
int beg[AL_MAX_DIM]
Definition: al_hidden.h:58
int isstaggered[AL_MAX_DIM]
Definition: al_hidden.h:82
int eg[AL_MAX_DIM]
Definition: al_hidden.h:74
#define AL_FAILURE
Definition: al_codes.h:33
int size
Definition: al_hidden.h:45
int i
Definition: analysis.c:2
MPI_Comm comm
Definition: al_hidden.h:47
MPI_Datatype type
Definition: al_hidden.h:40
#define AL_FALSE
Definition: al_codes.h:29
#define AL_UNDEFINED
Definition: al_codes.h:127
int compiled
Definition: al_hidden.h:39
int lbeg[AL_MAX_DIM]
Definition: al_hidden.h:68
int lend[AL_MAX_DIM]
Definition: al_hidden.h:70

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int stack_ptr[AL_MAX_ARRAYS]

Definition at line 26 of file al_szptr_.c.

SZ* sz_stack[AL_MAX_ARRAYS]

Definition at line 18 of file al_szptr_.c.