24小时热门版块排行榜    

CyRhmU.jpeg
查看: 1700  |  回复: 10
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

heroyejian

铜虫 (正式写手)

[求助] 请解释一下这句话的意思 static int (*usersMessage)(char*,...);

本人知道在在c语言中函数体外部使用static什么变量的话,是申明了一个文件级的外部变量,但是请问下面一句话如果定义在外部的话,是什么意思啊?我基础很差
static int (*usersMessage)(char*,...);
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

heroyejian

铜虫 (正式写手)

送鲜花一朵
引用回帖:
: Originally posted by kylafree at 2012-03-08 18:36:30:
你还是从哪里找来的语句啊?

不容易呀 终于有人肯回复我了 哎
我是从fluent全攻略上看到的语句,我需要定义一个真实气体的模型,要用到udf,然后我就看到了里边这句话
5楼2012-03-11 13:08:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 11 个回答

heroyejian

铜虫 (正式写手)

请各位大哥大姐过来看一看呀,有人会吗?
2楼2012-03-07 11:53:17
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

kylafree

至尊木虫 (知名作家)

你还是从哪里找来的语句啊?

» 本帖已获得的红花(最新10朵)

4楼2012-03-08 18:36:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

heroyejian

铜虫 (正式写手)

#include   "udf.h"
#include   "stdio.h"
#include   "ctype.h"
#include   "stdarg.h"

#define     MW    28.996                       /*空气的分子量*/
#define     RGAS(UNIVERSAL_GAS_CONSTANT/MW)  
#define     TDatum    288.15                   /*参考温度*/
#define     PDatum    1.01325e5                /*参考压强*/
static int (*usersMessage)(char*,...);        //!!!!!!!!!
static void (*usersError)(char*,...);           //!!!!!!!!!有人能帮我解释一下这两句话的意思吗?

DEFINE_ON_DEMAND(I_DO_NOTHING)
  {
      /*This is a dummy function to allow us to use*/
          /*the Compiled UDFs utility*/
          
  }

void IDEAL_error(int err,char *f,char *msg)
  {
      if(err)
                  usersError(''IDEAL_error(%d)from function:%s\n%s\n'',err,f,msg);
         
  }


void IDEAL_Setup(Domain *domain, char*mygas,int(*messagefunc)(char*format),void(*errorfunc)(char*format))
  {
      /*Use this function for any initialization or model setups*/
      usersMessage=messagefunc;
          usersError=errorfunc;
          usersMessage(''\nLoading Real-Ideal Laibrary:%s\n'',mygas);

  }


double IDEAL_density(double Temp, double press, double yi[])
  {
     double r=press/(RGAS*Temp);     /*Density at Temp and press*/
         return r;                       /*(Kg/m^3)*/
     
  }

double IDEAL_specific_heat(double Temp, double press, double yi[])
  {
     double cp=1006.43;   
         return cp;               
     
  }

double IDEAL_mw(double yi[])
  {
     
         return MW;                       /*(Kg/Kmol)*/
     
  }

double IDEAL_viscosity(double Temp, double density, double yi[])
  {
     double mu=1.7894e-5;  
         return mu;                       /*(Kg/m/s)*/
     
  }

double IDEAL_thermal_conductivity(double Temp, double density, double yi[])
  {
     double ktc=0.0242;   
         return ktc;                       /*(W/m/K)*/
     
  }

UDF_EXPORT RGAS_Functions RealGasFunctionList=
  {
     IDEAL_Setup,                               /*initialize              */
     IDEAL_density,                             /*density                 */
     IDEAL_specific_heat,                       /*specific_heat           */
     IDEAL_mw,                                  /*molecular_weight        */
     IDEAL_viscosity,                           /*viscosity               */
     IDEAL_thermal_conductivity,                /*thermal conductivity    */
  };
6楼2012-03-11 13:14:25
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见