本文整理汇总了C++中G::value方法的典型用法代码示例。如果您正苦于以下问题:C++ G::value方法的具体用法?C++ G::value怎么用?C++ G::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
const Point<2> p1(0.0, 0.0), p2(1.0, 1.0);
dealii::Triangulation<2> triangulation;
dealii::GridGenerator::hyper_rectangle(triangulation, p1, p2);
triangulation.refine_global(num_levels);
const F<2> f;
const G<2> g;
// Create a TensorFunction from two scalar Functions
const auto psi = internal::TensorFunctionFromScalarFunctions<2>(f, g);
// Generate a bunch of random poins in the unit square
std::random_device device;
std::mt19937 rng;
rng.seed(device());
std::uniform_real_distribution<> u(0, 1);
const size_t num_points = 32;
std::vector<Point<2> > points(num_points);
for (size_t k = 0; k < num_points; ++k) {
points[k][0] = u(rng);
points[k][1] = u(rng);
}
// Check that the TensorFunction and its coordinate functions agree at a
// few points
for (size_t k = 0; k < num_points; ++k) {
const Point<2>& p = points[k];
const Tensor<1, 2> v = psi.value(p);
Tensor<1, 2> w;
w[0] = f.value(p);
w[1] = g.value(p);
check((v - w).norm() < 1.0e-15);
}
return 0;
}