COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ListBufferT< T > Class Template Reference

A Buffer that is constructed passing a boost::multi_array<T,2> table. This class allows to interface this table by using a buffer. More...

#include <ListBufferT.hpp>

Classes

struct  Buffer
 

Public Types

typedef ListBufferIterator< ListBufferTiterator
 type of the iterator More...
 
typedef ListBufferIterator< ListBufferT const > const_iterator
 type of the iterator to constant Component More...
 
typedef boost::multi_array< T, 1 > Array_t
 
typedef T value_type
 

Public Member Functions

 ListBufferT (Array_t &array, size_t nbRows)
 
virtual ~ListBufferT ()
 Virtual destructor. More...
 
void change_buffersize (const size_t nbRows)
 Change the buffer to the new size. More...
 
void flush ()
 flush the buffer in the connectivity Buffer More...
 
Uint add_row (const value_type &val)
 
Uint add_row_directly (const value_type &val)
 
void set_row (const Uint array_idx, const value_type &row)
 
value_typeget_row (const Uint idx)
 
void rm_row (const Uint array_idx)
 
Array_tget_appointed ()
 
Uint total_allocated ()
 
Uint buffers_count () const
 
void increase_array_size (const size_t increase)
 increase the size of the array, only to be used when going to write directly in array More...
 
iterator begin ()
 The begin iterator for a range containing Components. More...
 
iterator end ()
 The end iterator for a range containing Components. More...
 
const_iterator begin () const
 The begin iterator for a range containing Components (const version) More...
 
const_iterator end () const
 The end iterator for a range containing Components (const version) More...
 
void reset ()
 
std::string string ()
 

Static Public Member Functions

static std::string type_name ()
 Get the class name. More...
 

Private Member Functions

void add_buffer ()
 Create a new buffer, allocate it with m_buffersize, and fill m_new_buffer_rows with the new ones. More...
 
bool is_array_row_empty (const Uint row) const
 

Private Attributes

Array_tm_array
 reference to the array that is buffered More...
 
Uint m_buffersize
 
std::vector< Bufferm_buffers
 vector of temporary buffers More...
 
std::deque< Uintm_empty_array_rows
 storage of removed array rows More...
 
std::deque< Uintm_new_array_rows
 storage of array rows where rows can be added directly using add_row_directly More...
 
std::deque< Uintm_empty_buffer_rows
 storage of removed buffer rows More...
 
std::deque< Uintm_new_buffer_rows
 storage of buffer rows where rows can be added More...
 

Detailed Description

template<typename T>
class cf3::common::ListBufferT< T >

A Buffer that is constructed passing a boost::multi_array<T,2> table. This class allows to interface this table by using a buffer.

The idea is to add and remove rows from the table through this buffer. The table is resized when the buffer is full, and values are copied from the buffer into the table.

Note
Before using the matching table or array one has to be sure that the buffer is flushed.
Author
Willem Deconinck

Definition at line 39 of file ListBufferT.hpp.

Member Typedef Documentation

typedef boost::multi_array<T,1> Array_t

Definition at line 49 of file ListBufferT.hpp.

type of the iterator to constant Component

Definition at line 46 of file ListBufferT.hpp.

type of the iterator

Definition at line 44 of file ListBufferT.hpp.

typedef T value_type

Definition at line 50 of file ListBufferT.hpp.

Constructor & Destructor Documentation

ListBufferT ( Array_t array,
size_t  nbRows 
)

Contructor

Parameters
arrayThe table that will be interfaced with
nbRowsThe size the buffer will be allocated with

Definition at line 210 of file ListBufferT.hpp.

~ListBufferT ( )
virtual

Virtual destructor.

Definition at line 219 of file ListBufferT.hpp.

Member Function Documentation

void add_buffer ( )
inlineprivate

Create a new buffer, allocate it with m_buffersize, and fill m_new_buffer_rows with the new ones.

Definition at line 374 of file ListBufferT.hpp.

Uint add_row ( const value_type val)
inline

Add a row to the buffer.

Parameters
[in]valvalue to be added to buffer
Returns
the index in the array+buffers

Definition at line 386 of file ListBufferT.hpp.

Uint add_row_directly ( const value_type val)
inline

Add a row directly to the array

Parameters
[in]valvalue to be added to buffer or array
Returns
the index in the array+buffers

Definition at line 399 of file ListBufferT.hpp.

iterator begin ( )
inline

The begin iterator for a range containing Components.

Definition at line 130 of file ListBufferT.hpp.

const_iterator begin ( ) const
inline

The begin iterator for a range containing Components (const version)

Definition at line 142 of file ListBufferT.hpp.

Uint buffers_count ( ) const
inline
Returns
the number of buffers that are created

Definition at line 123 of file ListBufferT.hpp.

void change_buffersize ( const size_t  nbRows)
inline

Change the buffer to the new size.

Definition at line 467 of file ListBufferT.hpp.

iterator end ( )
inline

The end iterator for a range containing Components.

Definition at line 136 of file ListBufferT.hpp.

const_iterator end ( ) const
inline

The end iterator for a range containing Components (const version)

Definition at line 148 of file ListBufferT.hpp.

void flush ( )

flush the buffer in the connectivity Buffer

Definition at line 239 of file ListBufferT.hpp.

Array_t& get_appointed ( )
inline
Returns
the array that the buffer operates on

Definition at line 117 of file ListBufferT.hpp.

ListBufferT< T >::value_type & get_row ( const Uint  idx)
inline
Returns
the row with index idx, searching both in array and buffers

Definition at line 337 of file ListBufferT.hpp.

void increase_array_size ( const size_t  increase)
inline

increase the size of the array, only to be used when going to write directly in array

Definition at line 360 of file ListBufferT.hpp.

bool is_array_row_empty ( const Uint  row) const
inlineprivate

Definition at line 176 of file ListBufferT.hpp.

void reset ( )
inline

Definition at line 153 of file ListBufferT.hpp.

void rm_row ( const Uint  array_idx)
inline

Mark row as empty in array or buffer

Parameters
[in]array_idxthe index of the row to be removed

Definition at line 439 of file ListBufferT.hpp.

void set_row ( const Uint  array_idx,
const value_type row 
)
inline

copy a given row into the array or buffer, depending on the given index

Parameters
[in]array_idxthe index of the row that will be set (both in array and buffers)
[in]rowthe row that will be copied into the buffer or array

Definition at line 411 of file ListBufferT.hpp.

std::string string ( )
inline

Definition at line 475 of file ListBufferT.hpp.

Uint total_allocated ( )
inline
Returns
total number of allocated rows, including all buffers and the array

Definition at line 228 of file ListBufferT.hpp.

static std::string type_name ( )
inlinestatic

Get the class name.

Definition at line 84 of file ListBufferT.hpp.

Member Data Documentation

Array_t& m_array
private

reference to the array that is buffered

Definition at line 184 of file ListBufferT.hpp.

std::vector<Buffer> m_buffers
private

vector of temporary buffers

Definition at line 191 of file ListBufferT.hpp.

Uint m_buffersize
private

The size newly created buffers will have

Note
it is safe to change in the middle of buffer operations

Definition at line 188 of file ListBufferT.hpp.

std::deque<Uint> m_empty_array_rows
private

storage of removed array rows

Definition at line 194 of file ListBufferT.hpp.

std::deque<Uint> m_empty_buffer_rows
private

storage of removed buffer rows

Definition at line 200 of file ListBufferT.hpp.

std::deque<Uint> m_new_array_rows
private

storage of array rows where rows can be added directly using add_row_directly

Definition at line 197 of file ListBufferT.hpp.

std::deque<Uint> m_new_buffer_rows
private

storage of buffer rows where rows can be added

Definition at line 203 of file ListBufferT.hpp.


The documentation for this class was generated from the following file:
Send comments to:
COOLFluiD Web Admin