18 #ifndef QMCPLUSPLUS_TENSOR_SOA_CONTAINER_H 19 #define QMCPLUSPLUS_TENSOR_SOA_CONTAINER_H 22 template<
typename T,
unsigned D>
56 std::fill(m_data.begin(), m_data.end(),
static_cast<T
>(in));
65 nGhosts = getAlignedSize<T>(
n);
66 m_data.resize(nGhosts * 6);
73 const T* restrict b = m_data + i;
75 T xy = *(b + 1 * nGhosts);
76 T xz = *(b + 2 * nGhosts);
77 T yy = *(b + 3 * nGhosts);
78 T yz = *(b + 4 * nGhosts);
79 T zz = *(b + 5 * nGhosts);
89 Accessor(
const Accessor&) =
delete;
90 inline Accessor(T* a,
int ng) : _base(a), M(ng) {}
96 *(_base + M) = rhs(1);
97 *(_base + 2 * M) = rhs(2);
98 *(_base + 3 * M) = rhs(4);
99 *(_base + 4 * M) = rhs(5);
100 *(_base + 5 * M) = rhs(8);
105 template<
typename T1>
110 *(_base + 2 * M) = rhs;
111 *(_base + 3 * M) = rhs;
112 *(_base + 4 * M) = rhs;
113 *(_base + 5 * M) = rhs;
122 inline Accessor
operator()(
int i) {
return Accessor(m_data.data() + i, nGhosts); }
125 inline T*
data() {
return m_data.data(); }
127 inline const T*
data()
const {
return m_data.data(); }
129 inline T* restrict
data(
int i,
int j)
131 const int n = (i < j) ? i * 3 + j : j * 3 + i;
132 return m_data().data() +
n * nGhosts;
135 inline const T* restrict
data(
int i,
int j)
const 137 const int n = (i < j) ? i * 3 + j : j * 3 + i;
138 return m_data().data() +
n * nGhosts;
142 template<
class Archive>
146 ar& nLocal& nGhosts& m_data;
Accessor & operator=(T1 rhs)
assign value
TensorSoaContainer(int n)
constructor with size n without initialization
Tensor< T, 3 > operator[](int i) const
return TinyVector<T,3>
std::vector< T, aligned_allocator< T > > aligned_vector
helper functions for EinsplineSetBuilder
T *restrict data(int i, int j)
return the base of XX components
int nGhosts
number of elements + padded
Accessor & operator=(const Tensor< T, D > &rhs)
aligned_vector< T > m_data
container
Accessor operator()(int i)
access operator for assignment of the i-th value
TensorSoaContainer()
default constructor
Tensor<T,D> class for D by D tensor.
const T *restrict data(int i, int j) const
return the base of XX components
TensorSoaContainer & operator=(T1 in)
need A=0.0;
const T * data() const
return the base
int nLocal
number of elements
T * data()
return the base
void serialize(Archive &ar, const unsigned int version)
serialization function