本文整理汇总了C++中ArrayViewTest类的典型用法代码示例。如果您正苦于以下问题:C++ ArrayViewTest类的具体用法?C++ ArrayViewTest怎么用?C++ ArrayViewTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayViewTest类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
ArrayViewTest<int, 2> av(extent<2>(10, 10));
ArrayViewTest<int, 1, 2> projection = av.section(index<2>(), extent<2>(5, 5)).projection(1);
projection.view()[1] = 15;
projection.set_known_value(index<1>(1), 15);
return av.view()[index<2>(1, 1)] == 15 ? av.pass() : av.fail();
}
示例2: test_main
runall_result test_main()
{
ArrayViewTest<const int, 1> original(extent<1>(10));
ArrayViewTest<const int, 1> section = original.section(extent<1>(5));
// set values through the data pointer
original.set_value(index<1>(4), 13);
section.set_value(index<1>(3), 15);
return (original.view()(3) == 15 && section.view()(4) == 13) ? original.pass() : original.fail();
}
示例3: only_extent
runall_result only_extent()
{
ArrayTest<int, 1> original(extent<1>(10));
ArrayViewTest<int, 1> section = original.section(original.arr().section(extent<1>(5)), index<1>(0));
original.set_value(index<1>(2), 13);
section.view()(3) = 15;
section.set_known_value(index<1>(3), 15);
return (gpu_read(original.arr(),index<1>(3)) == 15 && section.view()(2) == 13) ? original.pass() : original.fail();
}
示例4: only_extent
runall_result only_extent()
{
ArrayViewTest<int, 3> original(extent<3>(2, 3, 4));
ArrayViewTest<int, 3> section = original.section(original.view().section(extent<3>(2, 2, 2)), index<3>(0, 0, 0));
original.view()(1, 2, 2) = 13;
original.set_known_value(index<3>(1, 2, 2), 13);
section.view()(0, 0, 0) = 15;
section.set_known_value(index<3>(0, 0, 0), 15);
return (original.view()(0, 0, 0) == 15 && section.view()(1, 2, 2) == 13) ? original.pass() : original.fail();
}
示例5: only_extent
runall_result only_extent()
{
ArrayViewTest<int, 2> original(extent<2>(10, 10));
ArrayViewTest<int, 2> section = original.section(original.view().section(extent<2>(5, 3)), index<2>(0, 0));
original.view()(3, 2) = 13;
original.set_known_value(index<2>(3, 2), 13);
section.view()(3, 1) = 15;
section.set_known_value(index<2>(3, 1), 15);
return (original.view()(3, 1) == 15 && section.view()(3, 2) == 13) ? original.pass() : original.fail();
}
示例6: scalar_values
runall_result scalar_values()
{
ArrayViewTest<int, 2> original(extent<2>(10, 10));
ArrayViewTest<int, 2> section = original.section(original.view().section(2, 3, 5, 2), index<2>(2, 3));
original.view()(3, 4) = 13;
original.set_known_value(index<2>(3, 4), 13);
section.view()(3, 1) = 15;
section.set_known_value(index<2>(3, 1), 15);
return (original.view()(5, 4) == 15 && section.view()(1, 1) == 13) ? original.pass() : original.fail();
}
示例7: main
int main()
{
ArrayViewTest<int, 2> original(extent<2>(3, 3));
ArrayViewTest<int, 2> section = original.section(original.view().section(index<2>(1, 1)), index<2>(1, 1));
// set a value through the section -- this is (1,1) in the original view
section.view()[index<2>(0, 0)] = 5;
section.set_known_value(index<2>(0, 0), 5);
// set a value through the original -- this is (1, 0) in the section
original.view()[index<2>(2, 1)] = 2;
original.set_known_value(index<2>(2, 1), 2);
return
original.view()[index<2>(1, 1)] == 5 &&
section.view()[index<2>(1, 0)] == 2
? original.pass() : original.fail();
}
示例8: main
int main()
{
ArrayViewTest<const int, 3> original(extent<3>(2, 3, 4));
// create a projection
ArrayViewTest<const int, 2, 3> projection = original.projection(original.view()[1], 1);
// set some data in the original
original.set_value(index<3>(1, 1, 2), 13);
// set some data in the projections
projection.set_value(index<2>(1, 1), 11);
// verify each data point through the array_view interface
return
original.view()(1, 1, 1) == 11 &&
projection.view()(1, 2) == 13
? original.pass() : original.fail();
}