PLUTO
al_boundary.c File Reference

Check if the local beginnings or endings of an array correspond to the global beginnings or endings. More...

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

Go to the source code of this file.

Functions

int AL_Is_boundary (int sz_ptr, int *is_gbeg, int *is_gend)
 

Variables

SZsz_stack [AL_MAX_ARRAYS]
 
int stack_ptr [AL_MAX_ARRAYS]
 

Detailed Description

Check if the local beginnings or endings of an array correspond to the global beginnings or endings.

Check if the local beginnings or endings of an array correspond to the global beginnings or endings.

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

Definition in file al_boundary.c.

Function Documentation

int AL_Is_boundary ( int  sz_ptr,
int *  is_gbeg,
int *  is_gend 
)

This routine is useful when implementing the physical boundary conditions on a problem. It returns two arrays that are set to AL_TRUE or AL_FALSE depending on wether or not the local beginning (ending) address for the array in each direction is actually a global one.

Parameters
[in]sz_ptrpointer to a distributed array descriptor (integer)
[out]is_gbegint array set to AL_TRUE or AL_FALSE for global beginning
[out]is_gendint array set to AL_TRUE or AL_FALSE for global ending

Definition at line 28 of file al_boundary.c.

42 {
43  register int i;
44  int myrank, nproc,ndims;
45  MPI_Comm comm;
46  SZ *s;
47 
48  /* DIAGNOSTICS
49  Check that sz_ptr points to an allocated SZ
50  */
51  if( stack_ptr[sz_ptr] == AL_STACK_FREE){
52  printf("AL_Is_boundary: wrong SZ pointer\n");
53  }
54 
55  s = sz_stack[sz_ptr];
56 
57  myrank = s->rank;
58  nproc = s->size;
59  comm = s->comm;
60  ndims = s->ndim;
61 
62  for(i=0;i<ndims;i++){
63  if( s->beg[i] == s->bg[i] ){
64  is_gbeg[i] = AL_TRUE;
65  } else {
66  is_gbeg[i] = AL_FALSE;
67  }
68  if( s->end[i] == s->arrdim[i]+s->bg[i]-1 ){
69  is_gend[i] = AL_TRUE;
70  } else {
71  is_gend[i] = AL_FALSE;
72  }
73  }
74 
75  /* DIAGNOSTICS */
76 #ifdef DEBUG
77  printf("AL_Is_boundary: completed\n");
78 #endif
79 
80  return (int) AL_SUCCESS;
81 }
int stack_ptr[AL_MAX_ARRAYS]
Definition: al_szptr_.c:26
int end[AL_MAX_DIM]
Definition: al_hidden.h:60
#define AL_SUCCESS
Definition: al_codes.h:32
#define AL_TRUE
Definition: al_codes.h:28
#define AL_STACK_FREE
Definition: al_codes.h:24
SZ * sz_stack[AL_MAX_ARRAYS]
Definition: al_szptr_.c:18
int arrdim[AL_MAX_DIM]
Definition: al_hidden.h:53
int rank
Definition: al_hidden.h:44
int bg[AL_MAX_DIM]
Definition: al_hidden.h:72
int beg[AL_MAX_DIM]
Definition: al_hidden.h:58
#define s
int size
Definition: al_hidden.h:45
int i
Definition: analysis.c:2
MPI_Comm comm
Definition: al_hidden.h:47
#define AL_FALSE
Definition: al_codes.h:29
Definition: al_hidden.h:38
int ndim
Definition: al_hidden.h:43

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.