Programming 板


LINE

如题,小弟目前在当硕士生,明明是程式苦手 却还是读起了物理系,现在在实验室帮忙。 我现在手上的程式遇到一个看似很常见, 可是错误讯息讲得很笼统, 查了一堆资料後还是看不懂它要什麽, 可以帮我看看吗? void FB_UVFeedback( real (*Fluid)[PS2][PS2][PS2], real &particleIonizingLuminosity, const int &pararticleWillExplode, const int idx[], const double dh ); void FB_User_Template( const int lv, const double TimeNew, const double TimeOld, const double dt, const int NPar, const int *ParSortID, real *ParAtt[PAR_NATT_TOTAL], real (*Fluid)[PS2][PS2][PS2], const double EdgeL[], const double dh, bool CoarseFine[], const int TID, RandomNumber_t *RNG ) { … // 1: UV feedback FB_UVFeedback( (Fluid*){[16][16][16]}, ionizeLuminosity, willExplode[n], idx, dh); … } void FB_UVFeedback( real (*Fluid)[PS2][PS2][PS2], real &particleIonizingLuminosity, const int &pararticleWillExplode, const int idx[], const double dh ) { #ifdef DUAL_ENERGY const real cell_volume = POW(dh*UNIT_L, 3); const real mu = 0.6; const real mass_h = 1.67262171e-24; const real alpha = 2.60e-13; // Case B recombination, assuming T = 10^4 K. const real flu_dens = Fluid[DENS][ idx[0] ][ idx[1] ][ idx[2] ]; // old density of this cell const real flu_energy = Fluid[ENPY][ idx[0] ][ idx[1] ][ idx[2] ]; // old energy of this cell const real num = flu_dens * UNIT_D / mu / mass_h; const real stromgren_radius = POW( ( (3.0*particleIonizingLuminosity*1e49) / (4.0*M_PI*alpha*SQR(num)) ), (1.0/3.0) ); const real stromgren_volume = (4.0/3.0) * M_PI * CUBE(stromgren_radius); real ionized = Const_kB*1e4 / mu / mass_h / SQR(UNIT_L) * SQR(UNIT_T); if ( stromgren_volume < cell_volume ) ionized *= stromgren_volume/cell_volume; if ( pararticleWillExplode == 1 && flu_energy < ionized ) { // TODO: dual energy update const real theDiff = ionized - flu_energy; // thermal energy difference caused by UV ionization Fluid[ENGY][idx[0]][idx[1]][idx[2]] += theDiff; // Update the energy Fluid[ENPY][idx[0]][idx[1]][idx[2]] += theDiff; } #endif // #ifdef DUAL_ENERGY } // FUNCTION : FB_UVFeedback error message: error: expected primary-expression before ‘)’ token FB_UVFeedback( (Fluid*){[16][16][16]}, ionizeLuminosity, willExplode[n], idx, dh); ^ 以上,要是有人路过,也遇过相同bug的话, 请跟我分享你怎麽解决的,谢谢。 p.s. 今天是我第一次来这个版发文, 礼数不周请多指教。 --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.38.243.207 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Programming/M.1625401976.A.E95.html
1F:推 LPH66: 你的 [16][16][16] 那个东西是想传什麽? 180.177.0.237 07/04 20:38
那是一个在别的地方定义好的矩阵 被我负责的程式拿过来做处理 跟上面的*Fluid[PS2][PS2][PS2]是同一个东西 ※ 编辑: Vinygli (114.38.243.207 台湾), 07/04/2021 20:58:22
2F:推 LPH66: 那总该有个名字... 180.177.0.237 07/05 01:37
3F:推 sppmg: 这是C?很久没用了,我只想问:(*type){[ 101.12.43.160 07/05 02:33
4F:→ sppmg: ][ ][ ]} 这语法正确吗? 101.12.43.160 07/05 02:33
你说得对,我应该把它弄成一个parameter. 我再试试看好了,谢谢。 ※ 编辑: Vinygli (1.173.223.253 台湾), 07/05/2021 08:23:19 解决了!!! ※ 编辑: Vinygli (1.175.248.73 台湾), 07/05/2021 12:21:17







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:WOW站内搜寻

TOP