Actual source code: f90_intel.c

  1: #define PETSC_DLL
  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          = array;
 16:   ptr->size          = len;
 17:   ptr->sd            = size;
 18:   ptr->cookie        = size;
 19:   ptr->ndim          = 1;
 20:   ptr->dim[0].lower  = start;
 21:   ptr->dim[0].upper  = len+start;
 22:   ptr->dim[0].mult   = 1;
 23:   ptr->addr_d        = (void*)((long)array -(ptr->dim[0].lower*ptr->dim[0].mult));
 24:   return(0);
 25: }

 29: PetscErrorCode  F90Array2dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,F90Array2d *ptr)
 30: {
 32:   PetscInt size;

 37:   PetscDataTypeGetSize(type,&size);
 38:   ptr->addr          = array;
 39:   ptr->size          = len1*len2;
 40:   ptr->sd            = size;
 41:   ptr->cookie        = size;
 42:   ptr->ndim          = 2;
 43:   ptr->dim[0].lower  = start1;
 44:   ptr->dim[0].upper  = len1+start1;
 45:   ptr->dim[0].mult   = 1;
 46:   ptr->dim[1].lower  = start2;
 47:   ptr->dim[1].upper  = len2+start2;
 48:   ptr->dim[1].mult   = len1;
 49:   ptr->addr_d        = (void*)((long)array -(ptr->dim[0].lower*ptr->dim[0].mult+ptr->dim[1].lower*ptr->dim[1].mult));
 50:   return(0);
 51: }

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

 63:   PetscDataTypeGetSize(type,&size);
 64:   ptr->addr          = array;
 65:   ptr->size          = len1*len2*len3;
 66:   ptr->sd            = size;
 67:   ptr->cookie        = size;
 68:   ptr->ndim          = 3;
 69:   ptr->dim[0].lower  = start1;
 70:   ptr->dim[0].upper  = len1+start1;
 71:   ptr->dim[0].mult   = 1;
 72:   ptr->dim[1].lower  = start2;
 73:   ptr->dim[1].upper  = len2+start2;
 74:   ptr->dim[1].mult   = len1;
 75:   ptr->dim[2].lower  = start3;
 76:   ptr->dim[2].upper  = len3+start3;
 77:   ptr->dim[2].mult   = len2*len1;
 78:   ptr->addr_d        = (void*)((long)array -(ptr->dim[0].lower*ptr->dim[0].mult+
 79:                                              ptr->dim[1].lower*ptr->dim[1].mult+
 80:                                              ptr->dim[2].lower*ptr->dim[2].mult));
 81:   return(0);
 82: }

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

 94:   PetscDataTypeGetSize(type,&size);
 95:   ptr->addr          = array;
 96:   ptr->size          = len1*len2*len3*len4;
 97:   ptr->sd            = size;
 98:   ptr->cookie        = size;
 99:   ptr->ndim          = 3;
100:   ptr->dim[0].lower  = start1;
101:   ptr->dim[0].upper  = len1+start1;
102:   ptr->dim[0].mult   = 1;
103:   ptr->dim[1].lower  = start2;
104:   ptr->dim[1].upper  = len2+start2;
105:   ptr->dim[1].mult   = len1;
106:   ptr->dim[2].lower  = start3;
107:   ptr->dim[2].upper  = len3+start3;
108:   ptr->dim[2].mult   = len2*len1;
109:   ptr->dim[3].lower  = start4;
110:   ptr->dim[3].upper  = len4+start4;
111:   ptr->dim[3].mult   = len3*len2*len1;
112:   ptr->addr_d        = (void*)((long)array -(ptr->dim[0].lower*ptr->dim[0].mult+
113:                                              ptr->dim[1].lower*ptr->dim[1].mult+
114:                                              ptr->dim[2].lower*ptr->dim[2].mult+
115:                                              ptr->dim[3].lower*ptr->dim[3].mult));
116:   return(0);
117: }

119: /*-------------------------------------------------------------*/