QMCPACK
container_traits< boost::multi::array< T, D, Alloc > > Struct Template Reference
+ Collaboration diagram for container_traits< boost::multi::array< T, D, Alloc > >:

Public Types

using element_type = T
 
using CT = boost::multi::array< T, D, Alloc >
 

Static Public Member Functions

template<typename I >
static void resize (CT &ref, I *n, int d)
 
static size_t getSize (const CT &ref)
 
static auto getElementPtr (CT &ref)
 

Detailed Description

template<typename T, boost::multi::dimensionality_type D, class Alloc>
struct qmcplusplus::container_traits< boost::multi::array< T, D, Alloc > >

Definition at line 26 of file container_traits_multi.h.

Member Typedef Documentation

◆ CT

using CT = boost::multi::array<T, D, Alloc>

Definition at line 29 of file container_traits_multi.h.

◆ element_type

using element_type = T

Definition at line 28 of file container_traits_multi.h.

Member Function Documentation

◆ getElementPtr()

static auto getElementPtr ( CT ref)
inlinestatic

Definition at line 49 of file container_traits_multi.h.

49 { return std::addressof(*ref.origin()); }

◆ getSize()

static size_t getSize ( const CT ref)
inlinestatic

Definition at line 47 of file container_traits_multi.h.

47 { return ref.num_elements(); }

◆ resize()

static void resize ( CT ref,
I n,
int  d 
)
inlinestatic

Definition at line 32 of file container_traits_multi.h.

References qmcplusplus::n.

33  {
34  if (d != D)
35  {
36  std::ostringstream err_msg;
37  err_msg << "boost::multi::array<T, " << D << ", Alloc> cannot be resized. Requested dimension = " << d
38  << std::endl;
39  throw std::runtime_error(err_msg.str());
40  }
41  std::array<I, 2> shape;
42  for (int i = 0; i < d; ++i)
43  shape[i] = n[i];
44  ref.reextent({static_cast<boost::multi::size_t>(shape[0]), static_cast<boost::multi::size_t>(shape[1])});
45  }

The documentation for this struct was generated from the following file: