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)
 
scalarToperator= (const scalarT &)=default
 
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_v<U>>::type>
void gather (const scalarType *p, const scalarT< U > &indices)
 
template<typename U , typename = typename std::enable_if<std::is_integral_v<U>>::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 109 of file scalar.hpp.

Member Typedef Documentation

◆ scalarArray

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

Definition at line 116 of file scalar.hpp.

◆ scalarType

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

Definition at line 114 of file scalar.hpp.

◆ vectorType

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

Definition at line 115 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 124 of file scalar.hpp.

124 : _data(rhs)
125 {
126 }
vectorType _data
Definition: scalar.hpp:119

Member Function Documentation

◆ broadcast()

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

Definition at line 153 of file scalar.hpp.

154 {
155 _data = rhs;
156 }

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 175 of file scalar.hpp.

176 {
177 _data += a._data * b._data;
178 }

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

◆ gather()

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

Definition at line 160 of file scalar.hpp.

161 {
162 _data = *(p + indices._data);
163 }

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 143 of file scalar.hpp.

144 {
145 _data = *p;
146 }

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 148 of file scalar.hpp.

149 {
150 _data = *p;
151 }

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 202 of file scalar.hpp.

203 {
204 _data *= rhs._data;
205 }

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

◆ operator+=()

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

Definition at line 192 of file scalar.hpp.

193 {
194 _data += rhs._data;
195 }

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

◆ operator-=()

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

Definition at line 197 of file scalar.hpp.

198 {
199 _data -= rhs._data;
200 }

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

◆ operator/=()

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

Definition at line 207 of file scalar.hpp.

208 {
209 _data /= rhs._data;
210 }

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

◆ operator=()

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

◆ operator[]() [1/2]

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

Definition at line 186 of file scalar.hpp.

187 {
188 return _data;
189 }

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 181 of file scalar.hpp.

182 {
183 return _data;
184 }

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

◆ scatter()

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

Definition at line 167 of file scalar.hpp.

168 {
169 p += indices._data;
170 *p = _data;
171 }

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 132 of file scalar.hpp.

133 {
134 *p = _data;
135 }

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 137 of file scalar.hpp.

138 {
139 *p = _data;
140 }

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 112 of file scalar.hpp.

◆ width

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

Definition at line 111 of file scalar.hpp.