15 #ifndef QMCPLUSPLUS_CONTAINER_TRAITS_MULTI_H 16 #define QMCPLUSPLUS_CONTAINER_TRAITS_MULTI_H 18 #include <multi/array.hpp> 19 #include <multi/array_ref.hpp> 25 template<
typename T, boost::multi::dimensionality_type D,
class Alloc>
29 using CT = boost::multi::array<T, D, Alloc>;
36 std::ostringstream err_msg;
37 err_msg <<
"boost::multi::array<T, " << D <<
", Alloc> cannot be resized. Requested dimension = " << d
39 throw std::runtime_error(err_msg.str());
41 std::array<I, 2> shape;
42 for (
int i = 0; i < d; ++i)
44 ref.reextent({
static_cast<boost::multi::size_t
>(shape[0]), static_cast<boost::multi::size_t>(shape[1])});
47 inline static size_t getSize(
const CT& ref) {
return ref.num_elements(); }
49 inline static auto getElementPtr(
CT& ref) {
return std::addressof(*ref.origin()); }
52 template<
typename T, boost::multi::dimensionality_type D>
56 using CT = boost::multi::array_ref<T, D>;
61 throw std::runtime_error(
"Can not resize container_proxy<boost::multi::array_ref<T,D>>!\n");
64 inline static size_t getSize(
const CT& ref) {
return ref.num_elements(); }
66 inline static auto getElementPtr(
CT& ref) {
return std::addressof(*ref.origin()); }
static auto getElementPtr(CT &ref)
static void resize(CT &ref, I *n, int d)
helper functions for EinsplineSetBuilder
static size_t getSize(const CT &ref)
static void resize(CT &ref, I *n, int d)
boost::multi::array< T, D, Alloc > CT
static auto getElementPtr(CT &ref)
boost::multi::array_ref< T, D > CT
static size_t getSize(const CT &ref)