|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
您好!求大佬指教
自己第一次编写一个UDF,不是特别懂,要导入一组速度,这一组速度是离散的,本来想自己进行调用一个文件夹,发现没有成功,后来想用一个数组,导入进去,老是提醒for语句的错误,想问一下这两种方法思路有没有问题,自己也编写了一下,希望指教。
这是我调用的一个数组,编写的,
#include "udf.h"
#include r 0.061
DEFINE_PROFILE(velocity_profile, thread, position)
{
float x[3]; /* this will hold the position vector */
float y;
float i;
face_t f;
double radii[10] = { 12.422374144441823,12.628950914710686,12.863972083943226,13.10688844593303,13.334884783486455,13.524568891050716,13.653737903101181,13.703006442268569,13.657289398399593,13.50718228627417 };
for (i=0; i<10 i ++)
{
y = radii;
begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
// y * 10 ^ (-3) / (6 * 3.1415 * r ^ (2));
F_PROFILE(f, thread, position) = y / 10 / 10 / 10 / 6 / 3.1415 / 0.061 / 0.061;
end_f_loop(f, thread)
}
}
}
调用文档的
#include "udf.h"
int count = 0.17;
DEFINE_RW_FILE(reader, fp)
{
printf(C:\\Users\\Administrator\\Desktop\\导入数据\\Flow_left_ant_cerebral_artery_A1.txt)
facanf(fp, "%d", &count)
}
|
|