YYH 发表于 2015-10-5 22:37:20

输出三维模型所有单元格的中心点坐标的udf

请教论坛里各位大神输出三维模型所有单元格的中心点坐标的udf该如何编写呀,急求,自己改的一个程序如下,编译过程总是出错,请帮忙看看问题出在哪里!!!最好给一个例子或者给段程序!谢谢。。。
#include "udf.h"

DEFINE_INIT(my_init_func,d)
{
    cell_t c;
    Thread *t;
    real xc;
    char filename[]="center.txt";
    FILE *fp;      /*destination file pointer*/

    printf("\n FILENAME:%s\n",filename);

    fp = fopen(filename, "w");
    /* loop over all cell threads in the domain */
    thread_loop_c(t,d)
      {

         /* loop over all cells */
         begin_c_loop_all(c,t)
         {
            C_CENTROID(xc,c,t);

    printf("Writing UDF data to data file...\n");

    fprintf(fp, "%.6f %+.6f %+.6f\n", xc, xc, xc); /* write out xc to data file */

         }
         end_c_loop_all(c,t)
      }
fclose(fp);
}

YYH 发表于 2015-10-11 18:40:10

自己顶一下! 求解答
页: [1]
查看完整版本: 输出三维模型所有单元格的中心点坐标的udf