Schnek
schnek::Array< T, Length, CheckingPolicy > Class Template Reference

#include <array.hpp>

Inheritance diagram for schnek::Array< T, Length, CheckingPolicy >:
Collaboration diagram for schnek::Array< T, Length, CheckingPolicy >:

Public Types

typedef T value_type
 

Public Member Functions

SCHNEK_INLINE Array ()
 The default constructor.
 
template<template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array (const Array< T, Length, CheckingPolicy2 > &)
 Copy constructor copies the values.
 
template<class Operator >
SCHNEK_INLINE Array (const ArrayExpression< Operator, Length > &)
 Construct using an array expression.
 
SCHNEK_INLINE Array (const T &)
 Construct using an initializer list. More...
 
SCHNEK_INLINE Array (const T &, const T &)
 Constructor for length=2 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &)
 Constructor for length=3 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &, const T &)
 Constructor for length=4 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &, const T &, const T &)
 Constructor for length=5 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &, const T &, const T &, const T &)
 Constructor for length=6 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &, const T &, const T &, const T &, const T &)
 Constructor for length=7 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &, const T &, const T &, const T &, const T &, const T &)
 Constructor for length=8 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &, const T &, const T &, const T &, const T &, const T &, const T &)
 Constructor for length=9 arrays setting the data explicitely.
 
SCHNEK_INLINE Array (const T &, const T &, const T &, const T &, const T &, const T &, const T &, const T &, const T &, const T &)
 Constructor for length=10 arrays setting the data explicitely.
 
SCHNEK_INLINE T & operator[] (size_t)
 Accessor operator.
 
SCHNEK_INLINE T operator[] (size_t) const
 Constant accessor operator.
 
SCHNEK_INLINE T & at (size_t)
 Accessor operator.
 
SCHNEK_INLINE T at (size_t) const
 Constant accessor operator.
 
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator= (const Array< T2, Length, CheckingPolicy2 > &)
 
template<class Operator >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator= (const ArrayExpression< Operator, Length > &)
 Assignment operator using an array expression.
 
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator+= (const Array< T2, Length, CheckingPolicy2 > &)
 
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator*= (const Array< T2, Length, CheckingPolicy2 > &)
 
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator/= (const Array< T2, Length, CheckingPolicy2 > &)
 
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator-= (const Array< T2, Length, CheckingPolicy2 > &)
 
template<typename T2 >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator+= (const T2)
 
template<typename T2 >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator-= (const T2)
 
template<typename T2 >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator*= (const T2)
 
template<typename T2 >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator/= (const T2)
 
template<class Operator >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator+= (const ArrayExpression< Operator, Length > &)
 Addition Assignment operator using an array expression.
 
template<class Operator >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator-= (const ArrayExpression< Operator, Length > &)
 Subtraction Assignment operator using an array expression.
 
template<class Operator >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator*= (const ArrayExpression< Operator, Length > &)
 Element-wise multiplication assignment operator using an array expression.
 
template<class Operator >
SCHNEK_INLINE Array< T, Length, CheckingPolicy > & operator/= (const ArrayExpression< Operator, Length > &)
 Element-wise multiplication assignment operator using an array expression.
 
Array< T, Length, CheckingPolicy > & clear ()
 Sets all fields to zero.
 
Array< T, Length, CheckingPolicy > & fill (const T &)
 Fills all fields with a given value.
 
template<size_t destLength>
Array< T, destLength, CheckingPolicy > project () const
 projects the Array onto an Array of shorter length
 
Array< T, Length-1, CheckingPolicy > projectDim (size_t dim) const
 
product () const
 Returns the product of all elements.
 
sum () const
 Returns the sum of all elements.
 
sqr () const
 Returns the sum of squares of all elements.
 

Static Public Member Functions

static Array< T, Length, CheckingPolicy > Zero ()
 
static Array< T, Length, CheckingPolicy > Ones ()
 

Static Public Attributes

static constexpr size_t length = Length
 

Detailed Description

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
class schnek::Array< T, Length, CheckingPolicy >

A Fixed size array. The three template parameters are:
T: the type of data stored
length: the length of the array
CheckingPolicy: A policy class defining how to check the index passed to the accessor method

Constructor & Destructor Documentation

◆ Array()

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
SCHNEK_INLINE schnek::Array< T, Length, CheckingPolicy >::Array ( const T &  )

Construct using an initializer list.

Constructor for length=1 arrays setting the data explicitely

Member Function Documentation

◆ Ones()

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
static Array<T,Length,CheckingPolicy> schnek::Array< T, Length, CheckingPolicy >::Ones ( )
static

Returns an array filled with ones. Only available if int can be cast to the type T

◆ operator*=() [1/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator*= ( const Array< T2, Length, CheckingPolicy2 > &  )

Element-wise multiplication assignment operator

The argument can have a different value_type and checking policy. The value_type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator*=() [2/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator*= ( const T2  )

Multiplication Assignment operator with scalar RHS.

The argument can have a different type. The type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator+=() [1/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator+= ( const Array< T2, Length, CheckingPolicy2 > &  )

Addition Assignment operator

The argument can have a different value_type and checking policy. The value_type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator+=() [2/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator+= ( const T2  )

Addition Assignment operator with scalar RHS.

The argument can have a different type. The type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator-=() [1/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator-= ( const Array< T2, Length, CheckingPolicy2 > &  )

Subtraction Assignment operator

The argument can have a different value_type and checking policy. The value_type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator-=() [2/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator-= ( const T2  )

Subtraction Assignment operator with scalar RHS.

The argument can have a different type. The type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator/=() [1/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator/= ( const Array< T2, Length, CheckingPolicy2 > &  )

Element-wise division assignment operator

The argument can have a different value_type and checking policy. The value_type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator/=() [2/2]

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator/= ( const T2  )

Division Assignment operator with scalar RHS.

The argument can have a different type. The type of the RHS must be implicitly castable to the value_type of the LHS.

◆ operator=()

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< size_t > class CheckingPolicy2>
SCHNEK_INLINE Array<T,Length,CheckingPolicy>& schnek::Array< T, Length, CheckingPolicy >::operator= ( const Array< T2, Length, CheckingPolicy2 > &  )

Assignment operator

The argument can have a different value_type and checking policy. The value_type of the RHS must be implicitly castable to the value_type of the LHS.

◆ Zero()

template<class T, size_t Length, template< size_t > class CheckingPolicy = ArrayNoArgCheck>
static Array<T,Length,CheckingPolicy> schnek::Array< T, Length, CheckingPolicy >::Zero ( )
static

Returns an array filled with zeros. Only available if int can be cast to the type T


The documentation for this class was generated from the following files: