PLUTO
al_sz_get.c File Reference

Miscellaneous functions to obtain informations about the properties of the distributed array. More...

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

Go to the source code of this file.

Functions

int AL_Get_size (int isz, int *size)
 
int AL_Get_rank (int isz, int *rank)
 
int AL_Get_comm (int isz, MPI_Comm *comm)
 
int AL_Get_cart_comm (int isz, MPI_Comm *cart_comm)
 
int AL_Get_dimensions (int isz, int *ndim)
 
int AL_Get_type (int isz, AL_Datatype *type)
 
int AL_Get_type_size (int isz, int *tsize)
 
int AL_Get_buffsize (int sz_ptr, int *buffsize)
 
int AL_Get_global_dim (int isz, int *gdims)
 
int AL_Get_local_dim (int isz, int *ldims)
 
int AL_Get_local_dim_gp (int sz_ptr, int *ldims_gp)
 
int AL_Get_offsets (int sz_ptr, int *offset)
 
int AL_Get_stride (int sz_ptr, int *stride)
 
int AL_Get_cart_sizes (int isz, int *cart_sizes)
 
int AL_Get_parallel_dim (int isz, int *pardims)
 
int AL_Get_periodic_dim (int isz, int *periods)
 
int AL_Get_staggered_dim (int isz, int *stagger)
 
int AL_Get_ghosts (int isz, int *ghosts)
 
int AL_Get_lbounds (int isz, int *lbeg, int *lend, int *gp, int style)
 
int AL_Get_bounds (int isz, int *beg, int *end, int *gp, int style)
 
int AL_Get_gbounds (int isz, int *gbeg, int *gend, int *gp, int style)
 

Variables

SZsz_stack [AL_MAX_ARRAYS]
 
int stack_ptr [AL_MAX_ARRAYS]
 

Detailed Description

Miscellaneous functions to obtain informations about the properties of the distributed array.

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

Definition in file al_sz_get.c.

Function Documentation

int AL_Get_bounds ( int  isz,
int *  beg,
int *  end,
int *  gp,
int  style 
)

Get the global indexes for the local portion of a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]begArray of ndim integers containing the start points
[out]endArray of ndim integers containing the end points
[out]gpArray of ndim integers containing the ghost points
[in]styleIndex style: AL_C_INDEXES or AL_FORTRAN_INDEXES

Definition at line 707 of file al_sz_get.c.

717 {
718  register int i;
719  int ndim;
720  SZ *s;
721 
722  /*
723  Check that isz points to an allocated SZ
724  */
725  if( stack_ptr[isz] == AL_STACK_FREE ){
726  printf("AL_Get_gbounds: wrong SZ pointer\n");
727  return (int) AL_FAILURE;
728  }
729 
730  /*
731  Get the SZ structure isz is pointing at
732  */
733  s = sz_stack[isz];
734  ndim = s->ndim;
735  for(i=0;i<ndim;i++){
736  beg[i] = s->beg[i];
737  end[i] = s->end[i];
738  gp[i] = s->bg[i];
739  }
740 
741  return (int) AL_SUCCESS;
742 }
int end[AL_MAX_DIM]
Definition: al_hidden.h:60
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int bg[AL_MAX_DIM]
Definition: al_hidden.h:72
int beg[AL_MAX_DIM]
Definition: al_hidden.h:58
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43

Here is the caller graph for this function:

int AL_Get_buffsize ( int  sz_ptr,
int *  buffsize 
)

Get the local buffer size for a distributed array, including the number of elements of the ghsot regions.

Parameters
[in]sz_ptrInteger pointer to the input array descriptor
[out]buffsizeBuffer size [in number of elements]

Definition at line 242 of file al_sz_get.c.

250 {
251  int isz;
252  SZ *s;
253 
254  isz = sz_ptr;
255 
256  /*
257  Check that isz points to an allocated SZ
258  */
259  if( stack_ptr[isz] == AL_STACK_FREE ){
260  printf("AL_Get_buffsize: wrong SZ pointer\n");
261  return (int) AL_FAILURE;
262  }
263 
264  /*
265  Get the SZ structure isz is pointing at
266  */
267  s = sz_stack[isz];
268 
269  *buffsize = s->buffsize;
270 
271  return (int) AL_SUCCESS;
272 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
long int buffsize
Definition: al_hidden.h:52
Definition: al_hidden.h:38
int AL_Get_cart_comm ( int  isz,
MPI_Comm *  cart_comm 
)

Get the cartesian communicator for a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]cart_commPointer to cartesian communicator

Definition at line 117 of file al_sz_get.c.

124 {
125  SZ *s;
126 
127  /*
128  Check that isz points to an allocated SZ
129  */
130  if( stack_ptr[isz] == AL_STACK_FREE ){
131  printf("AL_Get_comm: wrong SZ pointer\n");
132  return (int) AL_FAILURE;
133  }
134 
135  /*
136  Get the SZ structure isz is pointing at
137  */
138  s = sz_stack[isz];
139 
140  *cart_comm = s->cart_comm;
141 
142  return (int) AL_SUCCESS;
143 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
MPI_Comm cart_comm
Definition: al_hidden.h:49
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
Definition: al_hidden.h:38

Here is the caller graph for this function:

int AL_Get_cart_sizes ( int  isz,
int *  cart_sizes 
)

Get the sizes of the cartesian communicator

Parameters
[in]iszInteger pointer to the input array descriptor
[out]cart_sizesArray of integers with cartesian sizes

Definition at line 494 of file al_sz_get.c.

501 {
502  register int i;
503  int ndim;
504  SZ *s;
505 
506  /*
507  Check that isz points to an allocated SZ
508  */
509  if( stack_ptr[isz] == AL_STACK_FREE ){
510  printf("AL_Get_cart_sizes: wrong SZ pointer\n");
511  return (int) AL_FAILURE;
512  }
513 
514  /*
515  Get the SZ structure isz is pointing at
516  */
517  s = sz_stack[isz];
518  ndim = s->ndim;
519  for(i=0;i<ndim;i++){
520  cart_sizes[i] = s->lsize[i];
521  }
522 
523  return (int) AL_SUCCESS;
524 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int lsize[AL_MAX_DIM]
Definition: al_hidden.h:90
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_comm ( int  isz,
MPI_Comm *  comm 
)

Get the communicator for a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]commPointer to communicator

Definition at line 87 of file al_sz_get.c.

94 {
95  SZ *s;
96 
97  /*
98  Check that isz points to an allocated SZ
99  */
100  if( stack_ptr[isz] == AL_STACK_FREE ){
101  printf("AL_Get_comm: wrong SZ pointer\n");
102  return (int) AL_FAILURE;
103  }
104 
105  /*
106  Get the SZ structure isz is pointing at
107  */
108  s = sz_stack[isz];
109 
110  *comm = s->comm;
111 
112  return (int) AL_SUCCESS;
113 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
MPI_Comm comm
Definition: al_hidden.h:47
Definition: al_hidden.h:38
int AL_Get_dimensions ( int  isz,
int *  ndim 
)

Get the dimensions of the distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]ndimPointer to integer number of dimensions

Definition at line 148 of file al_sz_get.c.

155 {
156  SZ *s;
157 
158  /*
159  Check that isz points to an allocated SZ
160  */
161  if( stack_ptr[isz] == AL_STACK_FREE ){
162  printf("AL_Get_dimensions: wrong SZ pointer\n");
163  return (int) AL_FAILURE;
164  }
165 
166  /*
167  Get the SZ structure isz is pointing at
168  */
169  s = sz_stack[isz];
170 
171  *ndim = s->ndim;
172 
173  return (int) AL_SUCCESS;
174 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_gbounds ( int  isz,
int *  gbeg,
int *  gend,
int *  gp,
int  style 
)

Get the global bounds of the global array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]gbegArray of ndim integers containing the start points
[out]gendArray of ndim integers containing the end points
[out]gpArray of ndim integers containing the ghost points
[in]styleIndex style: AL_C_INDEXES or AL_FORTRAN_INDEXES

Definition at line 746 of file al_sz_get.c.

756 {
757  register int i;
758  int ndim;
759  SZ *s;
760 
761  /*
762  Check that isz points to an allocated SZ
763  */
764  if( stack_ptr[isz] == AL_STACK_FREE ){
765  printf("AL_Get_gbounds: wrong SZ pointer\n");
766  return (int) AL_FAILURE;
767  }
768 
769  /*
770  Get the SZ structure isz is pointing at
771  */
772  s = sz_stack[isz];
773  ndim = s->ndim;
774  for(i=0;i<ndim;i++){
775  gbeg[i] = s->bg[i];
776  gend[i] = s->arrdim[i]+s->bg[i]-1;
777  gp[i] = s->bg[i];
778  }
779 
780  return (int) AL_SUCCESS;
781 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int arrdim[AL_MAX_DIM]
Definition: al_hidden.h:53
int bg[AL_MAX_DIM]
Definition: al_hidden.h:72
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43

Here is the caller graph for this function:

int AL_Get_ghosts ( int  isz,
int *  ghosts 
)

Get the ghost points of the distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]ghostArray of integers with size of ghost points in each dimension

Definition at line 633 of file al_sz_get.c.

641 {
642  register int i;
643  int ndim;
644  SZ *s;
645 
646  /*
647  Check that isz points to an allocated SZ
648  */
649  if( stack_ptr[isz] == AL_STACK_FREE ){
650  printf("AL_Get_ghosts: wrong SZ pointer\n");
651  return (int) AL_FAILURE;
652  }
653 
654  /*
655  Get the SZ structure isz is pointing at
656  */
657  s = sz_stack[isz];
658  ndim = s->ndim;
659  for(i=0;i<ndim;i++){
660  ghosts[i] = s->bg[i];
661  }
662 
663  return (int) AL_SUCCESS;
664 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int bg[AL_MAX_DIM]
Definition: al_hidden.h:72
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_global_dim ( int  isz,
int *  gdims 
)

Get the global dimensions of the distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]gdimsArray of integers with global dimensions

Definition at line 276 of file al_sz_get.c.

283 {
284  register int i;
285  int ndim;
286  SZ *s;
287 
288  /*
289  Check that isz points to an allocated SZ
290  */
291  if( stack_ptr[isz] == AL_STACK_FREE ){
292  printf("AL_Get_global_dim: wrong SZ pointer\n");
293  return (int) AL_FAILURE;
294  }
295 
296  /*
297  Get the SZ structure isz is pointing at
298  */
299  s = sz_stack[isz];
300 
301  ndim = s->ndim;
302  for(i=0;i<ndim;i++){ gdims[i] = s->arrdim[i];}
303 
304  return (int) AL_SUCCESS;
305 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int arrdim[AL_MAX_DIM]
Definition: al_hidden.h:53
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_lbounds ( int  isz,
int *  lbeg,
int *  lend,
int *  gp,
int  style 
)

Get the local indexes for the local portion of a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]lbegArray of ndim integers containing the start points
[out]lendArray of ndim integers containing the end points
[out]gpArray of ndim integers containing the ghost points
[in]styleIndex style: AL_C_INDEXES or AL_FORTRAN_INDEXES

Definition at line 668 of file al_sz_get.c.

678 {
679  register int i;
680  int ndim;
681  SZ *s;
682 
683  /*
684  Check that isz points to an allocated SZ
685  */
686  if( stack_ptr[isz] == AL_STACK_FREE ){
687  printf("AL_Get_lbounds: wrong SZ pointer\n");
688  return (int) AL_FAILURE;
689  }
690 
691  /*
692  Get the SZ structure isz is pointing at
693  */
694  s = sz_stack[isz];
695  ndim = s->ndim;
696  for(i=0;i<ndim;i++){
697  lbeg[i] = s->lbeg[i];
698  lend[i] = s->lend[i];
699  gp[i] = s->bg[i];
700  }
701 
702  return (int) AL_SUCCESS;
703 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int bg[AL_MAX_DIM]
Definition: al_hidden.h:72
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int lbeg[AL_MAX_DIM]
Definition: al_hidden.h:68
int lend[AL_MAX_DIM]
Definition: al_hidden.h:70
int ndim
Definition: al_hidden.h:43

Here is the caller graph for this function:

int AL_Get_local_dim ( int  isz,
int *  ldims 
)

Get the local dimensions of a distributed array WITHOUT GHOST POINTS

Parameters
[in]iszInteger pointer to the input array descriptor
[out]ldimsArray of integers with local dimensions

Definition at line 309 of file al_sz_get.c.

316 {
317  register int i;
318  int ndim;
319  SZ *s;
320 
321  /*
322  Check that isz points to an allocated SZ
323  */
324  if( stack_ptr[isz] == AL_STACK_FREE ){
325  printf("AL_Get_local_dim: wrong SZ pointer\n");
326  return (int) AL_FAILURE;
327  }
328 
329  /*
330  Get the SZ structure isz is pointing at
331  */
332  s = sz_stack[isz];
333 
334  ndim = s->ndim;
335  for(i=0;i<ndim;i++){ ldims[i] = s->larrdim[i];}
336 
337  return (int) AL_SUCCESS;
338 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int larrdim[AL_MAX_DIM]
Definition: al_hidden.h:54
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43

Here is the caller graph for this function:

int AL_Get_local_dim_gp ( int  sz_ptr,
int *  ldims_gp 
)

Get the local dimensions of a distributed array WITH GHOST POINTS

Parameters
[in]sz_ptrInteger pointer to the input array descriptor
[out]ldims_gpArray of integers with local dimensions (including ghost points)

Definition at line 341 of file al_sz_get.c.

349 {
350  register int i;
351  int isz;
352  int ndim;
353  SZ *s;
354 
355  isz = sz_ptr;
356 
357  /*
358  Check that isz points to an allocated SZ
359  */
360  if( stack_ptr[isz] == AL_STACK_FREE ){
361  printf("AL_Get_local_dim_gp: wrong SZ pointer\n");
362  return (int) AL_FAILURE;
363  }
364 
365  /*
366  Get the SZ structure isz is pointing at
367  */
368  s = sz_stack[isz];
369 
370  ndim = s->ndim;
371  for(i=0;i<ndim;i++){ ldims_gp[i] = s->larrdim_gp[i];}
372 
373  return (int) AL_SUCCESS;
374 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int larrdim_gp[AL_MAX_DIM]
Definition: al_hidden.h:56
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_offsets ( int  sz_ptr,
int *  offset 
)

Get the offsets for the for loop index calculation

NOTE: The typical multidimensional C for loop will look like, for example:

... ;

AL_Get_offsets(sz_ptr, offset);

for(k=kbeg; k<=kend; k++){ koff = k*offset[2]; for(j=jbeg; j<=jend; j++){ joff = j*offset[1]; for(i=ibeg; i<=iend; i++){ ioff = i*offset[0]+joff+koff; a[ioff] = ... ; } } } ... ;

Where a[ioff] is a generic 3D array.

Parameters
[in]sz_ptrInteger pointer to the input array descriptor
[out]offsetArray of integers with offsets

Definition at line 378 of file al_sz_get.c.

406 {
407  register int i;
408  int isz;
409  int ndim;
410  SZ *s;
411 
412  isz = sz_ptr;
413 
414  /*
415  Check that isz points to an allocated SZ
416  */
417  if( stack_ptr[isz] == AL_STACK_FREE ){
418  printf("AL_Get_offsets: wrong SZ pointer\n");
419  return (int) AL_FAILURE;
420  }
421 
422  /*
423  Get the SZ structure isz is pointing at
424  */
425  s = sz_stack[isz];
426  ndim = s->ndim;
427  for(i=0;i<ndim;i++){
428  offset[i] = s->offset[i];
429  }
430 
431  return (int) AL_SUCCESS;
432 }
int offset[AL_MAX_DIM]
Definition: al_hidden.h:76
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_parallel_dim ( int  isz,
int *  pardims 
)

Get the parallel dimensions of a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]pardimsArray of integers with parallel dimensions [AL_TRUE|AL_FALSE]

Definition at line 528 of file al_sz_get.c.

536 {
537  register int i;
538  int ndim;
539  SZ *s;
540 
541  /*
542  Check that isz points to an allocated SZ
543  */
544  if( stack_ptr[isz] == AL_STACK_FREE ){
545  printf("AL_Get_parallel_dim: wrong SZ pointer\n");
546  return (int) AL_FAILURE;
547  }
548 
549  /*
550  Get the SZ structure isz is pointing at
551  */
552  s = sz_stack[isz];
553  ndim = s->ndim;
554  for(i=0;i<ndim;i++){
555  pardims[i] = s->isparallel[i];
556  }
557 
558  return (int) AL_SUCCESS;
559 }
int isparallel[AL_MAX_DIM]
Definition: al_hidden.h:78
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_periodic_dim ( int  isz,
int *  periods 
)

Get the periodic dimensions of the distributed arrays

Parameters
[in]iszInteger pointer to the input array descriptor
[out]periodsArray of integers with periodic dimensions [AL_TRUE|AL_FALSE]

Definition at line 563 of file al_sz_get.c.

571 {
572  register int i;
573  int ndim;
574  SZ *s;
575 
576  /*
577  Check that isz points to an allocated SZ
578  */
579  if( stack_ptr[isz] == AL_STACK_FREE ){
580  printf("AL_Get_periodic_dim: wrong SZ pointer\n");
581  return (int) AL_FAILURE;
582  }
583 
584  /*
585  Get the SZ structure isz is pointing at
586  */
587  s = sz_stack[isz];
588  ndim = s->ndim;
589  for(i=0;i<ndim;i++){
590  periods[i] = s->isperiodic[i];
591  }
592 
593  return (int) AL_SUCCESS;
594 }
int isperiodic[AL_MAX_DIM]
Definition: al_hidden.h:80
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_rank ( int  isz,
int *  rank 
)

Get the rank of this node in the communicator associated with a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]rankInteger pointer to rank
Returns
If the current node does not belong to the communicator, AL_UNDEFINED (same as MPI_UNDEFINED) is returned. Otherwise AL_SUCCESS is returned.

Definition at line 59 of file al_sz_get.c.

71 {
72 
73  /*
74  Check that isz points to an allocated SZ
75  */
76  if( stack_ptr[isz] == AL_STACK_FREE ){
77  printf("AL_Get_comm: wrong SZ pointer\n");
78  return (int) AL_FAILURE;
79  }
80 
81  *rank = sz_stack[isz]->rank;
82 
83  return (int) AL_SUCCESS;
84 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int rank
Definition: al_hidden.h:44
#define AL_FAILURE
Definition: al_codes.h:33
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int AL_Get_size ( int  isz,
int *  size 
)

Get the size of the communicator associated with a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor (input)
[in]sizeInteger pointer to size (output)

Definition at line 23 of file al_sz_get.c.

30 {
31  int nproc;
32  MPI_Comm comm;
33  SZ *s;
34 
35  /*
36  Check that isz points to an allocated SZ
37  */
38  if( stack_ptr[isz] == AL_STACK_FREE ){
39  printf("AL_Get_comm: wrong SZ pointer\n");
40  return (int) AL_FAILURE;
41  }
42 
43  /*
44  Get the SZ structure isz is pointing at
45  */
46  s = sz_stack[isz];
47 
48  comm = s->comm;
49 
50  MPI_Comm_size(comm, &nproc);
51 
52  *size = nproc;
53 
54  return (int) AL_SUCCESS;
55 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
MPI_Comm comm
Definition: al_hidden.h:47
Definition: al_hidden.h:38
int AL_Get_staggered_dim ( int  isz,
int *  stagger 
)

Get the staggered dimensions of the distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]staggerArray of integers with staggered dimensions [AL_TRUE|AL_FALSE]

Definition at line 598 of file al_sz_get.c.

606 {
607  register int i;
608  int ndim;
609  SZ *s;
610 
611  /*
612  Check that isz points to an allocated SZ
613  */
614  if( stack_ptr[isz] == AL_STACK_FREE ){
615  printf("AL_Get_staggered_dim: wrong SZ pointer\n");
616  return (int) AL_FAILURE;
617  }
618 
619  /*
620  Get the SZ structure isz is pointing at
621  */
622  s = sz_stack[isz];
623  ndim = s->ndim;
624  for(i=0;i<ndim;i++){
625  stagger[i] = s->isstaggered[i];
626  }
627 
628  return (int) AL_SUCCESS;
629 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int isstaggered[AL_MAX_DIM]
Definition: al_hidden.h:82
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_stride ( int  sz_ptr,
int *  stride 
)

Get the strides for the for loop index calculation NOTE: The typical multidimensional C for loop will look like, for example:

... ;

AL_Get_stride(sz_ptr, stride);

for(k=kbeg; k<=kend; k++){ koff = k*stride[2]; for(j=jbeg; j<=jend; j++){ joff = j*stride[1]; for(i=ibeg; i<=iend; i++){ ioff = i*stride[0]+joff+koff; a[ioff] = ... ; } } } ... ;

Where a[ioff] is a generic 3D array.

Parameters
[in]sz_ptrInteger pointer to the input array descriptor
[out]strideArray of strides

Definition at line 437 of file al_sz_get.c.

464 {
465  register int i;
466  int isz;
467  int ndim;
468  SZ *s;
469 
470  isz = sz_ptr;
471 
472  /*
473  Check that isz points to an allocated SZ
474  */
475  if( stack_ptr[isz] == AL_STACK_FREE ){
476  printf("AL_Get_offsets: wrong SZ pointer\n");
477  return (int) AL_FAILURE;
478  }
479 
480  /*
481  Get the SZ structure isz is pointing at
482  */
483  s = sz_stack[isz];
484  ndim = s->ndim;
485  for(i=0;i<ndim;i++){
486  stride[i] = s->stride[i];
487  }
488 
489  return (int) AL_SUCCESS;
490 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int stride[AL_MAX_DIM]
Definition: al_hidden.h:77
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int i
Definition: analysis.c:2
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43
int AL_Get_type ( int  isz,
AL_Datatype type 
)

Get the basic data type of a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]typePointer to datatype

Definition at line 177 of file al_sz_get.c.

184 {
185  SZ *s;
186 
187  /*
188  Check that isz points to an allocated SZ
189  */
190  if( stack_ptr[isz] == AL_STACK_FREE ){
191  printf("AL_Get_type: wrong SZ pointer\n");
192  return (int) AL_FAILURE;
193  }
194 
195  /*
196  Get the SZ structure isz is pointing at
197  */
198  s = sz_stack[isz];
199 
200  *type = s->type;
201 
202  return (int) AL_SUCCESS;
203 }
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
MPI_Datatype type
Definition: al_hidden.h:40
Definition: al_hidden.h:38
int AL_Get_type_size ( int  isz,
int *  tsize 
)

Get size of the basic data type of a distributed array

Parameters
[in]iszInteger pointer to the input array descriptor
[out]tsizeInteger pointer to size of datatype.

Definition at line 206 of file al_sz_get.c.

213 {
214  int itsize;
215  AL_Datatype type;
216  SZ *s;
217 
218  /*
219  Check that isz points to an allocated SZ
220  */
221  if( stack_ptr[isz] == AL_STACK_FREE ){
222  printf("AL_Get_type_size: wrong SZ pointer\n");
223  return (int) AL_FAILURE;
224  }
225 
226  /*
227  Get the SZ structure isz is pointing at
228  */
229  s = sz_stack[isz];
230 
231  type = s->type;
232 
233  MPI_Type_size( type, &itsize);
234 
235  *tsize = itsize;
236 
237  return (int) AL_SUCCESS;
238 }
#define AL_Datatype
Definition: al_defs.h:22
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_STACK_FREE
Definition: al_codes.h:24
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
#define AL_FAILURE
Definition: al_codes.h:33
#define s
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
MPI_Datatype type
Definition: al_hidden.h:40
Definition: al_hidden.h:38

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.