MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::BlockArray< T > Class Template Reference

#include <array.hpp>

Inheritance diagram for mfem::BlockArray< T >:
[legend]
Collaboration diagram for mfem::BlockArray< T >:
[legend]

Classes

class  const_iterator
 
class  iterator
 
class  iterator_base
 

Public Member Functions

 BlockArray (int block_size=16 *1024)
 
 BlockArray (const BlockArray< T > &other)
 
BlockArrayoperator= (const BlockArray &)=delete
 
 BlockArray (BlockArray< T > &&other)=default
 
BlockArrayoperator= (BlockArray< T > &&other)=default
 
 ~BlockArray ()
 
int Append ()
 Allocate and construct a new item in the array, return its index.
 
int Append (const T &item)
 Allocate and copy-construct a new item in the array, return its index.
 
T & At (int index)
 Access item of the array.
 
const T & At (int index) const
 
T & operator[] (int index)
 Access item of the array.
 
const T & operator[] (int index) const
 
int Size () const
 Return the number of items actually stored.
 
int Capacity () const
 Return the current capacity of the BlockArray.
 
void DeleteAll ()
 Destroy all items, set size to zero.
 
void Swap (BlockArray< T > &other)
 
std::size_t MemoryUsage () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 

Protected Member Functions

int Alloc ()
 
void CheckIndex (int index) const
 
void Destroy ()
 

Protected Attributes

Array< T * > blocks
 
int size
 
int shift
 
int mask
 

Detailed Description

template<typename T>
class mfem::BlockArray< T >

A container for items of type T. Dynamically grows as items are added. Each item is accessible by its index. Items are allocated in larger chunks (blocks), so the 'Append' method is very fast on average.

Definition at line 509 of file array.hpp.

Constructor & Destructor Documentation

◆ BlockArray() [1/3]

template<typename T >
mfem::BlockArray< T >::BlockArray ( int block_size = 16*1024)

Definition at line 1063 of file array.hpp.

◆ BlockArray() [2/3]

template<typename T >
mfem::BlockArray< T >::BlockArray ( const BlockArray< T > & other)

Definition at line 1073 of file array.hpp.

◆ BlockArray() [3/3]

template<typename T >
mfem::BlockArray< T >::BlockArray ( BlockArray< T > && other)
default

◆ ~BlockArray()

template<typename T >
mfem::BlockArray< T >::~BlockArray ( )
inline

Definition at line 517 of file array.hpp.

Member Function Documentation

◆ Alloc()

template<typename T >
int mfem::BlockArray< T >::Alloc ( )
protected

Definition at line 1095 of file array.hpp.

◆ Append() [1/2]

template<typename T >
int mfem::BlockArray< T >::Append ( )

Allocate and construct a new item in the array, return its index.

Definition at line 1107 of file array.hpp.

◆ Append() [2/2]

template<typename T >
int mfem::BlockArray< T >::Append ( const T & item)

Allocate and copy-construct a new item in the array, return its index.

Definition at line 1115 of file array.hpp.

◆ At() [1/2]

template<typename T >
T & mfem::BlockArray< T >::At ( int index)
inline

Access item of the array.

Definition at line 526 of file array.hpp.

◆ At() [2/2]

template<typename T >
const T & mfem::BlockArray< T >::At ( int index) const
inline

Definition at line 531 of file array.hpp.

◆ begin() [1/2]

template<typename T >
iterator mfem::BlockArray< T >::begin ( )
inline

Definition at line 636 of file array.hpp.

◆ begin() [2/2]

template<typename T >
const_iterator mfem::BlockArray< T >::begin ( ) const
inline

Definition at line 638 of file array.hpp.

◆ Capacity()

template<typename T >
int mfem::BlockArray< T >::Capacity ( ) const
inline

Return the current capacity of the BlockArray.

Definition at line 545 of file array.hpp.

◆ cbegin()

template<typename T >
const_iterator mfem::BlockArray< T >::cbegin ( ) const
inline

Definition at line 641 of file array.hpp.

◆ cend()

template<typename T >
const_iterator mfem::BlockArray< T >::cend ( ) const
inline

Definition at line 643 of file array.hpp.

◆ CheckIndex()

template<typename T >
void mfem::BlockArray< T >::CheckIndex ( int index) const
inlineprotected

Definition at line 651 of file array.hpp.

◆ DeleteAll()

template<typename T >
void mfem::BlockArray< T >::DeleteAll ( )
inline

Destroy all items, set size to zero.

Definition at line 548 of file array.hpp.

◆ Destroy()

template<typename T >
void mfem::BlockArray< T >::Destroy ( )
protected

Definition at line 1138 of file array.hpp.

◆ end() [1/2]

template<typename T >
iterator mfem::BlockArray< T >::end ( )
inline

Definition at line 637 of file array.hpp.

◆ end() [2/2]

template<typename T >
const_iterator mfem::BlockArray< T >::end ( ) const
inline

Definition at line 639 of file array.hpp.

◆ MemoryUsage()

template<typename T >
std::size_t mfem::BlockArray< T >::MemoryUsage ( ) const

Definition at line 1132 of file array.hpp.

◆ operator=() [1/2]

template<typename T >
BlockArray & mfem::BlockArray< T >::operator= ( BlockArray< T > && other)
default

◆ operator=() [2/2]

template<typename T >
BlockArray & mfem::BlockArray< T >::operator= ( const BlockArray< T > & )
delete

◆ operator[]() [1/2]

template<typename T >
T & mfem::BlockArray< T >::operator[] ( int index)
inline

Access item of the array.

Definition at line 538 of file array.hpp.

◆ operator[]() [2/2]

template<typename T >
const T & mfem::BlockArray< T >::operator[] ( int index) const
inline

Definition at line 539 of file array.hpp.

◆ Size()

template<typename T >
int mfem::BlockArray< T >::Size ( ) const
inline

Return the number of items actually stored.

Definition at line 542 of file array.hpp.

◆ Swap()

template<typename T >
void mfem::BlockArray< T >::Swap ( BlockArray< T > & other)

Definition at line 1123 of file array.hpp.

Member Data Documentation

◆ blocks

template<typename T >
Array<T*> mfem::BlockArray< T >::blocks
protected

Definition at line 646 of file array.hpp.

◆ mask

template<typename T >
int mfem::BlockArray< T >::mask
protected

Definition at line 647 of file array.hpp.

◆ shift

template<typename T >
int mfem::BlockArray< T >::shift
protected

Definition at line 647 of file array.hpp.

◆ size

template<typename T >
int mfem::BlockArray< T >::size
protected

Definition at line 647 of file array.hpp.


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