Пример #1
0
 static void exec(BlockT& block, value_type const& val)
 {
   for (vsip::index_type x=0; x<block.size(3, 2); ++x)
     for (vsip::index_type y=0; y<block.size(3, 1); ++y)
       for (vsip::index_type z=0; z<block.size(3, 0); ++z)
         block.put(z, y, x, val);
 }
Пример #2
0
typename BlockT::value_type
redim_get(BlockT const& blk, index_type l_idx, integral_constant<int, 3>)
{
  index_type idx[3];

  for (dimension_type d=3; d-->0;)
  {
    idx[d] = l_idx % blk.size(3, d);
    l_idx /= blk.size(3, d);
  }

  return blk.get(idx[0], idx[1], idx[2]);
}
Пример #3
0
void
rebind_interleaved(
  Domain<Dim> const& dom,
  BlockT&            block,
  int                k)
{
  length_type const size = block.size();

  T* data = new T[2*size];
  T* ptr;

  fill_interleaved_array<Order>(data, dom, CFiller<T>(k, 0, 1));

  block.rebind(data);
  
  test_assert(block.admitted()     == false);
  test_assert(block.user_storage() == interleaved_format);

  block.find(ptr);
  test_assert(ptr == data);

  block.admit(true);
  test_assert(block.admitted() == true);

  test_assert(check_block<Order>(block, dom, CFiller<T>(k, 0, 1)));
  fill_block<Order>(block, dom, CFiller<T>(k+1, 0, 1));

  block.release(true);
  test_assert(block.admitted() == false);

  test_assert(check_interleaved_array<Order>(data, dom, CFiller<T>(k+1, 0, 1)));

  delete[] data;
}
Пример #4
0
void
redim_put(BlockT &blk,
	  index_type l_idx,
	  typename BlockT::value_type value,
	  integral_constant<int, 3>)
{
  index_type idx[3];

  for (dimension_type d=3; d-->0;)
  {
    idx[d] = l_idx % blk.size(3, d);
    l_idx /= blk.size(3, d);
  }

  blk.put(idx[0], idx[1], idx[2], value);
}
typename BlockT::value_type
redim_get(BlockT const& blk, index_type l_idx, Int_type<2>)
{
  typedef typename Block_layout<BlockT>::order_type order_type;

  dimension_type dim[2];
  index_type     idx[2];
  dim[0] = order_type::impl_dim0;
  dim[1] = order_type::impl_dim1;

  for (dimension_type d=2; d-->0;)
  {
    idx[dim[d]] = l_idx % blk.size(2, dim[d]);
    l_idx /= blk.size(2, dim[d]);
  }

  return blk.get(idx[0], idx[1]);
}
void
redim_put(
  BlockT&                     blk,
  index_type                  l_idx,
  typename BlockT::value_type value,
  Int_type<2>)
{
  typedef typename Block_layout<BlockT>::order_type order_type;

  dimension_type dim[2];
  index_type     idx[2];
  dim[0] = order_type::impl_dim0;
  dim[1] = order_type::impl_dim1;

  for (dimension_type d=2; d-->0;)
  {
    idx[dim[d]] = l_idx % blk.size(2, dim[d]);
    l_idx /= blk.size(2, dim[d]);
  }

  blk.put(idx[0], idx[1], value);
}
Пример #7
0
void
rebind_split(
  Domain<Dim> const& dom,
  BlockT&            block,
  int                k)
{
  length_type const size = block.size();

  T* real = new T[size];
  T* imag = new T[size];

  T* real_ptr;
  T* imag_ptr;

  fill_split_array<Order>(real, imag, dom, CFiller<T>(k, 0, 1));

  block.rebind(real, imag);

  test_assert(block.admitted()     == false);
  test_assert(block.user_storage() == split_format); // rebind could change format

  block.find(real_ptr, imag_ptr);
  test_assert(real_ptr == real);
  test_assert(imag_ptr == imag);

  block.admit(true);
  test_assert(block.admitted() == true);

  test_assert(check_block<Order>(block, dom, CFiller<T>(k, 0, 1)));
  fill_block<Order>(block, dom, CFiller<T>(k+1, 0, 1));

  block.release(true);
  test_assert(block.admitted() == false);

  test_assert(check_split_array<Order>(real, imag, dom, CFiller<T>(k+1, 0, 1)));

  delete[] real;
  delete[] imag;
}
Пример #8
0
  static void exec(BlockT& block, value_type const& val)
  {
    for (vsip::index_type c=0; c<block.size(2, 1); ++c)
      for (vsip::index_type r=0; r<block.size(2, 0); ++r)
	block.put(r, c, val);
  }
Пример #9
0
 static void exec(BlockT& block, value_type const& val)
 {
   for (index_type i=0; i<block.size(1, 0); ++i)
     block.put(i, val);
 }