SlowDown Algorithmic Regularization (SDAR)
Algorithmic Regularization with slowdown method for integrating few-body motions
COMM::List< Ttype > Class Template Reference

list class to store and manage a group of member More...

#include <list.h>

Public Member Functions

 List ()
 Constructor. More...
 
void setMode (const ListMode _mode)
 set mode More...
 
void reserveMem (const int _nmax)
 Memory allocation for storing members. More...
 
void clear ()
 Clear function. More...
 
Listoperator= (const List &_list)
 operator = is copy More...
 
 ~List ()
 destructor More...
 
int getSize () const
 get current member number More...
 
ListMode getMode () const
 
Ttype & getMember (const int _index)
 return one member data reference More...
 
Ttype * getDataAddress () const
 return member data array address More...
 
Ttype ** getOriginAddressArray () const
 return member original address array More...
 
Ttype & getLastMember ()
 return last member More...
 
Ttype & operator[] (const int _index) const
 return one member data reference operator More...
 
Ttype * getMemberOriginAddress (const int _index) const
 return one member original address More...
 
int getSizeMax () const
 Get maximum member number allow to store. More...
 
template<class T >
void addMemberAndAddress (T &_member)
 copy one member and its address More...
 
template<class T >
void addMember (const T &_member)
 copy one member and its address More...
 
void increaseSizeNoInitialize (const int _n)
 increase size without initialization More...
 
void decreaseSizeNoInitialize (const int _n)
 increase size without initialization More...
 
void resizeNoInitialize (const int _n)
 increase size without initialization More...
 
void linkMemberArray (Ttype _member[], const int _n_member)
 link a member array More...
 
void removeMember (const int _index, const bool _shift_last_only_flag)
 remove one member More...
 
void removeMemberTable (const int *remove_table)
 remove a list of member based on remove table More...
 
void removeMemberList (const int *_index, const int _n_index)
 remove a list of member based on an index list More...
 
template<class T >
void writeBackMemberAll ()
 copy all member data back to original address More...
 
template<class T >
void writeBackMemberList (const int *_index, const int _n)
 copy a list of member data back to original address More...
 
bool isModified () const
 Get modified status. More...
 
void setModifiedFalse ()
 Reset modified status to false. More...
 

Static Public Member Functions

static void createRemoveTable (const int *_index, const int _n_index, const int _n_member, int *_remove_table)
 create remove table for removing a list of members More...
 

Protected Attributes

int num_
 number of current members in the list More...
 
int nmax_
 maximum number of members allocated in memory More...
 
Ttype * data_
 member array to store the data, or a link to existed member array (not allocated) More...
 
Ttype ** adr_
 original member address of member members More...
 
ListMode mode_
 mode indicator More...
 
bool modified_flag_
 true: member list is modified; used for safety checking More...
 

Detailed Description

template<class Ttype>
class COMM::List< Ttype >

list class to store and manage a group of member

A list that storing member memory addresses and their copy (based on template class Ttype)

Constructor & Destructor Documentation

◆ List()

template<class Ttype >
COMM::List< Ttype >::List ( )
inline

Constructor.

Set member number to zero, clear pointers

◆ ~List()

template<class Ttype >
COMM::List< Ttype >::~List ( )
inline

destructor

Member Function Documentation

◆ addMember()

template<class Ttype >
template<class T >
void COMM::List< Ttype >::addMember ( const T &  _member)
inline

copy one member and its address

add a member by copying it into local allocated memory. Only work for ListMode::local

Parameters
[in]_membera member to store (push back at the end of local array)
Here is the caller graph for this function:

◆ addMemberAndAddress()

template<class Ttype >
template<class T >
void COMM::List< Ttype >::addMemberAndAddress ( T &  _member)
inline

copy one member and its address

add a member by copying member into local allocated memory and storing the original memory address of it. Only work for ListMode::copy

Parameters
[in]_membera member to store (push back at the end of local array)

◆ clear()

template<class Ttype >
void COMM::List< Ttype >::clear ( )
inline

Clear function.

Free dynamical memory space allocated

Here is the caller graph for this function:

◆ createRemoveTable()

template<class Ttype >
static void COMM::List< Ttype >::createRemoveTable ( const int *  _index,
const int  _n_index,
const int  _n_member,
int *  _remove_table 
)
inlinestatic

create remove table for removing a list of members

Parameters
[in]_indexmember index list for remove
[in]_n_indexnumber of removing member indice
[in]_n_membernumber of total members in the table
[out]_remove_tableremove_table generated, the size should be at least number of members to avoid overflow. for index i in table, value <0: no remove; <_number_member: new position; = _number_member: delete
Here is the caller graph for this function:

◆ decreaseSizeNoInitialize()

template<class Ttype >
void COMM::List< Ttype >::decreaseSizeNoInitialize ( const int  _n)
inline

increase size without initialization

Work for ListMode::local and link case. Require the memory size is big enough to contain the new number of members.

Here is the caller graph for this function:

◆ getDataAddress()

template<class Ttype >
Ttype* COMM::List< Ttype >::getDataAddress ( ) const
inline

return member data array address

Here is the caller graph for this function:

◆ getLastMember()

template<class Ttype >
Ttype& COMM::List< Ttype >::getLastMember ( )
inline

return last member

Here is the caller graph for this function:

◆ getMember()

template<class Ttype >
Ttype& COMM::List< Ttype >::getMember ( const int  _index)
inline

return one member data reference

Parameters
[in]_indexindex of member in group

◆ getMemberOriginAddress()

template<class Ttype >
Ttype* COMM::List< Ttype >::getMemberOriginAddress ( const int  _index) const
inline

return one member original address

Only work when mode is ListMode::copy

Returns
: one member original address array

◆ getMode()

template<class Ttype >
ListMode COMM::List< Ttype >::getMode ( ) const
inline

◆ getOriginAddressArray()

template<class Ttype >
Ttype** COMM::List< Ttype >::getOriginAddressArray ( ) const
inline

return member original address array

◆ getSize()

template<class Ttype >
int COMM::List< Ttype >::getSize ( ) const
inline

get current member number

Returns
Current member number in member address list data_
Here is the caller graph for this function:

◆ getSizeMax()

template<class Ttype >
int COMM::List< Ttype >::getSizeMax ( ) const
inline

Get maximum member number allow to store.

Returns
allocated number of members in memory

◆ increaseSizeNoInitialize()

template<class Ttype >
void COMM::List< Ttype >::increaseSizeNoInitialize ( const int  _n)
inline

increase size without initialization

Work for ListMode::local case. Require the memory size is big enough to contain the new number of members.

Here is the caller graph for this function:

◆ isModified()

template<class Ttype >
bool COMM::List< Ttype >::isModified ( ) const
inline

Get modified status.

◆ linkMemberArray()

template<class Ttype >
void COMM::List< Ttype >::linkMemberArray ( Ttype  _member[],
const int  _n_member 
)
inline

link a member array

point the local member data to the begining of the input _member, no data copy, any modification later will be directly on original member array. Work for ListMode::link

Parameters
[in]_memberarray of members
[in]_n_membernumber of members

◆ operator=()

template<class Ttype >
List& COMM::List< Ttype >::operator= ( const List< Ttype > &  _list)
inline

operator = is copy

◆ operator[]()

template<class Ttype >
Ttype& COMM::List< Ttype >::operator[] ( const int  _index) const
inline

return one member data reference operator

overload []

Parameters
[in]_indexindex of member in group

◆ removeMember()

template<class Ttype >
void COMM::List< Ttype >::removeMember ( const int  _index,
const bool  _shift_last_only_flag 
)
inline

remove one member

remove one member from local member array

Parameters
[in]_indexmember index to be removed
[in]_shift_last_only_flagtrue: shift last member to current position (defaulted); false: shift all right member to left by one

◆ removeMemberList()

template<class Ttype >
void COMM::List< Ttype >::removeMemberList ( const int *  _index,
const int  _n_index 
)
inline

remove a list of member based on an index list

Parameters
[in]_indexmember index list for remove
[in]_n_indexnumber of removing member indices

◆ removeMemberTable()

template<class Ttype >
void COMM::List< Ttype >::removeMemberTable ( const int *  remove_table)
inline

remove a list of member based on remove table

Parameters
[in]remove_tabletable map the member new position and deleted ones, generated from createRemoveTable
Here is the caller graph for this function:

◆ reserveMem()

template<class Ttype >
void COMM::List< Ttype >::reserveMem ( const int  _nmax)
inline

Memory allocation for storing members.

allocate memory for storing members and their original addresses.

Parameters
[in]_nmaxmaximum number of members for memory allocation
Here is the caller graph for this function:

◆ resizeNoInitialize()

template<class Ttype >
void COMM::List< Ttype >::resizeNoInitialize ( const int  _n)
inline

increase size without initialization

Work for ListMode::local case. Require the memory size is big enough to contain the new number of members.

Here is the caller graph for this function:

◆ setMode()

template<class Ttype >
void COMM::List< Ttype >::setMode ( const ListMode  _mode)
inline

set mode

Only set once, to set new mode, clear must be done first

Here is the caller graph for this function:

◆ setModifiedFalse()

template<class Ttype >
void COMM::List< Ttype >::setModifiedFalse ( )
inline

Reset modified status to false.

◆ writeBackMemberAll()

template<class Ttype >
template<class T >
void COMM::List< Ttype >::writeBackMemberAll ( )
inline

copy all member data back to original address

work for ListMode::copy

◆ writeBackMemberList()

template<class Ttype >
template<class T >
void COMM::List< Ttype >::writeBackMemberList ( const int *  _index,
const int  _n 
)
inline

copy a list of member data back to original address

work for ListMode::copy

Parameters
[in]_indexlist of member index
[in]_nnumber of members

Member Data Documentation

◆ adr_

template<class Ttype >
Ttype** COMM::List< Ttype >::adr_
protected

original member address of member members

◆ data_

template<class Ttype >
Ttype* COMM::List< Ttype >::data_
protected

member array to store the data, or a link to existed member array (not allocated)

◆ mode_

template<class Ttype >
ListMode COMM::List< Ttype >::mode_
protected

mode indicator

◆ modified_flag_

template<class Ttype >
bool COMM::List< Ttype >::modified_flag_
protected

true: member list is modified; used for safety checking

◆ nmax_

template<class Ttype >
int COMM::List< Ttype >::nmax_
protected

maximum number of members allocated in memory

◆ num_

template<class Ttype >
int COMM::List< Ttype >::num_
protected

number of current members in the list


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