5.3. The Dense class template

Description. Dense models the Section 5.1.3, “Allocatable Block concept” concept. It explicitly stores one value for each index in its domain, in a dense memory block.

template <dimension_type D = 1,
          typename T = VSIP_DEFAULT_VALUE_TYPE,
	  typename Order = tuple<0,1,2>,
	  typename Map = Local_map>
class Dense
{
public:
  Dense(Domain<D> const &dom, T value, Map const &map);
  Dense(Domain<D> const &dom, Map const &map);
  Dense(Domain<D> const &dom, T *data, Map const &map);

  user_storage_type user_storage() const;
  bool admitted() const;
  void admit(bool update);
  void release(bool update);
  void release(bool update, T *&data);
  void find(T *&data);
  void rebind(T *data);
  void rebind(T *data, Domain<D> const &dom);

};

The interface for complex Dense blocks has some additional member functions to handle user storage.

template <dimension_type D,
          typename T,
  	  typename Order,
	  typename Map>
class Dense<D, complex<T>, Order, Map>
{
public:
  Dense(Domain<D> const &dom, complex<T> value, Map const &map);
  Dense(Domain<D> const &dom, Map const &map);
  Dense(Domain<D> const &dom, complex<T> *data, Map const &map);
  Dense(Domain<D> const &dom, T *data, Map const &map);
  Dense(Domain<D> const &dom, T *real, T *imag, Map const &map);

  user_storage_type user_storage() const;
  bool admitted() const;
  void admit(bool update);
  void release(bool update);
  void release(bool update, complex<T> *&data);
  void release(bool update, T *&data);
  void release(bool update, T *&real, T *&imag);
  void find(complex<T> *&data);
  void find(T *&data);
  void find(T *&real, T *&imag);
  void rebind(complex<T> *data);
  void rebind(T *data);
  void rebind(T *real, T *imag);
  void rebind(complex<T> *data, Domain<D> const &dom);
  void rebind(T *data, Domain<D> const &dom);
  void rebind(T *real, T *imag, Domain<D> const &dom);

};

Template parameters. 

D

The block's dimension.

T

The block's value-type.

Order

The dimension ordering. This is expressed using tuples, i.e. tuple<0,1,2>, tuple<1,0,2>, etc., or aliases such as row2_type or col2_type.

Map

The block's map-type.

5.3.1. Constructors

Dense(Domain<D> const &dom, Map const &map);

Description. Construct a Dense block.

Dense(Domain<D> const &dom, value_type value, Map const &map);

Description. Construct a Dense block, with all values initialized to value

Dense(Domain<D> const &dom, value_type *data, Map const &map);

Description. Construct a Dense block using user-storage. The block's data may only be accessed after a call to admit().

Dense(Domain<D> const &dom, scalar_type *data, Map const &map);
Dense(Domain<D> const &dom, scalar_type *real, scalar_type *imag, Map const &map);

Description. Construct a complex Dense block using user-storage. In the first case the data is passed in as an interleaved array. In the second case the data is passed in as a split pair of real arrays, holding the real and imaginary parts of the data. The block's data may only be accessed after a call to admit().

5.3.2. User-storage functions

user_storage_type user_storage() const;

Description. Return the type of user-storage of this block.

void admit(bool update);

Description. Admit the user-storage, allowing the block to access the data. If update is true, this operation may perform a copy into the block's own storage.

bool admitted() const;

Description. Return true if the block is being admitted.

void release(bool update);
void release(bool update, value_type *&data);

Description. Release the user storage. If update is true, this operation may perform a copy into the user storage. If a value-type pointer is provided, it is set to the start of the user storage block. If the block doesn't use user storage, set data to 0.

void release(bool update, scalar_type *&data);
void release(bool update, scalar_type *&real, scalar_type *&imag);

Description. If this is a complex block, two additional release() functions are provided. The first returns a pointer to interleaved-complex array, the second the two pointers to the split complex pair of arrays.

void find(value_type *&data);

Description. Return the start of the user-storage of this block. If the block does not use user-storage, return 0.

void find(scalar_type *&data);
void find(scalar_type *&real, scalar_type *&imag);

Description. These two variants are only available for complex blocks. The first returns the pointer to the interleaved complex array, the second the two pointers to the split complex pair of arrays.

void rebind(value_type *data);
void rebind(value_type *data, Domain<D> const &dom);

Description. Rebind the block to a new user-storage array. If a Domain is provided, reset the block's size accordingly.

void rebind(scalar_type *data);
void rebind(scalar_type *real, scalar_type *imag);
void rebind(scalar_type *data, Domain<D> const &dom);
void rebind(scalar_type *real, scalar_type *imag, Domain<D> const &dom);

Description. These variants are only available for complex blocks. The first rebinds the block to the interleaved complex array, the second to two split-complex arrays. If a Domain is provided, reset the block's size accordingly.