Nektar++
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tinysimd::scalarT< T, typename > Struct Template Reference

#include <scalar.hpp>

Public Types

using scalarType = T
 
using vectorType = scalarType
 
using scalarArray = scalarType[width]
 

Public Member Functions

 scalarT ()=default
 
 scalarT (const scalarT &rhs)=default
 
 scalarT (const vectorType &rhs)
 
void store (scalarType *p) const
 
template<class flag >
void store (scalarType *p, flag) const
 
void load (const scalarType *p)
 
template<class flag >
void load (const scalarType *p, flag)
 
void broadcast (const scalarType rhs)
 
template<typename U , typename = typename std::enable_if< std::is_integral<U>::value>::type>
void gather (const scalarType *p, const scalarT< U > &indices)
 
template<typename U , typename = typename std::enable_if< std::is_integral<U>::value>::type>
void scatter (scalarType *p, const scalarT< U > &indices) const
 
void fma (const scalarT< T > &a, const scalarT< T > &b)
 
scalarType operator[] (size_t) const
 
scalarTypeoperator[] (size_t)
 
void operator+= (scalarT< T > rhs)
 
void operator-= (scalarT< T > rhs)
 
void operator*= (scalarT< T > rhs)
 
void operator/= (scalarT< T > rhs)
 

Public Attributes

vectorType _data {0}
 

Static Public Attributes

static constexpr unsigned int width = 1
 
static constexpr unsigned int alignment = sizeof(T)
 

Detailed Description

template<typename T, typename>
struct tinysimd::scalarT< T, typename >

Definition at line 110 of file scalar.hpp.

Member Typedef Documentation

◆ scalarArray

template<typename T , typename >
using tinysimd::scalarT< T, typename >::scalarArray = scalarType[width]

Definition at line 117 of file scalar.hpp.

◆ scalarType

template<typename T , typename >
using tinysimd::scalarT< T, typename >::scalarType = T

Definition at line 115 of file scalar.hpp.

◆ vectorType

template<typename T , typename >
using tinysimd::scalarT< T, typename >::vectorType = scalarType

Definition at line 116 of file scalar.hpp.

Constructor & Destructor Documentation

◆ scalarT() [1/3]

template<typename T , typename >
tinysimd::scalarT< T, typename >::scalarT ( )
inlinedefault

◆ scalarT() [2/3]

template<typename T , typename >
tinysimd::scalarT< T, typename >::scalarT ( const scalarT< T, typename > &  rhs)
inlinedefault

◆ scalarT() [3/3]

template<typename T , typename >
tinysimd::scalarT< T, typename >::scalarT ( const vectorType rhs)
inline

Definition at line 125 of file scalar.hpp.

125  : _data(rhs)
126  {
127  }
vectorType _data
Definition: scalar.hpp:120

Member Function Documentation

◆ broadcast()

template<typename T , typename >
void tinysimd::scalarT< T, typename >::broadcast ( const scalarType  rhs)
inline

Definition at line 151 of file scalar.hpp.

152  {
153  _data = rhs;
154  }

References tinysimd::scalarT< T, typename >::_data.

◆ fma()

template<typename T , typename >
void tinysimd::scalarT< T, typename >::fma ( const scalarT< T > &  a,
const scalarT< T > &  b 
)
inline

Definition at line 173 of file scalar.hpp.

174  {
175  _data += a._data * b._data;
176  }

References tinysimd::scalarT< T, typename >::_data.

◆ gather()

template<typename T , typename >
template<typename U , typename = typename std::enable_if< std::is_integral<U>::value>::type>
void tinysimd::scalarT< T, typename >::gather ( const scalarType p,
const scalarT< U > &  indices 
)
inline

Definition at line 158 of file scalar.hpp.

159  {
160  _data = *(p + indices._data);
161  }

References tinysimd::scalarT< T, typename >::_data, and CellMLToNektar.cellml_metadata::p.

◆ load() [1/2]

template<typename T , typename >
void tinysimd::scalarT< T, typename >::load ( const scalarType p)
inline

Definition at line 141 of file scalar.hpp.

142  {
143  _data = *p;
144  }

References tinysimd::scalarT< T, typename >::_data, and CellMLToNektar.cellml_metadata::p.

◆ load() [2/2]

template<typename T , typename >
template<class flag >
void tinysimd::scalarT< T, typename >::load ( const scalarType p,
flag   
)
inline

Definition at line 146 of file scalar.hpp.

147  {
148  _data = *p;
149  }

References tinysimd::scalarT< T, typename >::_data, and CellMLToNektar.cellml_metadata::p.

◆ operator*=()

template<typename T , typename >
void tinysimd::scalarT< T, typename >::operator*= ( scalarT< T >  rhs)
inline

Definition at line 200 of file scalar.hpp.

201  {
202  _data *= rhs._data;
203  }

References tinysimd::scalarT< T, typename >::_data.

◆ operator+=()

template<typename T , typename >
void tinysimd::scalarT< T, typename >::operator+= ( scalarT< T >  rhs)
inline

Definition at line 190 of file scalar.hpp.

191  {
192  _data += rhs._data;
193  }

References tinysimd::scalarT< T, typename >::_data.

◆ operator-=()

template<typename T , typename >
void tinysimd::scalarT< T, typename >::operator-= ( scalarT< T >  rhs)
inline

Definition at line 195 of file scalar.hpp.

196  {
197  _data -= rhs._data;
198  }

References tinysimd::scalarT< T, typename >::_data.

◆ operator/=()

template<typename T , typename >
void tinysimd::scalarT< T, typename >::operator/= ( scalarT< T >  rhs)
inline

Definition at line 205 of file scalar.hpp.

206  {
207  _data /= rhs._data;
208  }

References tinysimd::scalarT< T, typename >::_data.

◆ operator[]() [1/2]

template<typename T , typename >
scalarType& tinysimd::scalarT< T, typename >::operator[] ( size_t  )
inline

Definition at line 184 of file scalar.hpp.

185  {
186  return _data;
187  }

References tinysimd::scalarT< T, typename >::_data.

◆ operator[]() [2/2]

template<typename T , typename >
scalarType tinysimd::scalarT< T, typename >::operator[] ( size_t  ) const
inline

Definition at line 179 of file scalar.hpp.

180  {
181  return _data;
182  }

References tinysimd::scalarT< T, typename >::_data.

◆ scatter()

template<typename T , typename >
template<typename U , typename = typename std::enable_if< std::is_integral<U>::value>::type>
void tinysimd::scalarT< T, typename >::scatter ( scalarType p,
const scalarT< U > &  indices 
) const
inline

Definition at line 165 of file scalar.hpp.

166  {
167  p += indices._data;
168  *p = _data;
169  }

References tinysimd::scalarT< T, typename >::_data, and CellMLToNektar.cellml_metadata::p.

◆ store() [1/2]

template<typename T , typename >
void tinysimd::scalarT< T, typename >::store ( scalarType p) const
inline

Definition at line 130 of file scalar.hpp.

131  {
132  *p = _data;
133  }

References tinysimd::scalarT< T, typename >::_data, and CellMLToNektar.cellml_metadata::p.

◆ store() [2/2]

template<typename T , typename >
template<class flag >
void tinysimd::scalarT< T, typename >::store ( scalarType p,
flag   
) const
inline

Definition at line 135 of file scalar.hpp.

136  {
137  *p = _data;
138  }

References tinysimd::scalarT< T, typename >::_data, and CellMLToNektar.cellml_metadata::p.

Member Data Documentation

◆ _data

template<typename T , typename >
vectorType tinysimd::scalarT< T, typename >::_data {0}

◆ alignment

template<typename T , typename >
constexpr unsigned int tinysimd::scalarT< T, typename >::alignment = sizeof(T)
staticconstexpr

Definition at line 113 of file scalar.hpp.

◆ width

template<typename T , typename >
constexpr unsigned int tinysimd::scalarT< T, typename >::width = 1
staticconstexpr

Definition at line 112 of file scalar.hpp.