OMARE Overlay
JASMIN 版本要求 >= 4.5.2
# 修改目的数据片为读写模式
with open("Overlayregister.h", "w") as f: | |
f.write("/// 注册数据片通信关系\n") | |
# U | |
for field in u_field_list: | |
f.write("intc->registerCoarsenPatchData(manager->"+field+"_id,\n") | |
f.write(" \""+OVERLAY_DOUBLE_INTERP_U+"\",\n") | |
f.write(" manager->"+field+"_id,\n") | |
f.write(" hier::DataAccessMode::RW);\n") | |
# V | |
for field in v_field_list: | |
f.write("intc->registerCoarsenPatchData(manager->"+field+"_id,\n") | |
f.write(" \""+OVERLAY_DOUBLE_INTERP_V+"\",\n") | |
f.write(" manager->"+field+"_id,\n") | |
f.write(" hier::DataAccessMode::RW);\n") | |
# T | |
for field in t_field_list: | |
f.write("intc->registerCoarsenPatchData(manager->"+field+"_id,\n") | |
f.write(" \""+OVERLAY_DOUBLE_INTERP_CENTER+"\",\n") | |
f.write(" manager->"+field+"_id,\n") | |
f.write(" hier::DataAccessMode::RW);\n") |
# Fortran 实现
DO jc = jc0, jc1 | |
DO ic = ic0, ic1 | |
sum_ = SUM(uf((ic-1)*ratio(1)+1 -ir00+1:ic*ratio(1)-ir00+1,(jc-1)*ratio(2)+1 -jr00+1:jc*ratio(2)-jr00+1)) | |
! coarse local index | |
ic_loc = ic - ic00 +1 | |
jc_loc = jc - jc00 +1 | |
uc(ic_loc, jc_loc) = sum_ / REAL(ratio(1)*ratio(2),wp) * 0.99 + uc(ic_loc, jc_loc) * 0.01 | |
ENDDO | |
ENDDO |