SlowDown Algorithmic Regularization (SDAR)
Algorithmic Regularization with slowdown method for integrating few-body motions
COMM::ParticleGroup< Tparticle, Tpcm > Class Template Reference

Particle group class to store and manage a group of particle. More...

#include <particle_group.h>

Inheritance diagram for COMM::ParticleGroup< Tparticle, Tpcm >:
[legend]
Collaboration diagram for COMM::ParticleGroup< Tparticle, Tpcm >:
[legend]

Public Member Functions

 ParticleGroup ()
 center of mass particle for the group More...
 
void clear ()
 Clear function. More...
 
ParticleGroupoperator= (const ParticleGroup &_particle_group)
 operator = is copy More...
 
 ~ParticleGroup ()
 destructor More...
 
int getBackupDataSize () const
 get backup data size More...
 
int backupParticlePosVel (Float *_bk)
 Backup member particle position and velocity. More...
 
int restoreParticlePosVel (Float *_bk)
 restore member particle position and velocity More...
 
void printColumnTitle (std::ostream &_fout, const int _width=20)
 print titles of class members using column style More...
 
void printColumn (std::ostream &_fout, const int _width=20)
 print data of class members using column style More...
 
void writeBinary (FILE *_fout)
 write particle data to files (notice original address is lost) More...
 
void writeMemberAscii (std::ostream &_fout) const
 write particle data to files (notice original address is lost) More...
 
void readBinary (FILE *_fin)
 Read particle data from file. More...
 
void readMemberAscii (std::istream &_fin)
 Read particle data from file. More...
 
void shiftToCenterOfMassFrame ()
 shift particle to their c.m. frame More...
 
void shiftToOriginFrame ()
 shift particle to their original frame More...
 
void calcCenterOfMass ()
 calculate center-of-mass More...
 
bool isOriginFrame () const
 return true if the system is the in their origin frame More...
 
- Public Member Functions inherited from COMM::List< Tparticle >
 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
 
Tparticle & getMember (const int _index)
 return one member data reference More...
 
Tparticle * getDataAddress () const
 return member data array address More...
 
Tparticle ** getOriginAddressArray () const
 return member original address array More...
 
Tparticle & getLastMember ()
 return last member More...
 
Tparticle & operator[] (const int _index) const
 return one member data reference operator More...
 
Tparticle * getMemberOriginAddress (const int _index) const
 return one member original address More...
 
int getSizeMax () const
 Get maximum member number allow to store. More...
 
void addMemberAndAddress (T &_member)
 copy one member and its address More...
 
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 (Tparticle _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...
 
void writeBackMemberAll ()
 copy all member data back to original address More...
 
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...
 

Public Attributes

Tpcm cm
 

Additional Inherited Members

- Static Public Member Functions inherited from COMM::List< Tparticle >
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 inherited from COMM::List< Tparticle >
int num_
 number of current members in the list More...
 
int nmax_
 maximum number of members allocated in memory More...
 
Tparticle * data_
 member array to store the data, or a link to existed member array (not allocated) More...
 
Tparticle ** 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 Tparticle, class Tpcm>
class COMM::ParticleGroup< Tparticle, Tpcm >

Particle group class to store and manage a group of particle.

A list that storing particle memory addresses and their copy (based on template class particle_)

Constructor & Destructor Documentation

◆ ParticleGroup()

template<class Tparticle , class Tpcm >
COMM::ParticleGroup< Tparticle, Tpcm >::ParticleGroup ( )
inline

center of mass particle for the group

Constructor

Set particle number to zero, clear pointers

◆ ~ParticleGroup()

template<class Tparticle , class Tpcm >
COMM::ParticleGroup< Tparticle, Tpcm >::~ParticleGroup ( )
inline

destructor

Member Function Documentation

◆ backupParticlePosVel()

template<class Tparticle , class Tpcm >
int COMM::ParticleGroup< Tparticle, Tpcm >::backupParticlePosVel ( Float _bk)
inline

Backup member particle position and velocity.

Returns
backup array size
Here is the caller graph for this function:

◆ calcCenterOfMass()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::calcCenterOfMass ( )
inline

calculate center-of-mass

Here is the caller graph for this function:

◆ clear()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::clear ( )
inline

Clear function.

Free dynamical memory space allocated

Here is the caller graph for this function:

◆ getBackupDataSize()

template<class Tparticle , class Tpcm >
int COMM::ParticleGroup< Tparticle, Tpcm >::getBackupDataSize ( ) const
inline

get backup data size

Returns
the data array size for backupParticlePosVel()
Here is the caller graph for this function:

◆ isOriginFrame()

template<class Tparticle , class Tpcm >
bool COMM::ParticleGroup< Tparticle, Tpcm >::isOriginFrame ( ) const
inline

return true if the system is the in their origin frame

Here is the caller graph for this function:

◆ operator=()

template<class Tparticle , class Tpcm >
ParticleGroup& COMM::ParticleGroup< Tparticle, Tpcm >::operator= ( const ParticleGroup< Tparticle, Tpcm > &  _particle_group)
inline

operator = is copy

◆ printColumn()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::printColumn ( std::ostream &  _fout,
const int  _width = 20 
)
inline

print data of class members using column style

print data of class members in one line for column style. Notice no newline is printed at the end

Parameters
[out]_foutstd::ostream output object
[in]_widthprint width (defaulted 20)
Here is the caller graph for this function:

◆ printColumnTitle()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::printColumnTitle ( std::ostream &  _fout,
const int  _width = 20 
)
inline

print titles of class members using column style

print titles of class members in one line for column style

Parameters
[out]_foutstd::ostream output object
[in]_widthprint width (defaulted 20)
Here is the caller graph for this function:

◆ readBinary()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::readBinary ( FILE *  _fin)
inline

Read particle data from file.

Read particle data from file with BINARY format. Number of particles should be first variable, then the data of particles. Only work for ListMode::local case

Parameters
[in]_finFILE IO for reading.
Here is the caller graph for this function:

◆ readMemberAscii()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::readMemberAscii ( std::istream &  _fin)
inline

Read particle data from file.

Read particle data from file with BINARY format. Number of particles should be first variable, then the data of particles. Notice the memory should be allocated first, and the free space is enough to save the reading particles

Parameters
[in]_finstd::istream IO for reading.

◆ restoreParticlePosVel()

template<class Tparticle , class Tpcm >
int COMM::ParticleGroup< Tparticle, Tpcm >::restoreParticlePosVel ( Float _bk)
inline

restore member particle position and velocity

Returns
backup array size
Here is the caller graph for this function:

◆ shiftToCenterOfMassFrame()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::shiftToCenterOfMassFrame ( )
inline

shift particle to their c.m. frame

Shift positions and velocities of particles from original frame to their center-of-mass frame
Notice the center-of-mass position and velocity use values from cm

Here is the caller graph for this function:

◆ shiftToOriginFrame()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::shiftToOriginFrame ( )
inline

shift particle to their original frame

Shift positions and velocities of particles from center-of-mass frame to original frame
Notice the center-of-mass position and velocity use values from cm

◆ writeBinary()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::writeBinary ( FILE *  _fout)
inline

write particle data to files (notice original address is lost)

write particle data into file with BINARY format. Number of particles is written first, then the data of particles

Parameters
[in]_foutFILE IO for writing
Here is the caller graph for this function:

◆ writeMemberAscii()

template<class Tparticle , class Tpcm >
void COMM::ParticleGroup< Tparticle, Tpcm >::writeMemberAscii ( std::ostream &  _fout) const
inline

write particle data to files (notice original address is lost)

! write particle data to files (notice original address is lost) *! write particle data into file with ASCII format. Number of particles is written first, then the data of particles

write particle data into file with ASCII format. Number of particles is written first, then the data of particles

Parameters
[in]_foutstd::ostream IO for writing

Member Data Documentation

◆ cm

template<class Tparticle , class Tpcm >
Tpcm COMM::ParticleGroup< Tparticle, Tpcm >::cm

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