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

enum  { Length = length }
 
typedef T value_type
 

Public Member Functions

 Array ()
 The default constructor.
 
template<template< int > class CheckingPolicy2>
 Array (const Array< T, length, CheckingPolicy2 > &)
 Copy constructor copies the values.
 
template<class Operator >
 Array (const ArrayExpression< Operator, length > &)
 Construct using an array expression.
 
 Array (const T &)
 Constructor for length=1 arrays setting the data explicitely.
 
 Array (const T &, const T &)
 Constructor for length=2 arrays setting the data explicitely.
 
 Array (const T &, const T &, const T &)
 Constructor for length=3 arrays setting the data explicitely.
 
 Array (const T &, const T &, const T &, const T &)
 Constructor for length=4 arrays setting the data explicitely.
 
 Array (const T &, const T &, const T &, const T &, const T &)
 Constructor for length=5 arrays setting the data explicitely.
 
 Array (const T &, const T &, const T &, const T &, const T &, const T &)
 Constructor for length=6 arrays setting the data explicitely.
 
 Array (const T &, const T &, const T &, const T &, const T &, const T &, const T &)
 Constructor for length=7 arrays setting the data explicitely.
 
 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.
 
 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.
 
 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.
 
T & operator[] (int)
 Accessor operator.
 
operator[] (int) const
 Constant accessor operator.
 
T & at (int)
 Accessor operator.
 
at (int) const
 Constant accessor operator.
 
template<class T2 , template< int > class CheckingPolicy2>
Array< T, length, CheckingPolicy > & operator= (const Array< T2, length, CheckingPolicy2 > &)
 
template<class Operator >
Array< T, length, CheckingPolicy > & operator= (const ArrayExpression< Operator, length > &)
 Assignment operator using an array expression.
 
template<class T2 , template< int > class CheckingPolicy2>
Array< T, length, CheckingPolicy > & operator+= (const Array< T2, length, CheckingPolicy2 > &)
 
template<class T2 , template< int > class CheckingPolicy2>
Array< T, length, CheckingPolicy > & operator*= (const Array< T2, length, CheckingPolicy2 > &)
 
template<class T2 , template< int > class CheckingPolicy2>
Array< T, length, CheckingPolicy > & operator/= (const Array< T2, length, CheckingPolicy2 > &)
 
template<class T2 , template< int > class CheckingPolicy2>
Array< T, length, CheckingPolicy > & operator-= (const Array< T2, length, CheckingPolicy2 > &)
 
template<typename T2 >
Array< T, length, CheckingPolicy > & operator+= (const T2)
 
template<typename T2 >
Array< T, length, CheckingPolicy > & operator-= (const T2)
 
template<typename T2 >
Array< T, length, CheckingPolicy > & operator*= (const T2)
 
template<typename T2 >
Array< T, length, CheckingPolicy > & operator/= (const T2)
 
template<class Operator >
Array< T, length, CheckingPolicy > & operator+= (const ArrayExpression< Operator, length > &)
 Addition Assignment operator using an array expression.
 
template<class Operator >
Array< T, length, CheckingPolicy > & operator-= (const ArrayExpression< Operator, length > &)
 Subtraction Assignment operator using an array expression.
 
template<class Operator >
Array< T, length, CheckingPolicy > & operator*= (const ArrayExpression< Operator, length > &)
 Element-wise multiplication assignment operator using an array expression.
 
template<class Operator >
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<int destLength>
Array< T, destLength, CheckingPolicy > project () const
 projects the Array onto an Array of shorter length
 
Array< T, length-1, CheckingPolicy > projectDim (int 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 ()
 

Detailed Description

template<class T, int length, template< int > 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

Member Function Documentation

◆ Ones()

template<class T, int length, template< int > 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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< int > class CheckingPolicy2>
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< int > class CheckingPolicy2>
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< int > class CheckingPolicy2>
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< int > class CheckingPolicy2>
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<typename T2 >
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, int length, template< int > class CheckingPolicy = ArrayNoArgCheck>
template<class T2 , template< int > class CheckingPolicy2>
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, int length, template< int > 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: