本文整理汇总了C++中volume::in_direction_min方法的典型用法代码示例。如果您正苦于以下问题:C++ volume::in_direction_min方法的具体用法?C++ volume::in_direction_min怎么用?C++ volume::in_direction_min使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volume
的用法示例。
在下文中一共展示了volume::in_direction_min方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_integral
void check_integral(fields &f,
linear_integrand_data &d, const volume &v,
component cgrid)
{
double x1 = v.in_direction_min(d.dx);
double x2 = v.in_direction_max(d.dx);
double y1 = v.in_direction_min(d.dy);
double y2 = v.in_direction_max(d.dy);
double z1 = v.in_direction_min(d.dz);
double z2 = v.in_direction_max(d.dz);
master_printf("Check %d-dim. %s integral in %s cell with %s integrand...",
(x2 - x1 > 0) + (y2 - y1 > 0) + (z2 - z1 > 0),
component_name(cgrid),
v.dim == D3 ? "3d" : (v.dim == D2 ? "2d" :
(v.dim == Dcyl ? "cylindrical"
: "1d")),
(d.c == 1.0 && !d.axy && !d.ax && !d.ay && !d.az
&& !d.axy && !d.ayz && !d.axz) ? "unit" : "linear");
if (0)
master_printf("\n... grid_volume (%g,%g,%g) at (%g,%g,%g) with integral (%g, %g,%g,%g, %g,%g,%g, %g)...\n",
x2 - x1, y2 - y1, z2 - z1,
(x1+x2)/2, (y1+y2)/2, (z1+z2)/2,
d.c, d.ax,d.ay,d.az, d.axy,d.ayz,d.axz, d.axyz);
double sum = real(f.integrate(0, 0, linear_integrand, (void *) &d, v));
if (fabs(sum - correct_integral(v, d)) > 1e-9 * fabs(sum))
abort("FAILED: %0.16g instead of %0.16g\n",
(double) sum, correct_integral(v, d));
master_printf("...PASSED.\n");
}
示例2: correct_integral
static double correct_integral(const volume &v,
const linear_integrand_data &data)
{
direction x = data.dx, y = data.dy, z = data.dz;
double x1 = v.in_direction_min(x);
double x2 = v.in_direction_max(x);
double y1 = v.in_direction_min(y);
double y2 = v.in_direction_max(y);
double z1 = v.in_direction_min(z);
double z2 = v.in_direction_max(z);
return (data.c * integral1(x1,x2,x) * integral1(y1,y2,y) * integral1(z1,z2,z)
+ data.ax * integralx(x1,x2,x) * integral1(y1,y2,y) * integral1(z1,z2,z)
+ data.ay * integral1(x1,x2,x) * integralx(y1,y2,y) * integral1(z1,z2,z)
+ data.az * integral1(x1,x2,x) * integral1(y1,y2,y) * integralx(z1,z2,z)
+ data.axy * integralx(x1,x2,x) * integralx(y1,y2,y) * integral1(z1,z2,z)
+ data.ayz * integral1(x1,x2,x) * integralx(y1,y2,y) * integralx(z1,z2,z)
+ data.axz * integralx(x1,x2,x) * integral1(y1,y2,y) * integralx(z1,z2,z)
+ data.axyz * integralx(x1,x2,x) * integralx(y1,y2,y) * integralx(z1,z2,z)
);
}