NetDEM v1.0
Loading...
Searching...
No Matches
netdem::DEMObjectPool Class Reference

A class implementing object pooling for particles and contacts. More...

#include <dem_object_pool.hpp>

Public Member Functions

 DEMObjectPool (const DEMObjectPool &)=delete
 Copy constructor deleted.
 
DEMObjectPooloperator= (const DEMObjectPool &)=delete
 Copy assignment operator deleted.
 
ParticleGetParticle ()
 Get a free Particle object from the pool, creating a new one if necessary.
 
ContactPPGetContactPP ()
 Get a free ContactPP object from the pool, creating a new one if necessary.
 
ContactPWGetContactPW ()
 Get a free ContactPW object from the pool, creating a new one if necessary.
 
ContactPPClone (ContactPP const *cnt)
 Clone a ContactPP object.
 
ContactPWClone (ContactPW const *cnt)
 Clone a ContactPW object.
 
void RecycleParticle (Particle **p)
 Recycle a Particle object and store it in the pool for later re-use.
 
void RecycleContactPP (ContactPP **cnt)
 Recycle a ContactPP object and store it in the pool for later re-use.
 
void RecycleContactPW (ContactPW **cnt)
 Recycle a ContactPW object and store it in the pool for later re-use.
 
void RecycleParticle (VecXT< Particle * > *p_list)
 Recycle a list of Particle objects and store them in the pool for later re-use.
 
void RecycleContactPP (VecXT< ContactPP * > *cnt_list)
 Recycle a list of ContactPP objects and store them in the pool for later re-use.
 
void RecycleContactPW (VecXT< ContactPW * > *cnt_list)
 Recycle a list of ContactPW objects and store them in the pool for later re-use.
 
void RecycleParticle (VecXT< VecXT< Particle * > > *p_list)
 Recycle a list of lists of Particle objects and store them in the pool for later re-use.
 
 ~DEMObjectPool ()
 Destructor for the DEMObjectPool class.
 

Static Public Member Functions

static DEMObjectPoolGetInstance ()
 Get the singleton instance of the DEMObjectPool.
 

Detailed Description

A class implementing object pooling for particles and contacts.

Particle and contacts are frequently added to or removed from the scene. The pool strategy is used to avoid the frequent construction and de-construction of object instances. When a particle or wall needs to be added, an instance will be obtained from the pool. When a particle or wall needs to be removed, it is recycled and stored in the pool for later re-use.

Constructor & Destructor Documentation

◆ DEMObjectPool()

netdem::DEMObjectPool::DEMObjectPool ( const DEMObjectPool & )
delete

Copy constructor deleted.

◆ ~DEMObjectPool()

netdem::DEMObjectPool::~DEMObjectPool ( )

Destructor for the DEMObjectPool class.

Member Function Documentation

◆ Clone() [1/2]

ContactPP * netdem::DEMObjectPool::Clone ( ContactPP const * cnt)

Clone a ContactPP object.

Parameters
cntThe ContactPP object to clone.
Returns
A pointer to the cloned ContactPP object.

◆ Clone() [2/2]

ContactPW * netdem::DEMObjectPool::Clone ( ContactPW const * cnt)

Clone a ContactPW object.

Parameters
cntThe ContactPW object to clone.
Returns
A pointer to the cloned ContactPW object.

◆ GetContactPP()

ContactPP * netdem::DEMObjectPool::GetContactPP ( )

Get a free ContactPP object from the pool, creating a new one if necessary.

Returns
A pointer to the ContactPP object.

◆ GetContactPW()

ContactPW * netdem::DEMObjectPool::GetContactPW ( )

Get a free ContactPW object from the pool, creating a new one if necessary.

Returns
A pointer to the ContactPW object.

◆ GetInstance()

static DEMObjectPool & netdem::DEMObjectPool::GetInstance ( )
inlinestatic

Get the singleton instance of the DEMObjectPool.

Returns
The singleton instance of the DEMObjectPool.

◆ GetParticle()

Particle * netdem::DEMObjectPool::GetParticle ( )

Get a free Particle object from the pool, creating a new one if necessary.

Returns
A pointer to the Particle object.

◆ operator=()

DEMObjectPool & netdem::DEMObjectPool::operator= ( const DEMObjectPool & )
delete

Copy assignment operator deleted.

◆ RecycleContactPP() [1/2]

void netdem::DEMObjectPool::RecycleContactPP ( ContactPP ** cnt)

Recycle a ContactPP object and store it in the pool for later re-use.

Parameters
cntA double pointer to the ContactPP object to recycle.

◆ RecycleContactPP() [2/2]

void netdem::DEMObjectPool::RecycleContactPP ( VecXT< ContactPP * > * cnt_list)

Recycle a list of ContactPP objects and store them in the pool for later re-use.

Parameters
cnt_listA pointer to the list of ContactPP objects to recycle.

◆ RecycleContactPW() [1/2]

void netdem::DEMObjectPool::RecycleContactPW ( ContactPW ** cnt)

Recycle a ContactPW object and store it in the pool for later re-use.

Parameters
cntA double pointer to the ContactPW object to recycle.

◆ RecycleContactPW() [2/2]

void netdem::DEMObjectPool::RecycleContactPW ( VecXT< ContactPW * > * cnt_list)

Recycle a list of ContactPW objects and store them in the pool for later re-use.

Parameters
cnt_listA pointer to the list of ContactPW objects to recycle.

◆ RecycleParticle() [1/3]

void netdem::DEMObjectPool::RecycleParticle ( Particle ** p)

Recycle a Particle object and store it in the pool for later re-use.

Parameters
pA double pointer to the Particle object to recycle.

◆ RecycleParticle() [2/3]

void netdem::DEMObjectPool::RecycleParticle ( VecXT< Particle * > * p_list)

Recycle a list of Particle objects and store them in the pool for later re-use.

Parameters
p_listA pointer to the list of Particle objects to recycle.

◆ RecycleParticle() [3/3]

void netdem::DEMObjectPool::RecycleParticle ( VecXT< VecXT< Particle * > > * p_list)

Recycle a list of lists of Particle objects and store them in the pool for later re-use.

Parameters
p_listA pointer to the list of lists of Particle objects to recycle.

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