OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
olb::GenericVector< T, D, IMPL > Struct Template Reference

Generic vector of values supporting basic arithmetic. More...

#include <genericVector.h>

+ Inheritance diagram for olb::GenericVector< T, D, IMPL >:
+ Collaboration diagram for olb::GenericVector< T, D, IMPL >:

Public Types

using value_type = T
 

Public Member Functions

constexpr GenericVector ()=default
 
 GenericVector (const GenericVector &)=delete
 
 GenericVector (GenericVector &&)=delete
 
GenericVectoroperator= (GenericVector &&rhs)=delete
 
constexpr const T & operator[] (unsigned iDim) const any_platform
 
constexpr T & operator[] (unsigned iDim) any_platform
 
template<typename IMPL_ >
constexpr IMPL & operator= (const GenericVector< T, D, IMPL_ > &rhs) any_platform
 
template<typename U , typename IMPL_ >
constexpr IMPL & operator+= (const GenericVector< U, D, IMPL_ > &rhs) any_platform
 
template<typename IMPL_ >
constexpr IMPL & operator-= (const GenericVector< T, D, IMPL_ > &rhs) any_platform
 
template<typename U , typename IMPL_ >
constexpr IMPL & operator*= (const GenericVector< U, D, IMPL_ > &rhs) any_platform
 
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > operator+= (const U &rhs) any_platform
 
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > operator-= (const U &rhs) any_platform
 
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > operator*= (const U &rhs) any_platform
 
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > operator/= (const U &rhs) any_platform
 
template<typename IMPL_ >
constexpr bool operator== (const GenericVector< T, D, IMPL_ > &rhs) const any_platform
 
template<typename IMPL_ >
constexpr bool operator!= (const GenericVector< T, D, IMPL_ > &rhs) const any_platform
 

Static Public Member Functions

static constexpr unsigned size ()
 

Static Public Attributes

static constexpr unsigned d = D
 

Detailed Description

template<typename T, unsigned D, typename IMPL>
struct olb::GenericVector< T, D, IMPL >

Generic vector of values supporting basic arithmetic.

Definition at line 37 of file genericVector.h.

Member Typedef Documentation

◆ value_type

template<typename T , unsigned D, typename IMPL >
using olb::GenericVector< T, D, IMPL >::value_type = T

Definition at line 44 of file genericVector.h.

Constructor & Destructor Documentation

◆ GenericVector() [1/3]

template<typename T , unsigned D, typename IMPL >
constexpr olb::GenericVector< T, D, IMPL >::GenericVector ( )
constexprdefault

◆ GenericVector() [2/3]

template<typename T , unsigned D, typename IMPL >
olb::GenericVector< T, D, IMPL >::GenericVector ( const GenericVector< T, D, IMPL > & )
delete

◆ GenericVector() [3/3]

template<typename T , unsigned D, typename IMPL >
olb::GenericVector< T, D, IMPL >::GenericVector ( GenericVector< T, D, IMPL > && )
delete

Member Function Documentation

◆ operator!=()

template<typename T , unsigned D, typename IMPL >
template<typename IMPL_ >
constexpr bool olb::GenericVector< T, D, IMPL >::operator!= ( const GenericVector< T, D, IMPL_ > & rhs) const
inlineconstexpr

Definition at line 142 of file genericVector.h.

143 {
144 for (unsigned iDim=0; iDim < D; ++iDim) {
145 if (operator[](iDim) != rhs[iDim]) {
146 return true;
147 }
148 }
149 return false;
150 }

◆ operator*=() [1/2]

template<typename T , unsigned D, typename IMPL >
template<typename U , typename IMPL_ >
constexpr IMPL & olb::GenericVector< T, D, IMPL >::operator*= ( const GenericVector< U, D, IMPL_ > & rhs)
inlineconstexpr

Definition at line 86 of file genericVector.h.

87 {
88 for (unsigned iDim=0; iDim < D; ++iDim) {
89 operator[](iDim) *= rhs[iDim];
90 }
91 return *static_cast<IMPL*>(this);
92 }
constexpr const T & operator[](unsigned iDim) const any_platform

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator*=() [2/2]

template<typename T , unsigned D, typename IMPL >
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > olb::GenericVector< T, D, IMPL >::operator*= ( const U & rhs)
inlineconstexpr

Definition at line 113 of file genericVector.h.

114 {
115 for (unsigned iDim=0; iDim < D; ++iDim) {
116 operator[](iDim) *= rhs;
117 }
118 return *static_cast<IMPL*>(this);
119 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator+=() [1/2]

template<typename T , unsigned D, typename IMPL >
template<typename U , typename IMPL_ >
constexpr IMPL & olb::GenericVector< T, D, IMPL >::operator+= ( const GenericVector< U, D, IMPL_ > & rhs)
inlineconstexpr

Definition at line 68 of file genericVector.h.

69 {
70 for (unsigned iDim=0; iDim < D; ++iDim) {
71 operator[](iDim) += rhs[iDim];
72 }
73 return *static_cast<IMPL*>(this);
74 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator+=() [2/2]

template<typename T , unsigned D, typename IMPL >
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > olb::GenericVector< T, D, IMPL >::operator+= ( const U & rhs)
inlineconstexpr

Definition at line 95 of file genericVector.h.

96 {
97 for (unsigned iDim=0; iDim < D; ++iDim) {
98 operator[](iDim) += rhs;
99 }
100 return *static_cast<IMPL*>(this);
101 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator-=() [1/2]

template<typename T , unsigned D, typename IMPL >
template<typename IMPL_ >
constexpr IMPL & olb::GenericVector< T, D, IMPL >::operator-= ( const GenericVector< T, D, IMPL_ > & rhs)
inlineconstexpr

Definition at line 77 of file genericVector.h.

78 {
79 for (unsigned iDim=0; iDim < D; ++iDim) {
80 operator[](iDim) -= rhs[iDim];
81 }
82 return *static_cast<IMPL*>(this);
83 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator-=() [2/2]

template<typename T , unsigned D, typename IMPL >
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > olb::GenericVector< T, D, IMPL >::operator-= ( const U & rhs)
inlineconstexpr

Definition at line 104 of file genericVector.h.

105 {
106 for (unsigned iDim=0; iDim < D; ++iDim) {
107 operator[](iDim) -= rhs;
108 }
109 return *static_cast<IMPL*>(this);
110 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator/=()

template<typename T , unsigned D, typename IMPL >
template<typename U >
constexpr meta::enable_if_arithmetic_t< U, IMPL & > olb::GenericVector< T, D, IMPL >::operator/= ( const U & rhs)
inlineconstexpr

Definition at line 122 of file genericVector.h.

123 {
124 for (unsigned iDim=0; iDim < D; ++iDim) {
125 operator[](iDim) /= rhs;
126 }
127 return *static_cast<IMPL*>(this);
128 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator=() [1/2]

template<typename T , unsigned D, typename IMPL >
template<typename IMPL_ >
constexpr IMPL & olb::GenericVector< T, D, IMPL >::operator= ( const GenericVector< T, D, IMPL_ > & rhs)
inlineconstexpr

Definition at line 59 of file genericVector.h.

60 {
61 for (unsigned iDim=0; iDim < D; ++iDim) {
62 operator[](iDim) = rhs[iDim];
63 }
64 return *static_cast<IMPL*>(this);
65 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T , unsigned D, typename IMPL >
GenericVector & olb::GenericVector< T, D, IMPL >::operator= ( GenericVector< T, D, IMPL > && rhs)
delete

◆ operator==()

template<typename T , unsigned D, typename IMPL >
template<typename IMPL_ >
constexpr bool olb::GenericVector< T, D, IMPL >::operator== ( const GenericVector< T, D, IMPL_ > & rhs) const
inlineconstexpr

Definition at line 132 of file genericVector.h.

133 {
134 bool isEqual = true;
135 for (unsigned iDim=0; iDim < D; ++iDim) {
136 isEqual &= operator[](iDim) == rhs[iDim];
137 }
138 return isEqual;
139 }

References olb::GenericVector< T, D, IMPL >::operator[]().

+ Here is the call graph for this function:

◆ operator[]() [1/2]

template<typename T , unsigned D, typename IMPL >
constexpr T & olb::GenericVector< T, D, IMPL >::operator[] ( unsigned iDim)
inlineconstexpr

Definition at line 53 of file genericVector.h.

54 {
55 return *static_cast<IMPL*>(this)->getComponentPointer(iDim);
56 }

◆ operator[]() [2/2]

template<typename T , unsigned D, typename IMPL >
constexpr const T & olb::GenericVector< T, D, IMPL >::operator[] ( unsigned iDim) const
inlineconstexpr

Definition at line 48 of file genericVector.h.

49 {
50 return *static_cast<const IMPL*>(this)->getComponentPointer(iDim);
51 }
+ Here is the caller graph for this function:

◆ size()

template<typename T , unsigned D, typename IMPL >
static constexpr unsigned olb::GenericVector< T, D, IMPL >::size ( )
inlinestaticconstexpr

Definition at line 46 of file genericVector.h.

46{ return D; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ d

template<typename T , unsigned D, typename IMPL >
constexpr unsigned olb::GenericVector< T, D, IMPL >::d = D
staticconstexpr

Definition at line 45 of file genericVector.h.


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