AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agxData::Array< T > Class Template Reference

Type-specific Array used for fast access into the data held by a Buffer. More...

#include <agxData.h>

+ Inheritance diagram for agxData::Array< T >:

Public Types

typedef const T * const_iterator
 
typedef const T * const_pointer
 
typedef const T & const_reference
 
typedef ptrdiff_t difference_type
 
typedef T * iterator
 
typedef
std::random_access_iterator_tag 
iterator_category
 
typedef T * pointer
 
typedef T & reference
 
typedef size_t size_type
 
typedef T Type
 
typedef T value_type
 

Public Member Functions

 Array ()
 Create a new invalid array. More...
 
 Array (agxData::Buffer *buffer)
 Create a new array covering the entire given buffer. More...
 
 Array (agxData::Buffer *buffer, agx::IndexRange32 range)
 Create a new array covering the given range of the given buffer. More...
 
 Array (const agxData::Array< T > &other, agx::IndexRange32 localRange)
 Create a new array that covers a subset of another array. More...
 
 Array (agx::Vector< T > &vec)
 Create a new array view from a vector. More...
 
 Array (agx::Vector< T > &vec, agx::IndexRange32 range)
 
 Array (agx::VectorPOD< T > &vec)
 
 Array (agx::VectorPOD< T > &vec, agx::IndexRange32 range)
 
void _setBuffer (agxData::Buffer *buffer)
 Set the buffer while maintaining the current range, should normally not be used. More...
 
agx::GlobalResult::Transaction allocateResult (size_t numElements)
 
const AbstractArray & asArray () const
 
AbstractArray & asArray ()
 
template<typename T >
Array< T > & asArray ()
 
template<typename T >
const Array< T > & asArray () const
 
const AbstractScalar & asScalar () const
 
AbstractScalar & asScalar ()
 
template<typename T >
Scalar< T > & asScalar ()
 
template<typename T >
const Scalar< T > & asScalar () const
 
T & at (size_t index)
 
const T & at (size_t index) const
 
T & back ()
 
const T & back () const
 
iterator begin ()
 
const_iterator begin () const
 
const agxData::Buffer * buffer () const
 
agxData::Buffer * buffer ()
 
size_t commitResult (size_t numElements, const void *localResult, agx::Index sortIndex)
 
size_t commitResult (size_t numElements, const void *localResult)
 
template<typename T2 >
size_t commitResult (const T2 &vector, agx::Index sortIndex)
 
template<typename T2 >
size_t commitResult (const T2 &vector)
 
template<typename T2 >
bool contains (const T2 &element) const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
template<typename T2 >
size_t find (const T2 &element) const
 The index of the first occurrence of an element that is equal to the given element. More...
 
T & front ()
 
const T & front () const
 
agxData::Format * getFormat ()
 
const agxData::Format * getFormat () const
 
agx::GlobalResult * getGlobalResult ()
 
void init (agxData::Buffer *buffer, agx::IndexRange32 range)
 Set the buffer that the array will access, as well as the range of the buffer that is to be covered. More...
 
void init (agxData::Buffer *buffer)
 Set the buffer that the array will access. The range is set to the entire buffer. More...
 
void init ()
 Set to empty array. More...
 
bool isValid () const
 
T & operator[] (size_t index)
 
const T & operator[] (size_t index) const
 
agxData::Array< T > operator[] (agx::IndexRange32 subRange) const
 
T * ptr ()
 
const T * ptr () const
 
agx::IndexRange32 & range ()
 
const agx::IndexRange32 & range () const
 
void setRange (size_t startIndex, size_t endIndex)
 Set the range of the buffer that the array will cover. More...
 
void setRange (agx::IndexRange32 range)
 Set the range of the buffer that the array will cover. More...
 
size_t size () const
 
agxData::Array< T > slice (agx::IndexRange32 subRange) const
 
void sync ()
 Updates the internal data access pointer. Called when the back end buffer is reallocated. More...
 

Static Public Member Functions

static agxData::Array< T > raw (T *buffer, agx::Index size)
 Array creation helper method that creates an array covering the given memory area. More...
 
static const agxData::Array< T > raw (const T *buffer, agx::Index size)
 

Static Public Attributes

static const bool IsScalar = false
 

Protected Attributes

agxData::Buffer * m_buffer
 
void * m_ptr
 
agx::IndexRange32 m_range
 

Detailed Description

template<typename T>
class agxData::Array< T >

Type-specific Array used for fast access into the data held by a Buffer.

Definition at line 30 of file agxData.h.

Member Typedef Documentation

template<typename T>
typedef const T* agxData::Array< T >::const_iterator

Definition at line 117 of file Array.h.

template<typename T>
typedef const T* agxData::Array< T >::const_pointer

Definition at line 112 of file Array.h.

template<typename T>
typedef const T& agxData::Array< T >::const_reference

Definition at line 114 of file Array.h.

template<typename T>
typedef ptrdiff_t agxData::Array< T >::difference_type

Definition at line 119 of file Array.h.

template<typename T>
typedef T* agxData::Array< T >::iterator

Definition at line 116 of file Array.h.

template<typename T>
typedef std::random_access_iterator_tag agxData::Array< T >::iterator_category

Definition at line 118 of file Array.h.

template<typename T>
typedef T* agxData::Array< T >::pointer

Definition at line 111 of file Array.h.

template<typename T>
typedef T& agxData::Array< T >::reference

Definition at line 113 of file Array.h.

template<typename T>
typedef size_t agxData::Array< T >::size_type

Definition at line 115 of file Array.h.

template<typename T>
typedef T agxData::Array< T >::Type

Definition at line 109 of file Array.h.

template<typename T>
typedef T agxData::Array< T >::value_type

Definition at line 110 of file Array.h.

Constructor & Destructor Documentation

template<typename T >
agxData::Array< T >::Array ( )

Create a new invalid array.

Definition at line 755 of file Buffer.h.

template<typename T >
agxData::Array< T >::Array ( agxData::Buffer *  buffer)

Create a new array covering the entire given buffer.

Definition at line 760 of file Buffer.h.

References agxAssert, agxData::Buffer::getFormat(), agxData::Format::getSize(), agx::Model::is(), and agxCore::isShutdown().

template<typename T >
agxData::Array< T >::Array ( agxData::Buffer *  buffer,
agx::IndexRange32  range 
)

Create a new array covering the given range of the given buffer.

Definition at line 769 of file Buffer.h.

References agxAssert, agxData::Buffer::getFormat(), agxData::Format::getSize(), agx::Model::is(), and agxCore::isShutdown().

template<typename T>
agxData::Array< T >::Array ( const agxData::Array< T > &  other,
agx::IndexRange32  localRange 
)

Create a new array that covers a subset of another array.

Definition at line 777 of file Buffer.h.

template<typename T>
agxData::Array< T >::Array ( agx::Vector< T > &  vec)

Create a new array view from a vector.

Definition at line 782 of file Buffer.h.

References agx::Vector< T, Allocator >::ptr(), and agx::Container::size().

template<typename T>
agxData::Array< T >::Array ( agx::VectorPOD< T > &  vec)

Definition at line 797 of file Buffer.h.

References agx::VectorPOD< T, Allocator >::ptr(), and agx::Container::size().

Member Function Documentation

void agxData::AbstractArray::_setBuffer ( agxData::Buffer *  buffer)
inherited

Set the buffer while maintaining the current range, should normally not be used.

Definition at line 679 of file Buffer.h.

References agxAssert, agxData::AbstractArray::buffer(), agxData::AbstractArray::m_buffer, and agxData::AbstractArray::sync().

template<typename T >
agx::GlobalResult::Transaction agxData::Array< T >::allocateResult ( size_t  numElements)
See Also
agx::GlobalResult::allocateResult

Definition at line 572 of file Buffer.h.

const Array< T > & agxData::Data::asArray ( ) const
inherited

Definition at line 617 of file Buffer.h.

Array< T > & agxData::Data::asArray ( )
inherited

Definition at line 616 of file Buffer.h.

template<typename T >
Array<T>& agxData::Data::asArray ( )
inherited
template<typename T >
const Array<T>& agxData::Data::asArray ( ) const
inherited
const Scalar< T > & agxData::Data::asScalar ( ) const
inherited

Definition at line 92 of file Scalar.h.

Scalar< T > & agxData::Data::asScalar ( )
inherited

Definition at line 91 of file Scalar.h.

template<typename T >
Scalar<T>& agxData::Data::asScalar ( )
inherited
template<typename T >
const Scalar<T>& agxData::Data::asScalar ( ) const
inherited
template<typename T >
T & agxData::Array< T >::at ( size_t  index)
Returns
A reference to the element at the given index in the array.

Definition at line 860 of file Buffer.h.

References agxAssert, and agxVerifyN.

template<typename T >
const T & agxData::Array< T >::at ( size_t  index) const

Definition at line 868 of file Buffer.h.

template<typename T >
T & agxData::Array< T >::back ( )
Returns
A reference to the last element of the array.

Definition at line 820 of file Buffer.h.

References agxAssert, and agxAssert1.

Referenced by agx::createCell().

template<typename T >
const T & agxData::Array< T >::back ( ) const

Definition at line 812 of file Buffer.h.

References agxAssert, and agxAssert1.

template<typename T >
Array< T >::iterator agxData::Array< T >::begin ( )
Returns
An iterator to the first element of the array.

Definition at line 888 of file Buffer.h.

template<typename T >
Array< T >::const_iterator agxData::Array< T >::begin ( ) const

Definition at line 891 of file Buffer.h.

const Buffer * agxData::AbstractArray::buffer ( ) const
inherited
Returns
The buffer that the array indexes into. Can be nullptr.

Definition at line 720 of file Buffer.h.

References agxData::AbstractArray::m_buffer.

Referenced by agxData::AbstractArray::_setBuffer(), and agxData::AbstractArray::init().

Buffer * agxData::AbstractArray::buffer ( )
inherited

Definition at line 719 of file Buffer.h.

References agxData::AbstractArray::m_buffer.

template<typename T >
size_t agxData::Array< T >::commitResult ( size_t  numElements,
const void *  localResult,
agx::Index  sortIndex 
)
See Also
agx::GlobalResult::commitResult

Definition at line 578 of file Buffer.h.

References agx::InvalidIndex.

template<typename T >
size_t agxData::Array< T >::commitResult ( size_t  numElements,
const void *  localResult 
)

Definition at line 587 of file Buffer.h.

References agx::InvalidIndex.

template<typename T >
template<typename T2 >
size_t agxData::Array< T >::commitResult ( const T2 &  vector,
agx::Index  sortIndex 
)
See Also
agx::GlobalResult::commitResult

Definition at line 596 of file Buffer.h.

References agx::InvalidIndex.

template<typename T >
template<typename T2 >
size_t agxData::Array< T >::commitResult ( const T2 &  vector)

Definition at line 606 of file Buffer.h.

References agx::InvalidIndex.

template<typename T >
template<typename T2 >
bool agxData::Array< T >::contains ( const T2 &  element) const
Returns
True if the array contains at least one element that is equal to the given element.

Definition at line 920 of file Buffer.h.

References agx::InvalidIndex.

bool agxData::AbstractArray::empty ( ) const
inherited
Returns
True if size is zero.

Definition at line 713 of file Buffer.h.

References agxData::AbstractArray::m_range, and agx::IndexRangeT< T >::size().

Referenced by agx::createCell().

template<typename T >
Array< T >::iterator agxData::Array< T >::end ( )
Returns
An iterator to one past the last element of the array.

Definition at line 894 of file Buffer.h.

template<typename T >
Array< T >::const_iterator agxData::Array< T >::end ( ) const

Definition at line 897 of file Buffer.h.

template<typename T >
template<typename T2 >
size_t agxData::Array< T >::find ( const T2 &  element) const

The index of the first occurrence of an element that is equal to the given element.

If there is no such element, then InvalidIndex is returned.

Parameters
elementThe value to search for.
Returns
Index of the first match, or if there is no match InvalidIndex.

Definition at line 908 of file Buffer.h.

References agx::InvalidIndex.

template<typename T >
T & agxData::Array< T >::front ( )
Returns
A reference to the first element of the array.

Definition at line 836 of file Buffer.h.

References agxAssert, and agxAssert1.

template<typename T >
const T & agxData::Array< T >::front ( ) const

Definition at line 828 of file Buffer.h.

References agxAssert, and agxAssert1.

Format * agxData::AbstractArray::getFormat ( )
inherited
Returns
The format of the covered Buffer. Will return nullptr if the array is invalid.

Definition at line 726 of file Buffer.h.

References agxData::Buffer::getFormat(), and agxData::AbstractArray::m_buffer.

const Format * agxData::AbstractArray::getFormat ( ) const
inherited

Definition at line 727 of file Buffer.h.

References agxData::Buffer::getFormat(), and agxData::AbstractArray::m_buffer.

template<typename T >
agx::GlobalResult * agxData::Array< T >::getGlobalResult ( )
Returns
The global result object associated with the buffer that the array is bound to.

Definition at line 564 of file Buffer.h.

References agxAssert.

void agxData::AbstractArray::init ( agxData::Buffer *  buffer,
agx::IndexRange32  range 
)
inherited
void agxData::AbstractArray::init ( agxData::Buffer *  buffer)
inherited

Set the buffer that the array will access. The range is set to the entire buffer.

Definition at line 673 of file Buffer.h.

References agxAssert, agxData::AbstractArray::init(), and agxData::Buffer::size().

void agxData::AbstractArray::init ( )
inherited
bool agxData::AbstractArray::isValid ( ) const
inherited
Returns
True if the array is valid, i.e., is bound to a back end buffer.

Definition at line 724 of file Buffer.h.

References agxData::AbstractArray::m_buffer.

template<typename T >
T & agxData::Array< T >::operator[] ( size_t  index)
Returns
A reference to the element at the given index in the array.

Definition at line 845 of file Buffer.h.

References agxAssert1, and agxAssertN.

template<typename T >
const T & agxData::Array< T >::operator[] ( size_t  index) const

Definition at line 854 of file Buffer.h.

template<typename T >
Array< T > agxData::Array< T >::operator[] ( agx::IndexRange32  subRange) const
Returns
Create a new array that covers a subset of the current array.

Definition at line 882 of file Buffer.h.

template<typename T >
T * agxData::Array< T >::ptr ( )
Returns
A pointer to the start of the memory area that the array covers.

Definition at line 900 of file Buffer.h.

Referenced by agx::JacobianAccessorT< T >::setup().

template<typename T >
const T * agxData::Array< T >::ptr ( ) const

Definition at line 904 of file Buffer.h.

agx::IndexRange32 & agxData::AbstractArray::range ( )
inherited
Returns
The range of the back end buffer that this array covers.

Definition at line 721 of file Buffer.h.

References agxData::AbstractArray::m_range.

Referenced by agxData::AbstractArray::AbstractArray(), agx::createCell(), agxData::AbstractArray::init(), and agxData::AbstractArray::setRange().

const agx::IndexRange32 & agxData::AbstractArray::range ( ) const
inherited

Definition at line 722 of file Buffer.h.

References agxData::AbstractArray::m_range.

template<typename T>
Array< T > agxData::Array< T >::raw ( T *  buffer,
agx::Index  size 
)
static

Array creation helper method that creates an array covering the given memory area.

The created array will not have a back end Buffer object and is therefore invalid. The given memory area will be interpreted as an array of elements of type T.

Parameters
bufferMemory area that the array should index into.
sizeThe length, in number of elements, that the array should cover.
Returns
A new array that covers the given memory area.

Definition at line 733 of file Buffer.h.

References agxData::Data::m_ptr, and agxData::AbstractArray::m_range.

template<typename T>
const Array< T > agxData::Array< T >::raw ( const T *  buffer,
agx::Index  size 
)
static

Definition at line 744 of file Buffer.h.

References agxData::Data::m_ptr, and agxData::AbstractArray::m_range.

void agxData::AbstractArray::setRange ( size_t  startIndex,
size_t  endIndex 
)
inherited

Set the range of the buffer that the array will cover.

Definition at line 696 of file Buffer.h.

void agxData::AbstractArray::setRange ( agx::IndexRange32  range)
inherited
size_t agxData::AbstractArray::size ( ) const
inherited
template<typename T >
Array< T > agxData::Array< T >::slice ( agx::IndexRange32  subRange) const
Returns
Create a new array that covers a subset of the current array.

Definition at line 875 of file Buffer.h.

References agx::IndexRangeT< T >::begin(), and agx::IndexRangeT< T >::end().

void agxData::AbstractArray::sync ( )
inherited

Member Data Documentation

template<typename T>
const bool agxData::Array< T >::IsScalar = false
static

Definition at line 121 of file Array.h.


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