MFEM  v3.3.2
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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)
 
 ~BlockArray ()
 
int Append ()
 Allocate and construct a new item in the array, return its index. More...
 
int Append (const T &item)
 Allocate and copy-construct a new item in the array, return its index. More...
 
T & At (int index)
 Access item of the array. More...
 
const T & At (int index) const
 
T & operator[] (int index)
 Access item of the array. More...
 
const T & operator[] (int index) const
 
int Size () const
 Return the number of items actually stored. More...
 
int Capacity () const
 Return the current capacity of the BlockArray. More...
 
void Swap (BlockArray< T > &other)
 
long MemoryUsage () const
 
iterator begin ()
 
iterator end ()
 
const_iterator cbegin () const
 
const_iterator cend () const
 

Protected Member Functions

int Alloc ()
 
void CheckIndex (int index) const
 

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 341 of file array.hpp.

Constructor & Destructor Documentation

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

Definition at line 765 of file array.hpp.

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

Definition at line 775 of file array.hpp.

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

Definition at line 841 of file array.hpp.

Member Function Documentation

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

Definition at line 797 of file array.hpp.

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

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

Definition at line 809 of file array.hpp.

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 817 of file array.hpp.

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

Access item of the array.

Definition at line 355 of file array.hpp.

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

Definition at line 360 of file array.hpp.

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

Definition at line 462 of file array.hpp.

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

Return the current capacity of the BlockArray.

Definition at line 374 of file array.hpp.

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

Definition at line 465 of file array.hpp.

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

Definition at line 467 of file array.hpp.

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

Definition at line 475 of file array.hpp.

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

Definition at line 463 of file array.hpp.

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

Definition at line 834 of file array.hpp.

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

Access item of the array.

Definition at line 367 of file array.hpp.

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

Definition at line 368 of file array.hpp.

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

Return the number of items actually stored.

Definition at line 371 of file array.hpp.

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

Definition at line 825 of file array.hpp.

Member Data Documentation

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

Definition at line 470 of file array.hpp.

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

Definition at line 471 of file array.hpp.

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

Definition at line 471 of file array.hpp.

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

Definition at line 471 of file array.hpp.


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