MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / extents

Class extents

compute/include/boost/compute/utility/extents.hpp:32–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30/// \see dim()
31template<size_t N>
32class extents
33{
34public:
35 typedef size_t size_type;
36 static const size_type static_size = N;
37 typedef boost::array<size_t, N> array_type;
38 typedef typename array_type::iterator iterator;
39 typedef typename array_type::const_iterator const_iterator;
40
41 /// Creates an extents object with each component set to zero.
42 ///
43 /// For example:
44 /// \code
45 /// extents<3> exts(); // (0, 0, 0)
46 /// \endcode
47 extents()
48 {
49 m_extents.fill(0);
50 }
51
52 /// Creates an extents object with each component set to \p value.
53 ///
54 /// For example:
55 /// \code
56 /// extents<3> exts(1); // (1, 1, 1)
57 /// \endcode
58 explicit extents(size_t value)
59 {
60 m_extents.fill(value);
61 }
62
63 #ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST
64 /// Creates an extents object with \p values.
65 extents(std::initializer_list<size_t> values)
66 {
67 BOOST_ASSERT(values.size() == N);
68
69 std::copy(values.begin(), values.end(), m_extents.begin());
70 }
71 #endif // BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST
72
73 /// Returns the size (i.e. dimensionality) of the extents array.
74 size_type size() const
75 {
76 return N;
77 }
78
79 /// Returns the linear size of the extents. This is equivalent to the
80 /// product of each extent in each dimension.
81 size_type linear() const
82 {
83 return std::accumulate(
84 m_extents.begin(), m_extents.end(), 1, std::multiplies<size_type>()
85 );
86 }
87
88 /// Returns a pointer to the extents data array.
89 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected