Beispiel #1
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]);
}
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]);
}