本文整理汇总了C++中Grid3D::set_dt方法的典型用法代码示例。如果您正苦于以下问题:C++ Grid3D::set_dt方法的具体用法?C++ Grid3D::set_dt怎么用?C++ Grid3D::set_dt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid3D
的用法示例。
在下文中一共展示了Grid3D::set_dt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
#ifdef OUTPUT
// write the initial conditions to file
chprintf("Writing initial conditions to file...\n");
WriteData(G, P, nfile);
// add one to the output file count
nfile++;
#endif //OUTPUT
// increment the next output time
outtime += P.outstep;
#ifdef CPU_TIME
stop_init = get_time();
init = stop_init - start_total;
#ifdef MPI_CHOLLA
init_min = ReduceRealMin(init);
init_max = ReduceRealMax(init);
init_avg = ReduceRealAvg(init);
chprintf("Init min: %9.4f max: %9.4f avg: %9.4f\n", init_min, init_max, init_avg);
#else
printf("Init %9.4f\n", init);
#endif //MPI_CHOLLA
#endif //CPU_TIME
// Evolve the grid, one timestep at a time
chprintf("Starting caclulations.\n");
while (G.H.t < P.tout)
//while (G.H.n_step < 1)
{
// get the start time
start_step = get_time();
// calculate the timestep
G.set_dt(C_cfl, dti);
if (G.H.t + G.H.dt > outtime)
{
G.H.dt = outtime - G.H.t;
}
// Advance the grid by one timestep
#ifdef CPU_TIME
start_hydro = get_time();
#endif //CPU_TIME
dti = G.Update_Grid();
#ifdef CPU_TIME
stop_hydro = get_time();
hydro = stop_hydro - start_hydro;
#ifdef MPI_CHOLLA
hydro_min = ReduceRealMin(hydro);
hydro_max = ReduceRealMax(hydro);
hydro_avg = ReduceRealAvg(hydro);
#endif //MPI_CHOLLA
#endif //CPU_TIME
// update the time
G.H.t += G.H.dt;
// add one to the timestep count
G.H.n_step++;
// set boundary conditions for next time step
#ifdef CPU_TIME
start_bound = get_time();
#endif //CPU_TIME
G.Set_Boundary_Conditions(P);