Actual source code: f90_lahaye.c

  1: /*-------------------------------------------------------------*/

  5: PetscErrorCode F90Array1dCreate(void *array,PetscDataType type,PetscInt start,PetscInt len,F90Array1d *ptr)
  6: {
  7:   PetscInt size;

 13:   PetscDataTypeGetSize(type,&size);
 14:   ptr->addr          = array;
 15:   ptr->dim[0].lower  = start;
 16:   ptr->dim[0].upper  = start+len-1;
 17:   ptr->dim[0].mult   = size;
 18:   ptr->dim[0].extent = len;
 19:   ptr->dimn          = len;
 20:   ptr->dimb          = 0;
 21:   return(0);
 22: }

 26: PetscErrorCode F90Array2dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,F90Array2d *ptr)
 27: {

 29:   PetscInt size;

 35:   PetscDataTypeGetSize(type,&size);
 36:   ptr->addr          = array;
 37:   ptr->dim[0].lower  = start1;
 38:   ptr->dim[0].upper  = start1+len1-1;
 39:   ptr->dim[0].mult   = size;
 40:   ptr->dim[0].extent = len1;
 41:   ptr->dim[1].lower  = start2;
 42:   ptr->dim[1].upper  = start2+len2-1;
 43:   ptr->dim[1].mult   = len1*size;
 44:   ptr->dim[1].extent = len2;
 45:   ptr->dimn          = len2*len1;
 46:   ptr->dimb          = ptr->dimn*size;

 48:   return(0);
 49: }


 54: PetscErrorCode F90Array3dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,F90Array3d *ptr)
 55: {

 57:   PetscInt size;

 63:   PetscDataTypeGetSize(type,&size);
 64:   ptr->addr          = array;
 65:   ptr->dim[0].lower  = start1;
 66:   ptr->dim[0].upper  = start1+len1-1;
 67:   ptr->dim[0].mult   = size;
 68:   ptr->dim[0].extent = len1;
 69:   ptr->dim[1].lower  = start2;
 70:   ptr->dim[1].upper  = start2+len2-1;
 71:   ptr->dim[1].mult   = len1*size;
 72:   ptr->dim[1].extent = len2;
 73:   ptr->dim[2].lower  = start3;
 74:   ptr->dim[2].upper  = start3+len3-1;
 75:   ptr->dim[2].mult   = len2*len1*size;
 76:   ptr->dim[2].extent = len3;
 77:   ptr->dimn          = len3*len2*len1;
 78:   ptr->dimb          = ptr->dimn*size;

 80:   return(0);
 81: }

 85: PetscErrorCode F90Array4dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,PetscInt start4,PetscInt len4,F90Array4d *ptr)
 86: {

 88:   PetscInt size;

 94:   PetscDataTypeGetSize(type,&size);
 95:   ptr->addr          = array;
 96:   ptr->dim[0].lower  = start1;
 97:   ptr->dim[0].upper  = start1+len1-1;
 98:   ptr->dim[0].mult   = size;
 99:   ptr->dim[0].extent = len1;
100:   ptr->dim[1].lower  = start2;
101:   ptr->dim[1].upper  = start2+len2-1;
102:   ptr->dim[1].mult   = len1*size;
103:   ptr->dim[1].extent = len2;
104:   ptr->dim[2].lower  = start3;
105:   ptr->dim[2].upper  = start3+len3-1;
106:   ptr->dim[2].mult   = len2*len1*size;
107:   ptr->dim[2].extent = len3;
108:   ptr->dim[3].lower  = start4;
109:   ptr->dim[3].upper  = start4+len4-1;
110:   ptr->dim[3].mult   = len3*len2*len1*size;
111:   ptr->dim[3].extent = len4;
112:   ptr->dimn          = len4*len3*len2*len1;
113:   ptr->dimb          = ptr->dimn*size;

115:   return(0);
116: }

118: /*-------------------------------------------------------------*/