本文整理汇总了C++中DataArray::set_all方法的典型用法代码示例。如果您正苦于以下问题:C++ DataArray::set_all方法的具体用法?C++ DataArray::set_all怎么用?C++ DataArray::set_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataArray
的用法示例。
在下文中一共展示了DataArray::set_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reset
void reset()
{
simVars.timecontrol.current_timestep_nr = 0;
#if 0
prog_h.set_all(simVars.setup.h0);
if (std::isinf(simVars.bogus.var[0]))
{
prog_u.set_all(0);
prog_v.set_all(0);
}
else
{
prog_u.set_all(simVars.bogus.var[0]);
prog_v.set_all(simVars.bogus.var[1]);
}
#endif
for (std::size_t j = 0; j < simVars.disc.res[1]; j++)
{
for (std::size_t i = 0; i < simVars.disc.res[0]; i++)
{
// double x = (((double)i+0.5)/(double)simVars.disc.res[0])*simVars.sim.domain_size[0];
// double y = (((double)j+0.5)/(double)simVars.disc.res[1])*simVars.sim.domain_size[1];
double x = (((double)i)/(double)simVars.disc.res[0])*simVars.sim.domain_size[0];
double y = (((double)j)/(double)simVars.disc.res[1])*simVars.sim.domain_size[1];
prog_h.set(j, i, SWEValidationBenchmarks::return_h(simVars, x, y));
// prog_u.set(j, i, SWEValidationBenchmarks::return_u(simVars, x, y));
// prog_v.set(j, i, SWEValidationBenchmarks::return_v(simVars, x, y));
}
}
// prog_u += 4.0;
// prog_v += 4.0;
prog_u = param_velocity_u;
prog_v = param_velocity_v;
prog_u_prev = prog_u;
prog_v_prev = prog_v;
pos_a[0] = &posx_a;
pos_a[1] = &posy_a;
// setup some test sampling points
// we use 2 arrays - one for each sampling position
for (std::size_t j = 0; j < simVars.disc.res[1]; j++)
{
for (std::size_t i = 0; i < simVars.disc.res[0]; i++)
{
posx_a.set(j, i, ((double)i)*((double)simVars.sim.domain_size[0]/(double)simVars.disc.res[0]));
posy_a.set(j, i, ((double)j)*((double)simVars.sim.domain_size[1]/(double)simVars.disc.res[1]));
}
}
sampler2D.setup(simVars.sim.domain_size, simVars.disc.res);
semiLagrangian.setup(simVars.sim.domain_size, simVars.disc.res);
}