|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
一个简单的动网格的例子,DEFINE_CG_MOTION的。
我自己书写的总是报语法错误,比如;{}之类的错误。
但是教程上给的源程序却可以通过编译。
我和他写的没有区别啊,可能就是书写的过程中有点空格的差别。
这是为什么呢?
望各位大牛指点
程序如下:
#include "udf.h"
static real v_prev=0.0;
DEFINE_CG_MOTION(moving_body, dt, vel, omega, time, dtime)
{
Thread *t;
face_t f;
real NV_VEC (A);
real force, dv;
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);
if(!Data_Valid_P())
return;
t = DT_THREAD (dt);
force = 0.0;
begine_f_loop (f, t)
{
F_AREA (A, f, t);
force = force + F_P (f, t) * A[0];
}
end_f_loop (f,t)
dv = dtime * force / 100.0;
v_prev = v_prev + dv;
vel[0] = v_prev;
}
报错:
Done.
Deleted old libudf\ntx86\2d\libudf.dll
已复制 1 个文件。
(system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\2d\makefile")
已复制 1 个文件。
(chdir "libudf")()
(chdir "ntx86\2d")()
d2.c
..\..\src\d2.c(20) : error C2143: syntax error : missing ';' before '{'
..\..\src\d2.c(24) : error C2059: syntax error : '}'
..\..\src\d2.c(27) : warning C4142: benign redefinition of type
..\..\src\d2.c(27) : error C2374: 'v_prev' : redefinition; multiple initialization
..\..\src\d2.c(2) : see declaration of 'v_prev'
..\..\src\d2.c(27) : error C2065: 'dv' : undeclared identifier
..\..\src\d2.c(27) : error C2099: initializer is not a constant
..\..\src\d2.c(29) : error C2466: cannot allocate an array of constant size 0
..\..\src\d2.c(29) : error C2099: initializer is not a constant
..\..\src\d2.c(30) : error C2059: syntax error : '}'
[ 本帖最后由 ailee1984 于 2013-5-24 08:48 编辑 ] |
|