QMCPACK
TensorSoaContainer< T, 3 > Struct Template Reference

SoA adaptor class for ParticleAttrib<TinyVector<T,3> > More...

+ Collaboration diagram for TensorSoaContainer< T, 3 >:

Classes

struct  Accessor
 helper class for operator ()(int i) to assign a value More...
 

Public Types

using Element_t = T
 

Public Member Functions

 TensorSoaContainer ()
 default constructor More...
 
 TensorSoaContainer (const TensorSoaContainer &in)=default
 default copy constructor More...
 
TensorSoaContaineroperator= (const TensorSoaContainer &in)=default
 default copy operator More...
 
 TensorSoaContainer (int n)
 constructor with size n without initialization More...
 
template<typename T1 >
TensorSoaContaineroperator= (T1 in)
 need A=0.0; More...
 
 ~TensorSoaContainer ()=default
 
void resize (int n)
 
Tensor< T, 3 > operator[] (int i) const
 return TinyVector<T,3> More...
 
Accessor operator() (int i)
 access operator for assignment of the i-th value More...
 
T * data ()
 return the base More...
 
const T * data () const
 return the base More...
 
T *restrict data (int i, int j)
 return the base of XX components More...
 
const T *restrict data (int i, int j) const
 return the base of XX components More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 serialization function More...
 

Public Attributes

int nLocal
 number of elements More...
 
int nGhosts
 number of elements + padded More...
 
aligned_vector< T > m_data
 container More...
 

Detailed Description

template<typename T>
struct qmcplusplus::TensorSoaContainer< T, 3 >

SoA adaptor class for ParticleAttrib<TinyVector<T,3> >

Template Parameters
Tdata type, float, double, complex<float>, complex<double>

Definition at line 30 of file TensorSoaContainer.h.

Member Typedef Documentation

◆ Element_t

using Element_t = T

Definition at line 32 of file TensorSoaContainer.h.

Constructor & Destructor Documentation

◆ TensorSoaContainer() [1/3]

TensorSoaContainer ( )
inline

default constructor

Definition at line 42 of file TensorSoaContainer.h.

42 : nLocal(0), nGhosts(0) {}
int nGhosts
number of elements + padded

◆ TensorSoaContainer() [2/3]

TensorSoaContainer ( const TensorSoaContainer< T, 3 > &  in)
default

default copy constructor

◆ TensorSoaContainer() [3/3]

TensorSoaContainer ( int  n)
inlineexplicit

constructor with size n without initialization

Definition at line 49 of file TensorSoaContainer.h.

References qmcplusplus::n.

◆ ~TensorSoaContainer()

~TensorSoaContainer ( )
default

Member Function Documentation

◆ data() [1/4]

T* data ( )
inline

return the base

Definition at line 125 of file TensorSoaContainer.h.

125 { return m_data.data(); }
aligned_vector< T > m_data
container

◆ data() [2/4]

const T* data ( ) const
inline

return the base

Definition at line 127 of file TensorSoaContainer.h.

127 { return m_data.data(); }
aligned_vector< T > m_data
container

◆ data() [3/4]

T* restrict data ( int  i,
int  j 
)
inline

return the base of XX components

Definition at line 129 of file TensorSoaContainer.h.

References qmcplusplus::n.

130  {
131  const int n = (i < j) ? i * 3 + j : j * 3 + i;
132  return m_data().data() + n * nGhosts;
133  }
int nGhosts
number of elements + padded
aligned_vector< T > m_data
container

◆ data() [4/4]

const T* restrict data ( int  i,
int  j 
) const
inline

return the base of XX components

Definition at line 135 of file TensorSoaContainer.h.

References qmcplusplus::n.

136  {
137  const int n = (i < j) ? i * 3 + j : j * 3 + i;
138  return m_data().data() + n * nGhosts;
139  }
int nGhosts
number of elements + padded
aligned_vector< T > m_data
container

◆ operator()()

Accessor operator() ( int  i)
inline

access operator for assignment of the i-th value

Use for (*this)[i]=Tensor<T,3>;

Definition at line 122 of file TensorSoaContainer.h.

122 { return Accessor(m_data.data() + i, nGhosts); }
int nGhosts
number of elements + padded
aligned_vector< T > m_data
container

◆ operator=() [1/2]

TensorSoaContainer& operator= ( const TensorSoaContainer< T, 3 > &  in)
default

default copy operator

◆ operator=() [2/2]

TensorSoaContainer& operator= ( T1  in)
inline

need A=0.0;

Definition at line 54 of file TensorSoaContainer.h.

55  {
56  std::fill(m_data.begin(), m_data.end(), static_cast<T>(in));
57  return *this;
58  }
aligned_vector< T > m_data
container

◆ operator[]()

Tensor<T, 3> operator[] ( int  i) const
inline

return TinyVector<T,3>

Definition at line 71 of file TensorSoaContainer.h.

72  {
73  const T* restrict b = m_data + i;
74  T xx = *(b);
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);
80  return Tensor<T, 3>(xx, xy, xz, xy, yy, yz, xz, yz, zz);
81  }
int nGhosts
number of elements + padded
aligned_vector< T > m_data
container

◆ resize()

void resize ( int  n)
inline

Definition at line 62 of file TensorSoaContainer.h.

References qmcplusplus::n.

63  {
64  nLocal = n;
65  nGhosts = getAlignedSize<T>(n);
66  m_data.resize(nGhosts * 6);
67  }
int nGhosts
number of elements + padded
aligned_vector< T > m_data
container

◆ serialize()

void serialize ( Archive &  ar,
const unsigned int  version 
)
inline

serialization function

Definition at line 143 of file TensorSoaContainer.h.

144  {
145  //ar & m_data;
146  ar& nLocal& nGhosts& m_data;
147  }
int nGhosts
number of elements + padded
aligned_vector< T > m_data
container

Member Data Documentation

◆ m_data

aligned_vector<T> m_data

container

Definition at line 39 of file TensorSoaContainer.h.

◆ nGhosts

int nGhosts

number of elements + padded

Definition at line 37 of file TensorSoaContainer.h.

◆ nLocal

int nLocal

number of elements

Definition at line 35 of file TensorSoaContainer.h.


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