MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseHandler< T > Class Template Referenceabstract

Container to store the pointers to all objects that one creates in a simulation. More...

#include <BaseHandler.h>

Public Member Functions

 BaseHandler ()
 Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More...
 
 BaseHandler (const BaseHandler< T > &BH)
 Constructor that copies the objects of the given handler into itself and sets other variables to 0/nullptr. More...
 
virtual ~BaseHandler ()
 Destructor, it destructs the BaseHandler and all Object it contains. More...
 
void copyContentsFromOtherHandler (const BaseHandler< T > &BH)
 Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handler (container) to the other. More...
 
template<typename U >
U * copyAndAddObject (const U &O)
 Creates a copy of a Object and adds it to the BaseHandler. More...
 
template<typename U >
U * copyAndAddObject (U *O)
 Creates a copy of a Object and adds it to the BaseHandler. More...
 
virtual void addObject (T *O)
 Adds a new Object to the BaseHandler. More...
 
virtual void removeObject (unsigned const int id)
 Removes an Object from the BaseHandler. More...
 
void removeLastObject ()
 Removes the last Object from the BaseHandler. More...
 
void clear ()
 Empties the whole BaseHandler by removing all Objects and setting all other variables to 0. More...
 
virtual void readObject (std::istream &is)=0
 Reads Object into the BaseHandler from restart data. More...
 
void read (std::istream &is)
 Reads all objects from restart data. More...
 
T * getObjectById (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler. More...
 
T * getObject (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler. More...
 
const T * getObject (const unsigned int id) const
 Gets a constant pointer to the Object at the specified index in the BaseHandler. More...
 
T * getLastObject ()
 Gets a pointer to the last Object in this BaseHandler. More...
 
const T * getLastObject () const
 Gets a constant pointer to the last Object in this BaseHandler. More...
 
unsigned int getNumberOfObjects () const
 Gets the number of Object in this BaseHandler. More...
 
unsigned int getStorageCapacity () const
 Gets the storage capacity of this BaseHandler. More...
 
void setStorageCapacity (const unsigned int N)
 Sets the storage capacity of this BaseHandler. More...
 
const std::vector< T * >
::const_iterator 
begin () const
 Gets the begin of the const_iterator over all Object in this BaseHandler. More...
 
const std::vector< T * >::iterator begin ()
 Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector< T * >
::const_iterator 
end () const
 Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector< T * >::iterator end ()
 Gets the end of the iterator over all BaseBoundary in this BaseHandler. More...
 
void setDPMBase (DPMBase *DPMBase)
 Sets the problem that is solved using this handler. More...
 
DPMBasegetDPMBase ()
 Gets the problem that is solved using this handler. More...
 
DPMBasegetDPMBase () const
 Gets the problem that is solved using this handler and does not change the class. More...
 
virtual std::string getName () const =0
 Gets the name of this handler. More...
 

Protected Attributes

std::vector< T * > objects_
 The actual list of Object pointers. More...
 

Private Attributes

unsigned int maxObjects_
 An integer to keep track of the largest number of objects ever stored in this BaseHandler. More...
 
unsigned int nextId_
 identifier for next object created More...
 
DPMBaseDPMBase_
 A pointer back to the DPMBase class. More...
 

Detailed Description

template<class T>
class BaseHandler< T >

Container to store the pointers to all objects that one creates in a simulation.

The BaseHandler allows one to create a container to store all pointer objects of a templated type T It is implemented by a (protected) vector of pointers to objects of type T. Once the container is created, the BaseHandler also provides the provision to manipulate the pointers i.e. by accessing, adding, deleting and few more operations by using its member methods.

Definition at line 50 of file BaseHandler.h.

Constructor & Destructor Documentation

template<class T >
BaseHandler< T >::BaseHandler ( )

Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer.

Definition at line 230 of file BaseHandler.h.

References DEBUG, and logger.

231 {
232  DPMBase_ = nullptr;
233  clear();
234  logger(DEBUG, "Basehandler<T>::BaseHandler() finished");
235 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
DPMBase * DPMBase_
A pointer back to the DPMBase class.
Definition: BaseHandler.h:224
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Definition: BaseHandler.h:360
template<class T>
BaseHandler< T >::BaseHandler ( const BaseHandler< T > &  BH)

Constructor that copies the objects of the given handler into itself and sets other variables to 0/nullptr.

Parameters
[in]BHA reference to the BaseHandler that has to be copied.

This is not a copy constructor! It only copies the vector objects_ from the given handler, and sets all other variables to 0/nullptr.

Todo:
Should max objects be set to the number of objects after this constructor? Maybe in copyContentsFromOtherHandler?

Definition at line 244 of file BaseHandler.h.

References DEBUG, and logger.

245 {
246  DPMBase_ = nullptr;
247  clear();
249  logger(DEBUG,"BaseHandler<T>::BaseHandler(const BaseHandler &BH) finished");
250 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
DPMBase * DPMBase_
A pointer back to the DPMBase class.
Definition: BaseHandler.h:224
void copyContentsFromOtherHandler(const BaseHandler< T > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
Definition: BaseHandler.h:259
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Definition: BaseHandler.h:360
template<class T >
BaseHandler< T >::~BaseHandler ( )
virtual

Destructor, it destructs the BaseHandler and all Object it contains.

Definition at line 252 of file BaseHandler.h.

References DEBUG, and logger.

253 {
254  clear();
255  logger(DEBUG, "BaseHandler<T>::~BaseHandler() finished");
256 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Definition: BaseHandler.h:360

Member Function Documentation

template<class T>
void BaseHandler< T >::addObject ( T *  O)
virtual

Adds a new Object to the BaseHandler.

Parameters
[in]OA pointer to the object that must be added.

Reimplemented in WallHandler, ParticleHandler, BoundaryHandler, InteractionHandler, and SpeciesHandler.

Definition at line 284 of file BaseHandler.h.

Referenced by SpeciesHandler::addObject(), InteractionHandler::addObject(), BoundaryHandler::addObject(), ParticleHandler::addObject(), and WallHandler::addObject().

285 {
286  objects_.push_back(O);
287  //Set the index of the particle
288  getLastObject()->setIndex(getNumberOfObjects() - 1);
289  //set the non changing particle identifier
290  getLastObject()->setId(nextId_);
291  //Update Id for next particle
292  nextId_++;
293  //Update the maximum number of Particles
296 }
unsigned int nextId_
identifier for next object created
Definition: BaseHandler.h:216
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:452
unsigned int maxObjects_
An integer to keep track of the largest number of objects ever stored in this BaseHandler.
Definition: BaseHandler.h:211
template<class T >
const std::vector< T * >::iterator BaseHandler< T >::begin ( )

Gets the begin of the iterator over all BaseBoundary in this BaseHandler.

Returns
A iterator pointing to the first Object.

Definition at line 488 of file BaseHandler.h.

489 {
490  return objects_.begin();
491 }
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
template<class T >
void BaseHandler< T >::clear ( )

Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.

Delete all objects stored in objects_ and set the maximum number of objects that have been in this container to 0, and set the Id of the next object that will be added to 0.

Definition at line 360 of file BaseHandler.h.

Referenced by ParticleHandler::clear(), DPMBase::read(), DPMBase::readParAndIniFiles(), and ChuteBottom::setupInitialConditions().

361 {
362 
363  for (auto obj : objects_)
364  {
365  delete obj;
366  }
367  objects_.clear();
368 
369  nextId_ = 0;
370  maxObjects_ = 0;
371 }
unsigned int nextId_
identifier for next object created
Definition: BaseHandler.h:216
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
unsigned int maxObjects_
An integer to keep track of the largest number of objects ever stored in this BaseHandler.
Definition: BaseHandler.h:211
template<class T >
template<class U >
U * BaseHandler< T >::copyAndAddObject ( const U &  O)

Creates a copy of a Object and adds it to the BaseHandler.

Parameters
[in]OA reference to the BaseHandler of which the objects have to be copied.

Definition at line 268 of file BaseHandler.h.

Referenced by ChuteWithHopper::addHopper(), MaserBoundary::addParticleToMaser(), InsertionBoundary::checkBoundaryBeforeTimeStep(), Chute::createBottom(), DPMBase::readNextDataFile(), DPMBase::readParAndIniFiles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), and Chute::setupSideWalls().

269 {
270  U* oCopy = O.copy();
271  addObject(oCopy);
272  return oCopy;
273 }
virtual void addObject(T *O)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:284
template<class T >
template<class U >
U * BaseHandler< T >::copyAndAddObject ( U *  O)

Creates a copy of a Object and adds it to the BaseHandler.

Parameters
[in]OA reference to the Object that has to be copied.

Definition at line 276 of file BaseHandler.h.

277 {
278  U* oCopy = O->copy();
279  addObject(oCopy);
280  return oCopy;
281 }
virtual void addObject(T *O)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:284
template<class T>
void BaseHandler< T >::copyContentsFromOtherHandler ( const BaseHandler< T > &  BH)

Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handler (container) to the other.

Parameters
[in]BHA reference to the BaseHandler of which the objects have to be copied.

Definition at line 259 of file BaseHandler.h.

References BaseHandler< T >::objects_.

260 {
261  for (auto obj : BH.objects_)
262  {
263  addObject(obj->copy());
264  }
265 }
virtual void addObject(T *O)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:284
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
template<class T >
const std::vector< T * >::iterator BaseHandler< T >::end ( )

Gets the end of the iterator over all BaseBoundary in this BaseHandler.

Returns
An iterator pointing to the last BaseBoundary.

Definition at line 500 of file BaseHandler.h.

501 {
502  return objects_.end();
503 }
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
template<class T >
DPMBase * BaseHandler< T >::getDPMBase ( )

Gets the problem that is solved using this handler.

Returns
A pointer to the DPMBase (problem descriptor) that is using this handler.

Definition at line 512 of file BaseHandler.h.

References ERROR, and logger.

Referenced by MaserBoundary::addParticleToMaser(), SlidingFrictionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), BaseInteraction::gatherContactStatistics(), ParticleSpecies::getMassFromRadius(), BaseParticle::getParticleDimensions(), BaseParticle::integrateBeforeForceComputation(), WallHandler::operator=(), ParticleHandler::ParticleHandler(), ParticleSpecies::setDensity(), BaseParticle::setIndSpecies(), BaseWall::setSpecies(), BaseParticle::setSpecies(), LeesEdwardsBoundary::shiftVerticalPosition(), SpeciesHandler::SpeciesHandler(), WallHandler::WallHandler(), and LeesEdwardsBoundary::write().

513 {
514 #ifdef NDEBUG
515  return DPMBase_;
516 #else
517  if (DPMBase_ == nullptr)
518  {
519  logger(ERROR, "[BaseHandler::getDPMBase()] in Object* %: pointer to DPMBase class is not set.", getName());
520  }
521  return DPMBase_;
522 #endif
523 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const =0
Gets the name of this handler.
DPMBase * DPMBase_
A pointer back to the DPMBase class.
Definition: BaseHandler.h:224
template<class T >
DPMBase * BaseHandler< T >::getDPMBase ( ) const

Gets the problem that is solved using this handler and does not change the class.

Returns
A pointer to the DPMBase (problem descriptor) that is using this handler.

Definition at line 526 of file BaseHandler.h.

References ERROR, and logger.

527 {
528 #ifdef NDEBUG
529  return DPMBase_;
530 #else
531  if (DPMBase_ == nullptr)
532  {
533  logger(ERROR, "[BaseHandler::getDPMBase() const] in Object* %: pointer to DPMBase class is not set.", getName());
534  }
535  return DPMBase_;
536 #endif
537 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const =0
Gets the name of this handler.
DPMBase * DPMBase_
A pointer back to the DPMBase class.
Definition: BaseHandler.h:224
template<class T >
T * BaseHandler< T >::getLastObject ( )

Gets a pointer to the last Object in this BaseHandler.

Returns
A pointer to the last Object in the BaseHandler.

Definition at line 452 of file BaseHandler.h.

Referenced by LeesEdwardsBoundary::createVerticalPeriodicParticles(), and ChuteWithHopper::setupInitialConditions().

453 {
454  return objects_.back();
455 }
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
template<class T >
const T * BaseHandler< T >::getLastObject ( ) const

Gets a constant pointer to the last Object in this BaseHandler.

Returns
A constant pointer to the last Object in the BaseHandler.

Definition at line 458 of file BaseHandler.h.

459 {
460  return objects_.back();
461 }
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
template<class T>
virtual std::string BaseHandler< T >::getName ( ) const
pure virtual

Gets the name of this handler.

Returns
A string that contains the name of the handler.

Implemented in ParticleHandler, InteractionHandler, SpeciesHandler, WallHandler, and BoundaryHandler.

template<class T >
T * BaseHandler< T >::getObject ( const unsigned int  index)

Gets a pointer to the Object at the specified index in the BaseHandler.

Parameters
[in]indexthe index of the requested Object.
Returns
A pointer to the requested Object.

Definition at line 415 of file BaseHandler.h.

References ERROR, and logger.

Referenced by DPMBase::checkAndDuplicatePeriodicParticles(), Chute::cleanChute(), ChuteBottom::makeRoughBottom(), DPMBase::removeDuplicatePeriodicParticles(), DPMBase::setFixedParticles(), BaseWall::setHandler(), BaseParticle::setHandler(), BaseWall::setIndSpecies(), BaseParticle::setIndSpecies(), Chute::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), and DPMBase::write().

416 {
417 #ifdef NDEBUG
418  return objects_[index];
419 #else
420  if (index >= getNumberOfObjects())
421  {
422  logger(ERROR, "[BaseHandler::getObject(const unsigned int index)] in Object* %: Object couldn't be found because index (%) is higher than number of objects.", getName(), index);
423  return nullptr;
424  }
425  else
426  {
427  return objects_[index];
428  }
429 #endif
430 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const =0
Gets the name of this handler.
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
template<class T >
const T * BaseHandler< T >::getObject ( const unsigned int  index) const

Gets a constant pointer to the Object at the specified index in the BaseHandler.

Parameters
[in]indexthe index of the requested Object.
Returns
A constant pointer to the requested Object.

Definition at line 434 of file BaseHandler.h.

References ERROR, and logger.

435 {
436 #ifdef NDEBUG
437  return objects_[index];
438 #else
439  if (index >= getNumberOfObjects())
440  {
441  logger(ERROR, "[BaseHandler::getObject(const unsigned int index) const] in Object* %: No object exist with index % number of objects is %", getName(), index, getNumberOfObjects());
442  return nullptr;
443  }
444  else
445  {
446  return objects_[index];
447  }
448 #endif
449 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const =0
Gets the name of this handler.
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
template<class T >
T * BaseHandler< T >::getObjectById ( const unsigned int  id)

Gets a pointer to the Object at the specified index in the BaseHandler.

Parameters
[in]idThe id of the requested Object.
Returns
A pointer to the Object with the correct Id. Gets an object with the identity id. Please note that the object with this identity does not have to be at place id in the vector of Object objects_.

Definition at line 394 of file BaseHandler.h.

References ERROR, and logger.

Referenced by InteractionHandler::readObject().

395 {
396  // Usually, the id and the index into the backing storage matches
397  // So check this postion first!
398  // dducks: Can't we guarantee more? That should speed up searches.
399  if (id < objects_.size() && objects_[id]->getId() == id)
400  {
401  return objects_[id]; //There is a hit, return early
402  }
403 
404  for (T* obj : objects_ ) //Search for the correct id, since it wasn't where
405  { // we expected it. Just use a linear search..
406  if (obj->getId() == id) //Found it, so return!
407  return obj;
408  }
409  logger(ERROR, "[BaseHandler::getObjectById()] in Object* %: Object with ID % could not be found.", getName(), id);
410  return nullptr;
411 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const =0
Gets the name of this handler.
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
template<class T >
unsigned int BaseHandler< T >::getStorageCapacity ( ) const

Gets the storage capacity of this BaseHandler.

Returns
The storage capacity of this BaseHandler.

Definition at line 470 of file BaseHandler.h.

471 {
472  return objects_.capacity();
473 }
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
template<class T >
void BaseHandler< T >::read ( std::istream &  is)

Reads all objects from restart data.

Parameters
[in]isThe input stream from which the information is read.

Definition at line 374 of file BaseHandler.h.

References helpers::getLineFromStringStream(), logger, and VERBOSE.

Referenced by DPMBase::read(), and DPMBase::readOld().

375 {
376  clear();
377  unsigned int N;
378  std::string dummy;
379  is >> dummy;
380  std::stringstream line(std::stringstream::in | std::stringstream::out);
382  line >> N;
383  logger(VERBOSE, "In %::read(is): reading in % objects.", getName(), N);
384  for (unsigned int i = 0; i < N; i++)
385  {
386  readObject(is);
387  }
388 }
virtual void readObject(std::istream &is)=0
Reads Object into the BaseHandler from restart data.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in...
Definition: Helpers.cc:389
virtual std::string getName() const =0
Gets the name of this handler.
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Definition: BaseHandler.h:360
template<class T>
virtual void BaseHandler< T >::readObject ( std::istream &  is)
pure virtual

Reads Object into the BaseHandler from restart data.

Parameters
[in]isThe input stream from which the information is read.

Implemented in ParticleHandler, WallHandler, BoundaryHandler, InteractionHandler, and SpeciesHandler.

template<class T >
void BaseHandler< T >::removeLastObject ( )

Removes the last Object from the BaseHandler.

Definition at line 345 of file BaseHandler.h.

References logger, and WARN.

Referenced by ParticleHandler::removeLastObject().

346 {
347  if (getNumberOfObjects() == 0)
348  {
349  logger(WARN, "In: void %::removeLastObject, no Object exists in this BaseHandler.", getName());
350  return;
351  }
352  //Physically removes Object
353  delete objects_.back();
354  //Remove the (now double) reference to that last Object
355  objects_.pop_back();
356 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const =0
Gets the name of this handler.
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
template<class T >
void BaseHandler< T >::removeObject ( unsigned const int  index)
virtual

Removes an Object from the BaseHandler.

This methods removes a particle. This methods invalidates ANY iterators to particles in this container. This method may shuffle the order of objects in this container.

Parameters
[in]indexAn unsigned integer that gives the id of the Object that has to be removed.

Reimplemented in ParticleHandler, and SpeciesHandler.

Definition at line 303 of file BaseHandler.h.

References ERROR, and logger.

Referenced by BaseInteraction::removeFromHandler(), SpeciesHandler::removeObject(), ParticleHandler::removeObject(), and InteractionHandler::removeObjectKeepingPeriodics().

304 {
305  if (index >= getNumberOfObjects())
306  {
307  logger(ERROR, "In: void %::removeOject(const unsigned int index) const, no object exists with index %, number of objects is %", getName(), index, getNumberOfObjects());
308  return;
309  }
310 
311  //Okay, this function deletes the particle. Now, the problem is that
312  //particles store their position in the handler (@dducks: do they?)
313  //which means that we would absolutely destroy performance if we took
314  //something out in the middle. Now, what we'll do is swap our particle
315  //with the last one (in case it already is, it is invariant); then
316  //remove the last one.
317  //So, we want the last index.
318  std::size_t lastIndex = objects_.size() - 1;
319 
320  //So, step one, retrieve the pointer
321  T* objectToDelete = objects_[index];
322 
323  if (index != lastIndex) //Are we not the last object?
324  {
325  //well.. let's swap.
326  T* objectToMove = objects_[lastIndex];
327 
328  objects_[index] = objectToMove; //place it back
329  objects_[lastIndex] = objectToDelete; //Just to make sure.
330 
331  //and notify it of the change.
332  objects_[index]->moveInHandler(index);
333  //Even though we are going to delete this particle,
334  //we still need to keep it consistent.
335  objects_[lastIndex]->moveInHandler(lastIndex);
336  }
337 
338  //And _NOW_ we delete it.
339  delete objectToDelete;
340 
341  //And clear it from the backing container.
342  objects_.pop_back();
343 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
virtual std::string getName() const =0
Gets the name of this handler.
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
template<class T >
void BaseHandler< T >::setDPMBase ( DPMBase DPMBase)

Sets the problem that is solved using this handler.

Parameters
[in]DPMBaseA pointer to a DPMBase, which is the superclass for all problem descriptions.

Definition at line 506 of file BaseHandler.h.

Referenced by DPMBase::constructor(), and DPMBase::DPMBase().

507 {
508  DPMBase_ = DPMBase;
509 }
DPMBase * DPMBase_
A pointer back to the DPMBase class.
Definition: BaseHandler.h:224
template<class T >
void BaseHandler< T >::setStorageCapacity ( const unsigned int  N)

Sets the storage capacity of this BaseHandler.

Parameters
[in]NThe storage capacity the BaseHandler will have

Definition at line 476 of file BaseHandler.h.

Referenced by DPMBase::constructor(), ChuteBottom::makeRoughBottom(), and ChuteBottom::setupInitialConditions().

477 {
478  objects_.reserve(N);
479 }
std::vector< T * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:205

Member Data Documentation

template<class T>
DPMBase* BaseHandler< T >::DPMBase_
private

A pointer back to the DPMBase class.

Please note that this pointer back to the DPMBase class is a "shared" pointer and should not be deallocated by this class.

Definition at line 224 of file BaseHandler.h.

template<class T>
unsigned int BaseHandler< T >::maxObjects_
private

An integer to keep track of the largest number of objects ever stored in this BaseHandler.

Definition at line 211 of file BaseHandler.h.

template<class T>
unsigned int BaseHandler< T >::nextId_
private

identifier for next object created

Definition at line 216 of file BaseHandler.h.

template<class T>
std::vector<T*> BaseHandler< T >::objects_
protected

The actual list of Object pointers.

The list of Object pointers. This handler is responsible for the memory-deallocation of these objects.

Definition at line 205 of file BaseHandler.h.

Referenced by BaseHandler< T >::copyContentsFromOtherHandler().


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