Actual source code: f90_nag.c

  2: /*-------------------------------------------------------------*/

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

 14:   PetscDataTypeGetSize(type,&size);
 15:   ptr->addr          = (Pointer)array;
 16:   ptr->offset        = -size;
 17:   ptr->dim[0].extent = len;
 18:   ptr->dim[0].mult   = size;
 19:   ptr->dim[0].lower  = start;

 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;

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

 48: PetscErrorCode F90Array3dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,F90Array3d *ptr)
 49: {
 51:   PetscInt size;

 56:   PetscDataTypeGetSize(type,&size);
 57:   ptr->addr          = (Pointer)array;
 58:   ptr->offset        = -(1+len1*len2)*size;
 59:   ptr->dim[0].extent = len1;
 60:   ptr->dim[0].mult   = size;
 61:   ptr->dim[0].lower  = start1;
 62:   ptr->dim[1].extent = len2;
 63:   ptr->dim[1].mult   = len1*size;
 64:   ptr->dim[1].lower  = start2;
 65:   ptr->dim[2].extent = len3;
 66:   ptr->dim[2].mult   = len2*len1*size;
 67:   ptr->dim[2].lower  = start3;
 68:   return(0);
 69: }

 73: PetscErrorCode F90Array4dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,PetscInt start4,PetscInt len4,F90Array4d *ptr)
 74: {
 76:   PetscInt size;

 81:   PetscDataTypeGetSize(type,&size);
 82:   ptr->addr          = (Pointer)array;
 83:   ptr->offset        = -(1+len1*len2*len3)*size;
 84:   ptr->dim[0].extent = len1;
 85:   ptr->dim[0].mult   = size;
 86:   ptr->dim[0].lower  = start1;
 87:   ptr->dim[1].extent = len2;
 88:   ptr->dim[1].mult   = len1*size;
 89:   ptr->dim[1].lower  = start2;
 90:   ptr->dim[2].extent = len3;
 91:   ptr->dim[2].mult   = len2*len1*size;
 92:   ptr->dim[2].lower  = start3;
 93:   ptr->dim[3].extent = len4;
 94:   ptr->dim[3].mult   = len3*len2*len1*size;
 95:   ptr->dim[3].lower  = start4;
 96:   return(0);
 97: }

 99: /*-------------------------------------------------------------*/