For live rendering.

This commit is contained in:
Miikka Vaisala
2019-08-16 11:14:26 +08:00
parent 53bd3d4aa4
commit 42ba2ee5aa

View File

@@ -359,6 +359,10 @@ run_renderer(void)
AcMesh* mesh = acmesh_create(mesh_info); AcMesh* mesh = acmesh_create(mesh_info);
acmesh_init_to(InitType(init_type), mesh); acmesh_init_to(InitType(init_type), mesh);
#if LSINK
vertex_buffer_set(VTXBUF_ACCRETION, 0.0, mesh);
#endif
acInit(mesh_info); acInit(mesh_info);
acLoad(*mesh); acLoad(*mesh);
@@ -375,6 +379,9 @@ run_renderer(void)
int steps = 0; int steps = 0;
k_slice = mesh->info.int_params[AC_mz] / 2; k_slice = mesh->info.int_params[AC_mz] / 2;
k_slice_max = mesh->info.int_params[AC_mz]; k_slice_max = mesh->info.int_params[AC_mz];
#if LSINK
AcReal accreted_mass = 0.0;
#endif
while (running(mesh)) { while (running(mesh)) {
/* Input */ /* Input */
@@ -386,6 +393,16 @@ run_renderer(void)
const AcReal umax = acReduceVec(RTYPE_MAX, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ); const AcReal umax = acReduceVec(RTYPE_MAX, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ);
const AcReal dt = host_timestep(umax, mesh_info); const AcReal dt = host_timestep(umax, mesh_info);
#if LSINK
const AcReal sum_mass = acReduceScal(RTYPE_MAX, VTXBUF_ACCRETION);
accreted_mass = accreted_mass + sum_mass;
AcReal sink_mass = AC_M_sink_init + accreted_mass;
printf("sink mass is: %e \n", sink_mass);
printf("accreted mass is: %e \n", accreted_mass);
acLoadDeviceConstant(AC_M_sink, sink_mass);
vertex_buffer_set(VTXBUF_ACCRETION, 0.0, mesh);
#endif
#if LFORCING #if LFORCING
const ForcingParams forcing_params = generateForcingParams(mesh->info); const ForcingParams forcing_params = generateForcingParams(mesh->info);
loadForcingParamsToDevice(forcing_params); loadForcingParamsToDevice(forcing_params);