⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xginitf.c

📁 xgrafix 是PTSG模拟程序中的图形截面库 改版本是最新版本
💻 C
📖 第 1 页 / 共 3 页
字号:
#endif#endif#endif     SCALAR          *x_array;	/* x_array to be plotted                        */     SCALAR          *y_array;	/* y_array to be plotted                        */     SCALAR          *z_array;	/* z_array to be plotted                        */     int            *npoints;	/* number of points in the x, y and z direction */     int            *color;	/* plot's color chosen from 0-9                 */{  DataType        data_prevptr, data_ptr;    data_prevptr = theWindowArray[numberOfWindows -1]->data;  data_ptr = SetupDataStruct();  data_ptr->zscat = z_array;  data_ptr->y = y_array;  data_ptr->x = x_array;  data_ptr->npoints = npoints;  data_ptr->mpoints = npoints;  data_ptr->color = *color;  data_ptr->next = data_prevptr;  Set_Scatter(data_ptr);    theWindowArray[numberOfWindows -1]->data = data_ptr;}/***********************************************************************/void#ifdef UNICOSVECTORXG(x_array, y_array, z_array, w_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef IBMvectorxg(x_array, y_array, z_array, w_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef HPvectorxg(x_array, y_array, z_array, w_array, mpoints, npoints, ndim1, ndim2, color)#elsevectorxg_(x_array, y_array, z_array, w_array, mpoints, npoints, ndim1, ndim2, color)#endif#endif#endif     SCALAR          *x_array;	/* x_array to be plotted                 */     SCALAR          *y_array;	/* y_array to be plotted                 */     SCALAR          *z_array;	/* x component of Vector                 */     SCALAR          *w_array;	/* y component of Vector                 */     int            *mpoints;	/* number of points in the x direction   */     int            *npoints;	/* number of points in the y direction   */     int            *ndim1;   /* dimensions of the 1st index of z_array */     int            *ndim2;   /* dimensions of the 2nd index of z_array */     int            *color;	/* plot's color chosen from 0-9          */{  int             j;    DataType        data_prevptr, data_ptr;    /* Allocate the 2-D FORTRAN to C conversion arrays within the 3-D array ZPLOT3D. */  if (++zindex_3d_plots > MAX_3D_PLOTS ||      ++windex_3d_plots > MAX_3D_PLOTS) {    puts("Number of initialized 3-D plots exceeds established allocation.");    exit(-1);  }  zplot3d[zindex_3d_plots - 1] = (SCALAR **) malloc((*ndim2)*sizeof(SCALAR *));  wplot3d[windex_3d_plots - 1] = (SCALAR **) malloc((*ndim2)*sizeof(SCALAR *));  for (j = 0; j < (*ndim2); j++) {    zplot3d[zindex_3d_plots - 1][j] = &z_array[j*(*ndim1)];    wplot3d[windex_3d_plots - 1][j] = &w_array[j*(*ndim1)];  }  data_prevptr = theWindowArray[numberOfWindows -1]->data;  data_ptr = SetupDataStruct();  data_ptr->z = zplot3d[zindex_3d_plots - 1];  data_ptr->w = wplot3d[windex_3d_plots - 1];  data_ptr->y = x_array;  data_ptr->x = y_array;  data_ptr->mpoints = npoints;  data_ptr->npoints = mpoints;  data_ptr->color = *color;  data_ptr->next = data_prevptr;  Set_Vector(data_ptr);  theWindowArray[numberOfWindows -1]->data = data_ptr;}/***********************************************************************/void#ifdef UNICOSSURFXG(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef IBMsurfxg(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef HPsurfxg(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#elsesurfxg_(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#endif#endif#endif     SCALAR          *x_array;	/* x_array to be plotted                  */     SCALAR          *y_array;	/* y_array to be plotted                  */     SCALAR          *z_array;	/* z_array to be plotted                  */     int            *mpoints;	/* number of points in the x direction    */     int            *npoints;	/* number of points in the y direction    */     int            *ndim1;   /* dimensions of the 1st index of z_array */     int            *ndim2;   /* dimensions of the 2nd index of z_array */     int            *color;	/* plot's color chosen from 0-9           */{  int             j;  DataType        data_prevptr, data_ptr;    /* Allocate the 2-D FORTRAN to C conversion arrays within the 3-D array ZPLOT3D. */  if (++zindex_3d_plots > MAX_3D_PLOTS) {    puts("Number of initialized 3-D plots exceeds established allocation.");    exit(-1);  }  zplot3d[zindex_3d_plots - 1] = (SCALAR **) malloc((*ndim2)*sizeof(SCALAR *));  for (j = 0; j < (*ndim2); j++)    zplot3d[zindex_3d_plots - 1][j] = &z_array[j*(*ndim1)];    data_prevptr = theWindowArray[numberOfWindows -1]->data;  data_ptr = SetupDataStruct();  data_ptr->z = zplot3d[zindex_3d_plots - 1];  data_ptr->y = x_array;  data_ptr->x = y_array;  data_ptr->mpoints = npoints;  data_ptr->npoints = mpoints;  data_ptr->color = *color;  data_ptr->next = data_prevptr;  theWindowArray[numberOfWindows -1]->data = data_ptr;}/***********************************************************************/void#ifdef UNICOSCONTXG(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef IBMcontxg(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef HPcontxg(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#elsecontxg_(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#endif#endif#endif     SCALAR          *x_array;	/* x_array to be plotted                  */     SCALAR          *y_array;	/* y_array to be plotted                  */     SCALAR          *z_array;	/* z_array to be plotted                  */     int            *mpoints;	/* number of points in the x direction    */     int            *npoints;	/* number of points in the y direction    */     int            *ndim1;   /* dimensions of the 1st index of z_array */     int            *ndim2;   /* dimensions of the 2nd index of z_array */     int            *color;	/* plot's color chosen from 0-9           */{  int             j;    DataType        data_prevptr, data_ptr;    /* Allocate the 2-D FORTRAN to C conversion arrays within the 3-D array ZPLOT3D. */  if (++zindex_3d_plots > MAX_3D_PLOTS) {    puts("Number of initialized 3-D plots exceeds established allocation.");    exit(-1);  }  zplot3d[zindex_3d_plots - 1] = (SCALAR **) malloc((*ndim2) * sizeof(SCALAR *));  for (j = 0; j < (*ndim2); j++)    zplot3d[zindex_3d_plots - 1][j] = &z_array[j*(*ndim1)];    data_prevptr = theWindowArray[numberOfWindows -1]->data;  data_ptr = SetupDataStruct();  data_ptr->z = zplot3d[zindex_3d_plots - 1];  data_ptr->y = x_array;  data_ptr->x = y_array;  data_ptr->mpoints = npoints;  data_ptr->npoints = mpoints;  data_ptr->color = *color;  data_ptr->next = data_prevptr;    theWindowArray[numberOfWindows -1]->data = data_ptr;}/***********************************************************************/void#ifdef UNICOSIRSURFXG(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef IBMirsurfxg(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#else#ifdef HPirsurfxg(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#elseirsurfxg_(x_array, y_array, z_array, mpoints, npoints, ndim1, ndim2, color)#endif#endif#endif     SCALAR          *x_array;	/* x_array to be plotted                  */     SCALAR          *y_array;	/* y_array to be plotted                  */     SCALAR          *z_array;	/* z_array to be plotted                  */     int            *mpoints;	/* number of points in the x direction    */     int            *npoints;	/* number of points in the y direction    */     int            *ndim1;   /* dimensions of the 1st index of z_array */     int            *ndim2;   /* dimensions of the 2nd index of z_array */     int            *color;	/* plot's color chosen from 0-9           */{  int             j;    DataType        data_prevptr, data_ptr;    /* Allocate the 2-D FORTRAN to C conversion arrays within the 3-D array ZPLOT3D. */  if (++xindex_3d_plots > MAX_3D_PLOTS ||      ++yindex_3d_plots > MAX_3D_PLOTS ||      ++zindex_3d_plots > MAX_3D_PLOTS) {    puts("Number of initialized 3-D plots exceeds established allocation.");    exit(-1);  }  xplot3d[xindex_3d_plots - 1] = (SCALAR **) malloc((*ndim2)*sizeof(SCALAR *));  yplot3d[yindex_3d_plots - 1] = (SCALAR **) malloc((*ndim2)*sizeof(SCALAR *));  zplot3d[zindex_3d_plots - 1] = (SCALAR **) malloc((*ndim2)*sizeof(SCALAR *));  for (j = 0; j < (*ndim2); j++) {    xplot3d[xindex_3d_plots - 1][j] = &x_array[j*(*ndim1)];    yplot3d[yindex_3d_plots - 1][j] = &y_array[j*(*ndim1)];    zplot3d[zindex_3d_plots - 1][j] = &z_array[j*(*ndim1)];  }  data_prevptr = theWindowArray[numberOfWindows -1]->data;  data_ptr = SetupDataStruct();  data_ptr->z = zplot3d[zindex_3d_plots - 1];  data_ptr->y_irr = xplot3d[xindex_3d_plots - 1];  data_ptr->x_irr = yplot3d[yindex_3d_plots - 1];  data_ptr->mpoints = npoints;  data_ptr->npoints = mpoints;  data_ptr->color = *color;  data_ptr->next = data_prevptr;  Set_Irr_Surf(data_ptr); theWindowArray[numberOfWindows -1]->data = data_ptr;}/***********************************************************************/void#ifdef UNICOSSTRUCTUREXGARRAY(numpoints,fillstatus,linecolor,fillcolor,struct_array)#else#ifdef IBMstructurexgarray(numpoints,fillstatus,linecolor,fillcolor,struct_array)#else#ifdef HPstructurexgarray(numpoints,fillstatus,linecolor,fillcolor,struct_array)#elsestructurexgarray_(numpoints,fillstatus,linecolor,fillcolor,struct_array)#endif#endif#endif  int      *numpoints;  int      *fillstatus;  int      *linecolor;  int      *fillcolor;  double   *struct_array;{  int i;  STRUCT_FILL fillFlag;  StructType *structure = (StructType *)malloc(sizeof(StructType));  structure->x = (double *)malloc(*numpoints * sizeof(double));  structure->y = (double *)malloc(*numpoints * sizeof(double));  structure->numberPoints = *numpoints;  structure->fillFlag = *fillstatus;  structure->lineColor = *linecolor;  structure->fillColor = *fillcolor;  for (i=0;i< *numpoints;i++) {    structure->x[i] = struct_array[2*i];    structure->y[i] = struct_array[2*i + 1];  }  structure->next = theNewWindow->structures;  theNewWindow->structures = structure;}/*************************************************************************/void#ifdef UNICOSNEWINTSETUP(newint,name)#else#ifdef IBMnewintsetup(newint,name)#else#ifdef HPnewintsetup(newint,name)#elsenewintsetup_(newint,name)#endif#endif#endif  int      *newint;  char     *name;{ SetUpNewVar((void*) newint,name,"integer"); }/**********************************************************************/  void#ifdef UNICOSNEWREALSETUP(newreal,name)#else#ifdef IBMnewrealsetup(newreal,name)#else#ifdef HPnewrealsetup(newreal,name)#elsenewrealsetup_(newreal,name)#endif#endif#endif  float    *newreal;  char     *name;{ SetUpNewVar((void*) newreal,name,"float"); }/***********************************************************************/void#ifdef UNICOSNEWDOUBLESETUP(newdouble,name)#else#ifdef IBMnewdoublesetup(newdouble,name)#else#ifdef HPnewdoublesetup(newdouble,name)#elsenewdoublesetup_(newdouble,name)#endif#endif#endif  double   *newdouble;  char     *name;{ SetUpNewVar((void*) newdouble,name,"double"); }/*************************************************************************/void#ifdef UNICOSNEWCHARSETUP(newchar,name)#else#ifdef IBMnewcharsetup(newchar,name)#else#ifdef HPnewcharsetup(newchar,name)#elsenewcharsetup_(newchar,name)#endif#endif#endif  char     *newchar;  char     *name;{ SetUpNewVar((void*) newchar,name,"char"); }/************************************************************************/void XGMainLoop(){#ifdef UNICOS    XGMAINLOOP();#else#ifdef IBM    xgmainloop();#else#ifdef HP    xgmainloop();#else    xgmainloop_();#endif#endif#endif }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -