votca 2024.2-dev
Loading...
Searching...
No Matches
votca::tools::NDimVector< T, dim > Class Template Reference

N-Dim Vector. More...

#include <NDimVector.h>

Collaboration diagram for votca::tools::NDimVector< T, dim >:

Public Member Functions

constexpr Index rank ()
 
 NDimVector ()=default
 
template<typename... IndexTypes>
 NDimVector (Index firstDimension, IndexTypes... otherDimensions)
 
template<typename... IndexTypes>
T & operator() (Index firstDimension, IndexTypes... otherDimensions)
 
template<typename... IndexTypes>
const T & operator() (Index firstDimension, IndexTypes... otherDimensions) const
 
Index dimension (Index i) const
 
Index size () const
 
std::vector< T >::iterator begin ()
 
std::vector< T >::iterator end ()
 
std::vector< T >::const_iterator begin () const
 
std::vector< T >::const_iterator end () const
 

Private Member Functions

template<typename... IndexTypes>
Index linearIndex (Index firstDimension, IndexTypes... otherDimensions) const
 

Private Attributes

std::vector< T > storage_
 
std::array< Index, dim > dimensions_
 
std::array< Index, dim > offsets_
 

Static Private Attributes

static constexpr int dim_ = dim
 

Detailed Description

template<class T, int dim>
class votca::tools::NDimVector< T, dim >

N-Dim Vector.

This is basically a normal std::vector with an additional operator(i,j,k,l...), which allows you to treat it as a higher dim object It is column major (the first index is the fast one)

Definition at line 44 of file NDimVector.h.

Constructor & Destructor Documentation

◆ NDimVector() [1/2]

template<class T , int dim>
votca::tools::NDimVector< T, dim >::NDimVector ( )
default

◆ NDimVector() [2/2]

template<class T , int dim>
template<typename... IndexTypes>
votca::tools::NDimVector< T, dim >::NDimVector ( Index firstDimension,
IndexTypes... otherDimensions )
inline

Definition at line 71 of file NDimVector.h.

Member Function Documentation

◆ begin() [1/2]

template<class T , int dim>
std::vector< T >::iterator votca::tools::NDimVector< T, dim >::begin ( )
inline

Definition at line 109 of file NDimVector.h.

◆ begin() [2/2]

template<class T , int dim>
std::vector< T >::const_iterator votca::tools::NDimVector< T, dim >::begin ( ) const
inline

Definition at line 111 of file NDimVector.h.

◆ dimension()

template<class T , int dim>
Index votca::tools::NDimVector< T, dim >::dimension ( Index i) const
inline

Definition at line 106 of file NDimVector.h.

◆ end() [1/2]

template<class T , int dim>
std::vector< T >::iterator votca::tools::NDimVector< T, dim >::end ( )
inline

Definition at line 110 of file NDimVector.h.

◆ end() [2/2]

template<class T , int dim>
std::vector< T >::const_iterator votca::tools::NDimVector< T, dim >::end ( ) const
inline

Definition at line 114 of file NDimVector.h.

◆ linearIndex()

template<class T , int dim>
template<typename... IndexTypes>
Index votca::tools::NDimVector< T, dim >::linearIndex ( Index firstDimension,
IndexTypes... otherDimensions ) const
inlineprivate

Definition at line 49 of file NDimVector.h.

◆ operator()() [1/2]

template<class T , int dim>
template<typename... IndexTypes>
T & votca::tools::NDimVector< T, dim >::operator() ( Index firstDimension,
IndexTypes... otherDimensions )
inline

Definition at line 90 of file NDimVector.h.

◆ operator()() [2/2]

template<class T , int dim>
template<typename... IndexTypes>
const T & votca::tools::NDimVector< T, dim >::operator() ( Index firstDimension,
IndexTypes... otherDimensions ) const
inline

Definition at line 101 of file NDimVector.h.

◆ rank()

template<class T , int dim>
Index votca::tools::NDimVector< T, dim >::rank ( )
inlineconstexpr

Definition at line 66 of file NDimVector.h.

◆ size()

template<class T , int dim>
Index votca::tools::NDimVector< T, dim >::size ( ) const
inline

Definition at line 107 of file NDimVector.h.

Member Data Documentation

◆ dim_

template<class T , int dim>
int votca::tools::NDimVector< T, dim >::dim_ = dim
staticconstexprprivate

Definition at line 46 of file NDimVector.h.

◆ dimensions_

template<class T , int dim>
std::array<Index, dim> votca::tools::NDimVector< T, dim >::dimensions_
private

Definition at line 118 of file NDimVector.h.

◆ offsets_

template<class T , int dim>
std::array<Index, dim> votca::tools::NDimVector< T, dim >::offsets_
private

Definition at line 119 of file NDimVector.h.

◆ storage_

template<class T , int dim>
std::vector<T> votca::tools::NDimVector< T, dim >::storage_
private

Definition at line 117 of file NDimVector.h.


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