AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
agxData::AbstractArray Class Reference

Arrays are fast accessors into the data, or a portion of it, held by a Buffer. More...

#include <Array.h>

+ Inheritance diagram for agxData::AbstractArray:

Public Member Functions

 AbstractArray ()
 Create a new invalid array.
 
 AbstractArray (agxData::Buffer *buffer)
 Create a new array that covers the entire given buffer.
 
 AbstractArray (agxData::Buffer *buffer, agx::IndexRange32 range)
 Create a new array for the given buffer that covers the specified range.
 
 AbstractArray (const agxData::AbstractArray &other, agx::IndexRange32 localRange)
 Create a new array that covers a subset of another array.
 
void _setBuffer (agxData::Buffer *buffer)
 Set the buffer while maintaining the current range, should normally not be used.
 
agxData::Bufferbuffer ()
 
const agxData::Bufferbuffer () const
 
bool empty () const
 
agxData::FormatgetFormat ()
 
const agxData::FormatgetFormat () const
 
void init ()
 Set to empty array.
 
void init (agxData::Buffer *buffer)
 Set the buffer that the array will access. The range is set to the entire buffer.
 
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.
 
bool isValid () const
 
agx::IndexRange32range ()
 
const agx::IndexRange32range () const
 
void setRange (agx::IndexRange32 range)
 Set the range of the buffer that the array will cover.
 
void setRange (size_t startIndex, size_t endIndex)
 Set the range of the buffer that the array will cover.
 
size_t size () const
 
void sync ()
 Updates the internal data access pointer. Called when the back end buffer is reallocated.
 
- Public Member Functions inherited from agxData::Data
 Data (void *ptr=nullptr)
 
AbstractArrayasArray ()
 
template<typename T >
Array< T > & asArray ()
 
const AbstractArrayasArray () const
 
template<typename T >
const Array< T > & asArray () const
 
AbstractScalarasScalar ()
 
template<typename T >
Scalar< T > & asScalar ()
 
const AbstractScalarasScalar () const
 
template<typename T >
const Scalar< T > & asScalar () const
 
void * ptr ()
 
const void * ptr () const
 

Protected Attributes

agxData::Bufferm_buffer
 
agx::IndexRange32 m_range
 
- Protected Attributes inherited from agxData::Data
void * m_ptr
 

Detailed Description

Arrays are fast accessors into the data, or a portion of it, held by a Buffer.

The AbstractArray provides common base class for the template Array classes.

Definition at line 36 of file Array.h.

Constructor & Destructor Documentation

◆ AbstractArray() [1/4]

agxData::AbstractArray::AbstractArray ( )

Create a new invalid array.

Reading elements through this array will fail.

Definition at line 627 of file Buffer.h.

◆ AbstractArray() [2/4]

agxData::AbstractArray::AbstractArray ( agxData::Buffer buffer)

Create a new array that covers the entire given buffer.

Definition at line 630 of file Buffer.h.

References buffer(), and init().

◆ AbstractArray() [3/4]

agxData::AbstractArray::AbstractArray ( agxData::Buffer buffer,
agx::IndexRange32  range 
)

Create a new array for the given buffer that covers the specified range.

Definition at line 642 of file Buffer.h.

References init(), and range().

◆ AbstractArray() [4/4]

agxData::AbstractArray::AbstractArray ( const agxData::AbstractArray other,
agx::IndexRange32  localRange 
)

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

Definition at line 647 of file Buffer.h.

References agxAssert, agx::IndexRangeT< T >::begin(), agx::IndexRangeT< T >::end(), init(), m_buffer, m_range, range(), and agx::IndexRangeT< T >::size().

Member Function Documentation

◆ _setBuffer()

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

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

Definition at line 679 of file Buffer.h.

References agxAssert, buffer(), m_buffer, and sync().

◆ buffer() [1/2]

Buffer * agxData::AbstractArray::buffer ( )

Definition at line 719 of file Buffer.h.

References m_buffer.

◆ buffer() [2/2]

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

Definition at line 720 of file Buffer.h.

References m_buffer.

Referenced by AbstractArray(), agxData::Array< T >::Array(), agxData::Vector< T >::Vector(), _setBuffer(), and init().

◆ empty()

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

Definition at line 713 of file Buffer.h.

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

Referenced by agx::createCell().

◆ getFormat() [1/2]

Format * agxData::AbstractArray::getFormat ( )
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 m_buffer.

◆ getFormat() [2/2]

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

Definition at line 727 of file Buffer.h.

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

◆ init() [1/3]

void agxData::AbstractArray::init ( )

Set to empty array.

Definition at line 654 of file Buffer.h.

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

Referenced by AbstractArray(), and init().

◆ init() [2/3]

void agxData::AbstractArray::init ( agxData::Buffer buffer)

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, buffer(), init(), and agxData::Buffer::size().

◆ init() [3/3]

void agxData::AbstractArray::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.

Definition at line 661 of file Buffer.h.

References agxAssert, buffer(), agx::IndexRangeT< T >::end(), agxData::Buffer::getArray(), m_buffer, m_range, range(), agxData::Buffer::size(), and sync().

◆ isValid()

bool agxData::AbstractArray::isValid ( ) const
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 m_buffer.

◆ range() [1/2]

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

Definition at line 721 of file Buffer.h.

References m_range.

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

◆ range() [2/2]

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

Definition at line 722 of file Buffer.h.

References m_range.

◆ setRange() [1/2]

void agxData::AbstractArray::setRange ( agx::IndexRange32  range)

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

Definition at line 687 of file Buffer.h.

References agxAssert, agx::IndexRangeT< T >::end(), agxData::Buffer::getArray(), m_buffer, m_range, range(), agxData::Buffer::size(), and sync().

◆ setRange() [2/2]

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

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

Definition at line 696 of file Buffer.h.

References setRange().

Referenced by setRange().

◆ size()

size_t agxData::AbstractArray::size ( ) const
Returns
The number of elements accessible through the array.

Definition at line 708 of file Buffer.h.

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

Referenced by agx::IndexListRange< T >::IndexListRange(), agx::calculateTier(), agx::GlobalResult::commit(), agx::createCell(), agxData::operator<<(), and agx::JacobianAccessorT< T >::setup().

◆ sync()

void agxData::AbstractArray::sync ( )

Updates the internal data access pointer. Called when the back end buffer is reallocated.

Definition at line 702 of file Buffer.h.

References agxAssert, agx::IndexRangeT< T >::begin(), agxData::Buffer::getFormat(), agxData::Format::getSize(), m_buffer, agxData::Data::m_ptr, m_range, and agxData::Buffer::ptr().

Referenced by _setBuffer(), init(), and setRange().

Member Data Documentation

◆ m_buffer

agxData::Buffer* agxData::AbstractArray::m_buffer
protected

Definition at line 96 of file Array.h.

Referenced by AbstractArray(), _setBuffer(), buffer(), getFormat(), init(), isValid(), setRange(), and sync().

◆ m_range

agx::IndexRange32 agxData::AbstractArray::m_range
protected

Definition at line 97 of file Array.h.

Referenced by AbstractArray(), empty(), init(), range(), agxData::Array< T >::raw(), setRange(), size(), and sync().


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