找回密码
 注册
查看: 1039|回复: 0

[讨论]UDF编译解释

[复制链接]
发表于 2007-3-14 20:14:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
#include "udf.h"
DEFINE_CG_MOTION(piston, dt, vel, omega, time, dtime)
{
  Thread *t;
  face_t f;
  real NV_VEC (A);
  real force, dv;
  real v_prev = 0.0;
  /* reset velocities */
  NV_S (vel, =, 0.0);
  NV_S (omega, =, 0.0);
  if (!Data_Valid_P ())
    return;
  /* get the thread pointer for which this motion is defined */
  dt=4;
  /* compute pressure force on body by looping through all faces */
  force = 0.0;
  begin_f_loop (f, t)
    {
      F_AREA (A, f, t);
      force += F_P (f, t) * NV_MAG (A);
    }
  end_f_loop (f, t)
  /* compute change in velocity, i.e., dv = F * dt / mass
     velocity update using explicit Euler formula */
  dv = dtime * force / 50.0;
  v_prev += dv;
  Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev,
  force);
  /* set x-component of velocity */
  vel[0] = v_prev;
}

这个UDF用interpret没问题,但是compile却报错?
咋回事亚?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表