本文整理汇总了C++中View1类的典型用法代码示例。如果您正苦于以下问题:C++ View1类的具体用法?C++ View1怎么用?C++ View1使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了View1类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tbb_copy_pixels
GIL_FORCEINLINE void tbb_copy_pixels( const View1& src, const View2& dst)
{
assert(src.dimensions()==dst.dimensions());
tbb::parallel_for( tbb::blocked_range<std::size_t>( 0, src.height()),
detail::make_tbb_copy_pixels_fun( src, dst),
GIL_TBB_ALGORITHMS_DEFAULT_PARTITIONER());
}
示例2: if
ExecStatus
Nq<View0,View1>::post(Home home, View0 x0, View1 x1){
if (x0.assigned() && x1.assigned()) {
if (overlap(x0.val(),x1.val()))
return ES_FAILED;
} else if (same(x0,x1)) {
return ES_FAILED;
} else {
(void) new (home) Nq<View0,View1>(home,x0,x1);
}
return ES_OK;
}
示例3: operator
void operator () (View1 to, View2 from)
{
auto w = std::min(to.GetWidth(), from.GetWidth());
auto h = std::min(to.GetHeight(), from.GetHeight());
for (size_t i = 0; i < h; i++)
{
auto p1 = to.BeginRow(i);
auto p2 = from.BeginRow(i);
for (size_t j = 0; j < w; j++, p1++, p2++)
{
*p1 = *p2;
}
}
}
示例4: check_not_alias
void
check_not_alias(
View1<T1, Block1>& vec1,
View2<T2, Block2>& vec2)
{
fill_block(vec1.block(), 2);
fill_block(vec2.block(), 3);
// Make sure that updates to vec2 do not affect vec1.
test_assert(check_vector(vec1, 2));
// And visa-versa.
fill_block(vec1.block(), 4);
test_assert(check_vector(vec2, 3));
}
示例5: transform_pixels_progress
GIL_FORCEINLINE
F transform_pixels_progress( const View1& src, const View2& dst, const F& fun, IProgress& p )
{
assert( src.dimensions() == dst.dimensions() );
for( std::ptrdiff_t y = 0; y < src.height(); ++y )
{
typename View1::x_iterator srcIt = src.row_begin( y );
typename View2::x_iterator dstIt = dst.row_begin( y );
for( std::ptrdiff_t x = 0; x < src.width(); ++x )
dstIt[x] = fun( srcIt[x] );
if( p.progressForward( dst.width() ) )
return fun;
}
return fun;
}
示例6: apply_ukernel
void
apply_ukernel(View0 in0,
View1 in1,
View2 in2,
View3 out)
{
dda::Ext_data<typename View0::block_type> ext0(in0.block());
dda::Ext_data<typename View1::block_type> ext1(in1.block());
dda::Ext_data<typename View2::block_type> ext2(in2.block());
dda::Ext_data<typename View3::block_type> ext3(out.block());
assert(ext0.stride(1) == 1);
assert(ext1.stride(1) == 1);
assert(ext2.stride(1) == 1);
assert(ext3.stride(1) == 1);
example::Cblock kernel((uintptr_t)ext0.data(), ext0.stride(0),
(uintptr_t)ext1.data(), ext1.stride(0),
(uintptr_t)ext2.data(), ext2.stride(0),
(uintptr_t)ext3.data(), ext3.stride(0),
out.size(0), out.size(1));
vsip_csl::ukernel::Ukernel<example::Cblock> uk(kernel);
uk();
}
示例7: tbb_transform3_pixels
GIL_FORCEINLINE void tbb_transform3_pixels( const View1& src1, const View2& src2,
const View3& src3, const View4& dst, Fun f)
{
tbb::parallel_for( tbb::blocked_range<std::size_t>( 0, src1.height()),
detail::make_tbb_transform3_pixels_fun( src1, src2, src3, dst, f),
GIL_TBB_ALGORITHMS_DEFAULT_PARTITIONER());
}
示例8: apply_ukernel
void
apply_ukernel(View0 in0,
View1 in1,
View2 in2,
View3 out)
{
dda::Data<typename View0::block_type, dda::in> data0(in0.block());
dda::Data<typename View1::block_type, dda::in> data1(in1.block());
dda::Data<typename View2::block_type, dda::in> data2(in2.block());
dda::Data<typename View3::block_type, dda::out> data3(out.block());
assert(data0.stride(1) == 1);
assert(data1.stride(1) == 1);
assert(data2.stride(1) == 1);
assert(data3.stride(1) == 1);
example::Cblock kernel((uintptr_t)data0.ptr(), data0.stride(0),
(uintptr_t)data1.ptr(), data1.stride(0),
(uintptr_t)data2.ptr(), data2.stride(0),
(uintptr_t)data3.ptr(), data3.stride(0),
out.size(0), out.size(1));
vsip_csl::ukernel::Ukernel<example::Cblock> uk(kernel);
uk();
}
示例9: transform_pixels_locator
GIL_FORCEINLINE F transform_pixels_locator(const View1& src1, const Rect<std::ptrdiff_t>& src1Rod, const View2& src2,
const Rect<std::ptrdiff_t>& src2Rod, const View2& src3,
const Rect<std::ptrdiff_t>& src3Rod, const ViewDst& dst,
const Rect<std::ptrdiff_t>& dstRod, const Rect<std::ptrdiff_t>& renderWin,
const F& fun)
{
const std::ptrdiff_t renderWidth = renderWin.x2 - renderWin.x1;
typename View1::xy_locator s1loc = src1.xy_at(renderWin.x1 - src1Rod.x1, renderWin.y1 - src1Rod.y1);
typename View2::xy_locator s2loc = src2.xy_at(renderWin.x1 - src2Rod.x1, renderWin.y1 - src2Rod.y1);
typename View3::xy_locator s3loc = src3.xy_at(renderWin.x1 - src3Rod.x1, renderWin.y1 - src3Rod.y1);
for(std::ptrdiff_t y = renderWin.y1; y < renderWin.y2; ++y)
{
typename ViewDst::x_iterator dstIt = dst.x_at(dstRod.x1, y - dstRod.y1);
for(std::ptrdiff_t x = renderWin.x1; x < renderWin.x2; ++x, ++s1loc.x(), ++s2loc.x(), ++s3loc.x(), ++dstIt)
{
*dstIt = fun(s1loc, s2loc, s3loc);
}
s1loc.x() -= renderWidth;
++s1loc.y();
s2loc.x() -= renderWidth;
++s2loc.y();
s3loc.x() -= renderWidth;
++s3loc.y();
}
return fun;
}
示例10: transform_pixels_locator_progress
GIL_FORCEINLINE
F transform_pixels_locator_progress( const View1& src1, const OfxRectI& src1Rod,
const View2& src2, const OfxRectI& src2Rod,
const ViewDst& dst, const OfxRectI& dstRod,
const OfxRectI& renderWin, const F& fun, IProgress& p )
{
const std::ptrdiff_t renderWidth = renderWin.x2 - renderWin.x1;
typename View1::xy_locator s1loc = src1.xy_at( renderWin.x1-src1Rod.x1, renderWin.y1-src1Rod.y1 );
typename View2::xy_locator s2loc = src2.xy_at( renderWin.x1-src2Rod.x1, renderWin.y1-src2Rod.y1 );
for( std::ptrdiff_t y = renderWin.y1; y < renderWin.y2; ++y )
{
typename ViewDst::x_iterator dstIt = dst.x_at( dstRod.x1, y-dstRod.y1 );
for( std::ptrdiff_t x = renderWin.x1;
x < renderWin.x2;
++x, ++s1loc.x(), ++s2loc.x(), ++dstIt )
{
*dstIt = fun( s1loc, s2loc );
}
s1loc.x() -= renderWidth; ++s1loc.y();
s2loc.x() -= renderWidth; ++s2loc.y();
if( p.progressForward( renderWidth ) )
return fun;
}
return fun;
}
示例11: checkNewViewWasAllocated
inline void checkNewViewWasAllocated( View1 const &v1, View2 const &v2 )
{
BOOST_TEST( v1.data() != v2.data() );
BOOST_TEST( (int)View1::rank == (int)View2::rank );
BOOST_TEST( ( std::is_same<typename View1::const_value_type,
typename View2::const_value_type>::value ) );
BOOST_TEST( v1.dimension_0() == v2.dimension_0() );
BOOST_TEST( v1.dimension_1() == v2.dimension_1() );
BOOST_TEST( v1.dimension_2() == v2.dimension_2() );
BOOST_TEST( v1.dimension_3() == v2.dimension_3() );
BOOST_TEST( v1.dimension_4() == v2.dimension_4() );
BOOST_TEST( v1.dimension_5() == v2.dimension_5() );
BOOST_TEST( v1.dimension_6() == v2.dimension_6() );
BOOST_TEST( v1.dimension_7() == v2.dimension_7() );
}
示例12: check_alias
void
check_alias(
View1<T1, Block1>& vec1,
View2<T2, Block2>& vec2)
{
fill_block(vec1.block(), 2);
test_assert(check_vector(vec1, 2));
test_assert(check_vector(vec2, 2));
fill_block(vec2.block(), 3);
test_assert(check_vector(vec1, 3));
test_assert(check_vector(vec2, 3));
}
示例13: switch
ExecStatus PartitionN<View0,View1>::post(Home home, ViewArray<View0>& x,
View1 y) {
switch (x.size()) {
case 0:
GECODE_ME_CHECK(y.cardMax(home, 0));
return ES_OK;
case 1:
return Rel::Eq<View0,View1>::post(home, x[0], y);
default:
(void) new (home) PartitionN<View0,View1>(home,x,y);
return ES_OK;
}
}
示例14: checkViewWasNotAllocated
inline void checkViewWasNotAllocated( View1 const &v1, View2 const &v2 )
{
// NOTE: cannot use operator== here because array layout may "change" for
// rank-1 views
BOOST_TEST( v1.data() == v2.data() );
BOOST_TEST( v1.span() == v2.span() );
BOOST_TEST( (int)View1::rank == (int)View2::rank );
BOOST_TEST( ( std::is_same<typename View1::const_value_type,
typename View2::const_value_type>::value ) );
BOOST_TEST( ( std::is_same<typename View1::memory_space,
typename View2::memory_space>::value ) );
BOOST_TEST( v1.dimension_0() == v2.dimension_0() );
BOOST_TEST( v1.dimension_1() == v2.dimension_1() );
BOOST_TEST( v1.dimension_2() == v2.dimension_2() );
BOOST_TEST( v1.dimension_3() == v2.dimension_3() );
BOOST_TEST( v1.dimension_4() == v2.dimension_4() );
BOOST_TEST( v1.dimension_5() == v2.dimension_5() );
BOOST_TEST( v1.dimension_6() == v2.dimension_6() );
BOOST_TEST( v1.dimension_7() == v2.dimension_7() );
}
示例15: checkNewViewWasAllocated
inline void checkNewViewWasAllocated( View1 const &v1, View2 const &v2,
bool &success,
Teuchos::FancyOStream &out )
{
TEST_INEQUALITY( v1.data(), v2.data() );
TEST_EQUALITY( (int)View1::rank, (int)View2::rank );
TEST_ASSERT( ( std::is_same<typename View1::const_value_type,
typename View2::const_value_type>::value ) );
TEST_EQUALITY( v1.dimension_0(), v2.dimension_0() );
TEST_EQUALITY( v1.dimension_1(), v2.dimension_1() );
TEST_EQUALITY( v1.dimension_2(), v2.dimension_2() );
TEST_EQUALITY( v1.dimension_3(), v2.dimension_3() );
TEST_EQUALITY( v1.dimension_4(), v2.dimension_4() );
TEST_EQUALITY( v1.dimension_5(), v2.dimension_5() );
TEST_EQUALITY( v1.dimension_6(), v2.dimension_6() );
TEST_EQUALITY( v1.dimension_7(), v2.dimension_7() );
}