|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
[这个贴子最后由AndyLu在 2007/11/19 08:06pm 第 1 次编辑]
请教下面程序中DEFINE_ON_DEMAND(list_species)中的int method = RP_Get_Integer("spe/method")语句怎么理解?特别是 RP_Get_Integer("spe/method")怎么理解?是什么意思?
***********************************************************************
#include "udf.h"
int get_species1(Domain *d)
{
Material *mix = mixture_material(d); /* Get mixture material */
Material *sp;
int i, n_species;
real mw[MAX_SPE_EQNS];
char *sp_name;
Message("\nIndex\tName\tMW\n");
n_species = 0; /* Reset species counter */
/* Loop over species in mixture */
mixture_species_loop(mix, sp, i) {
/* Get name of species i */
sp_name = MIXTURE_SPECIE_NAME(mix, i);
/* Get species molecular weight */
mw = MATERIAL_PROP(sp, PROP_mwi);
/* Display species data */
Message("%d\t%s\t%f\n", i, sp_name, mw);
/* Update species counter */
n_species += 1;
}
/* Return with total number of species */
return n_species;
}
int get_species2(Domain *d)
{
Material *mix = mixture_material(d); /* Get mixture material */
int i, n_species;
real hf[MAX_SPE_EQNS];
char *sp_name;
Message("\nIndex\tName\th_form\n");
/* Get total number of species in mixture */
n_species = MIXTURE_NSPECIES(mix);
/* Loop over species from 0 to n_species - 1 */
spe_loop(i, n_species) {
Material *sp = MIXTURE_SPECIE(mix, i); /* Get species material pointer */
char *sp_name = MIXTURE_SPECIE_NAME(mix, i); /* Get species name */
/* Get species hentalpy of formation */
hf = MATERIAL_PROP(sp, PROP_hform);
/* Display species data */
Message("%d\t%s\t%f\n", i, sp_name, hf);
}
/* Return with total number of species */
return n_species;
}
DEFINE_ON_DEMAND(list_species)
{
Domain *fl_domain = Get_Domain(1); /* Get domain */
int ns;
/**************************************************************************/
int method = RP_Get_Integer("spe/method");
/***************************************************************************/
switch (method) {
case 1:
ns = get_species1(fl_domain);
break;
case 2:
ns = get_species2(fl_domain);
break;
default:
Error("Unknown method!\n");
break;
}
Message("Total number of species: %d\n", ns);
}文字文字文字 |
|