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

155 {
156 _data = rhs;
157 }

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

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

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

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

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

145 {
146 _data = *p;
147 }

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

150 {
151 _data = *p;
152 }

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

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

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

◆ operator+=()

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

Definition at line 193 of file scalar.hpp.

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

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

◆ operator-=()

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

Definition at line 198 of file scalar.hpp.

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

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

◆ operator/=()

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

Definition at line 208 of file scalar.hpp.

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

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

188 {
189 return _data;
190 }

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

183 {
184 return _data;
185 }

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

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

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

134 {
135 *p = _data;
136 }

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

139 {
140 *p = _data;
141 }

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.