|
Container to store all Domain. More...
#include <DomainHandler.h>
Public Member Functions | |
DomainHandler () | |
Default constructor, it creates an empty DomainHandler. More... | |
DomainHandler (const DomainHandler &DH) | |
Constructor that copies all Domain it contains. More... | |
DomainHandler & | operator= (const DomainHandler &rhs) |
Assignment operator. More... | |
~DomainHandler () final | |
Destructor, it destructs the DomainHandler and all Domain it contains. More... | |
void | createMesh (std::vector< Mdouble > &simulationMin, std::vector< Mdouble > &simulationMax, std::vector< unsigned > &numberOfDomains, bool open) |
Creates a Cartesian square mesh in 3D. More... | |
void | createDomains (std::vector< Mdouble > domainMin, std::vector< Mdouble > domainMax, std::vector< unsigned > &globalMeshIndex, std::vector< unsigned > &numberOfDomains, int dimCounter, std::vector< Mdouble > &meshSize, bool open) |
Recursive function that creates the domains for a 3D mesh. More... | |
void | addObject (Domain *D) final |
Adds a Domain to the DomainHandler. More... | |
void | readAndAddObject (std::istream &is) final |
reads a domain object More... | |
void | readOldObject (std::istream &is) |
reads an old domain object More... | |
std::string | getName () const final |
returns the name of the class More... | |
void | setCurrentDomainIndex (unsigned int index) |
This sets a domain to the processor. More... | |
Domain * | getCurrentDomain () |
Gets the domain assigned to the processor. More... | |
const Domain * | getCurrentDomain () const |
unsigned int | getCurrentDomainIndex () const |
Gets the domain index assigned to the processor. More... | |
void | setNumberOfDomains (std::vector< unsigned > &numberOfdomains) |
Sets the number of domains in the domain handler. More... | |
std::vector< unsigned > | getNumberOfDomains () |
Gets the number of domains in the domain handler. More... | |
void | setInteractionDistance (Mdouble interactionDistance) |
Sets the interaction distance of the domain handler. More... | |
Mdouble | getInteractionDistance () |
Gets the interaction distance of the domain handler. More... | |
int | getParticleDomainGlobalIndex (BaseParticle *particle) |
int | getParticleProcessor (int globalIndex) |
Domain * | getParticleDomain (int globalIndex) |
void | updateStatus (std::set< BaseParticle * > &particlesToBeDeleted) |
void | updateVelocity () |
void | addNewParticles () |
void | initialise () |
Public Member Functions inherited from BaseHandler< Domain > | |
BaseHandler () | |
Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More... | |
BaseHandler (const BaseHandler< Domain > &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< Domain > &BH) |
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handler (container) to the other. More... | |
std::enable_if<!std::is_pointer< U >::value, U * >::type | copyAndAddObject (const U &object) |
Creates a copy of a Object and adds it to the BaseHandler. More... | |
std::enable_if< std::is_pointer< U >::value, U >::type | copyAndAddObject (const U object) |
Creates a copy of a Object and adds it to the BaseHandler. More... | |
std::enable_if<!std::is_pointer< U >::value, U * >::type | copyAndAddGhostObject (const U &object) |
Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More... | |
std::enable_if< std::is_pointer< U >::value, U >::type | copyAndAddGhostObject (const U object) |
Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More... | |
virtual void | addExistingObject (Domain *O) |
Adds an existing object to the BaseHandler without changing the id of the object. More... | |
virtual void | addObject (Domain *object) |
Adds a new Object to the BaseHandler. More... | |
virtual void | addGhostObject (Domain *O) |
Adds a new Object to the BaseHandler. called by the to avoid increasing the id. More... | |
void | removeIf (const std::function< bool(Domain *)> cond) |
virtual void | removeObject (unsigned const int index) |
Removes an Object from the BaseHandler. More... | |
void | removeLastObject () |
Removes the last Object from the BaseHandler. More... | |
virtual void | clear () |
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0. More... | |
void | read (std::istream &is) |
Reads all objects from restart data. More... | |
Domain * | getObjectById (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
std::vector< Domain * > | getObjectsById (const unsigned int id) |
Gets a vector of pointers to the objects with the specific id. More... | |
Domain * | getObject (const unsigned int id) |
Gets a pointer to the Object at the specified index in the BaseHandler. More... | |
const Domain * | getObject (const unsigned int id) const |
Gets a constant pointer to the Object at the specified index in the BaseHandler. More... | |
Domain * | getLastObject () |
Gets a pointer to the last Object in this BaseHandler. More... | |
const Domain * | getLastObject () const |
Gets a constant pointer to the last Object in this BaseHandler. More... | |
virtual unsigned int | getNumberOfObjects () const |
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles) More... | |
unsigned int | getSize () const |
Gets the size of the particleHandler (including mpi and periodic particles) 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... | |
void | resize (const unsigned int N, const Domain &obj) |
Resizes the container to contain N elements. More... | |
const std::vector< Domain * >::const_iterator | begin () const |
Gets the begin of the const_iterator over all Object in this BaseHandler. More... | |
const std::vector< Domain * >::iterator | begin () |
Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< Domain * >::const_iterator | end () const |
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More... | |
const std::vector< Domain * >::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... | |
void | setId (Domain *object, unsigned int id) |
void | increaseId () |
unsigned int | getNextId () |
void | setNextId (unsigned int id) |
DPMBase * | getDPMBase () |
Gets the problem that is solved using this handler. More... | |
DPMBase * | getDPMBase () const |
Gets the problem that is solved using this handler and does not change the class. More... | |
virtual void | writeVTK () const |
now empty function for writing VTK files. More... | |
unsigned | getNextGroupId () |
Should be called each time you assign a groupId. Returns the value of nextGroupId_ and increases nextGroupId_ by one. More... | |
Private Attributes | |
unsigned int | currentDomainIndex_ |
Index to the particular domain of this process. More... | |
std::vector< int > | globalIndexToProcessorList_ |
look-up table to find the processor of a domain given the globalIndex of the domain More... | |
std::vector< unsigned > | numberOfDomains_ |
vector containing the number of domains in Cartesian direction More... | |
Mdouble | interactionDistance_ |
Interaction distance between a domain boundary and the communication zone boundary. More... | |
Additional Inherited Members | |
Protected Attributes inherited from BaseHandler< Domain > | |
std::vector< Domain * > | objects_ |
The actual list of Object pointers. More... | |
Container to store all Domain.
The DomainHandler is a container to store all Domain. It is implemented by a vector of pointers to domain. Additionally it also contains an index that points to the current domain of the processorID. Such that the processor knows which Domain it has to compute
DomainHandler::DomainHandler | ( | ) |
Default constructor, it creates an empty DomainHandler.
Constructor of the DomainHandler class. It creates and empty DomainHandler.
References currentDomainIndex_, DEBUG, interactionDistance_, and logger.
DomainHandler::DomainHandler | ( | const DomainHandler & | DH | ) |
Constructor that copies all Domain it contains.
[in] | DH | The DomainHandler that has to be copied. |
This is not a copy constructor! It copies the DPMBase and all Domain, and sets the other variables to 0.
References BaseHandler< Domain >::copyContentsFromOtherHandler(), DEBUG, and logger.
|
final |
void DomainHandler::addNewParticles | ( | ) |
References Domain::addNewParticles(), and getCurrentDomain().
Referenced by DPMBase::initialiseSolve(), DPMBase::performGhostParticleUpdate(), DPMBase::read(), and DPMBase::updateGhostGrid().
|
final |
Adds a Domain to the DomainHandler.
[in] | D | A pointer to the Domain that has to be added. |
Adds the object to the DomainHandler and sets the DomainHandler pointer in the Domain to this DomainHandler.
References BaseHandler< T >::addObject(), and D.
void DomainHandler::createDomains | ( | std::vector< Mdouble > | domainMin, |
std::vector< Mdouble > | domainMax, | ||
std::vector< unsigned > & | globalMeshIndex, | ||
std::vector< unsigned > & | numberOfDomains, | ||
int | dimCounter, | ||
std::vector< Mdouble > & | meshSize, | ||
bool | open | ||
) |
Recursive function that creates the domains for a 3D mesh.
For a given dimension, dimCounter, compute the size of the domain, and accordingly create domains with the correct minimum and maximum value in the dimCounter-direction. When all bounds of a domain are set, i.e. dimCounter is zero, the domain is actually created.
[in,out] | domainMin | The minimum simulation values in Cartesian direction as input and the minimum domain values as output/input |
[in] | domainMax | The maximum simulation values in Cartesian direction as input and the maximum domain values as output/intput |
[in] | globalMeshIndex | A Vector containing the mesh indices, i.e. (i,j,k) = (3,5,2) |
[in] | numberOfDomains | A vector containg the number of domoains in Cartesian direction |
[in] | dimCounter | The dimension counter that keeps track in whicn direction the rescursive function is working |
[in] | open | determines if a domain boundary is open (inf) or closed |
References BaseHandler< Domain >::copyAndAddObject(), constants::i, constants::inf, Domain::setBounds(), and Domain::setHandler().
Referenced by createMesh().
void DomainHandler::createMesh | ( | std::vector< Mdouble > & | simulationMin, |
std::vector< Mdouble > & | simulationMax, | ||
std::vector< unsigned > & | numberOfDomains, | ||
bool | open | ||
) |
Creates a Cartesian square mesh in 3D.
Creates a cartesian square mesh in 3D.
By default the number of domains should be 1 in each direction. The mesh creates the required 3D domains and then disables any domain boundaries that are not connected to another domain. Lookup tables are created between domains and ranks.
[in] | simulationMin | The minimum values of the simulation domain in cartesian coordinates |
[in] | simulationMax | The maximum values of the simulation domain in cartesian coordinates |
[in] | numberOfDomains | The number of domains in cartesian direction |
[in] | open | Determines if the boundary domains have infinite limits (true) or not (false) |
References createDomains(), BaseHandler< Domain >::getSize(), INFO, logger, BaseHandler< Domain >::objects_, PROCESSOR_ID, and setNumberOfDomains().
Referenced by DPMBase::decompose().
Domain * DomainHandler::getCurrentDomain | ( | ) |
Gets the domain assigned to the processor.
Returns a pointer to the active domain.
The active domain is the domain that was assigned to the processor
References currentDomainIndex_, and BaseHandler< Domain >::getObject().
Referenced by addNewParticles(), DPMBase::deleteGhostParticles(), PeriodicBoundaryHandler::findTargetProcessor(), DPMBase::getCurrentDomain(), PeriodicBoundaryHandler::getMPIFlags(), ParticleHandler::getNumberOfRealObjectsLocal(), DPMBase::insertGhostParticle(), DPMBase::mpiInsertParticleCheck(), DPMBase::mpiIsInCommunicationZone(), ForceLawsMPI2Test::printTime(), setInteractionDistance(), DPMBase::updateGhostGrid(), updateStatus(), and updateVelocity().
const Domain * DomainHandler::getCurrentDomain | ( | ) | const |
References currentDomainIndex_, and BaseHandler< Domain >::getObject().
unsigned int DomainHandler::getCurrentDomainIndex | ( | ) | const |
Gets the domain index assigned to the processor.
Gets the Domain Index in the vector of the DomainHandler assigned to this processor
References currentDomainIndex_.
Mdouble DomainHandler::getInteractionDistance | ( | ) |
Gets the interaction distance of the domain handler.
Gets the interaction distance of the communication zone.
The interaction distance is used to define how large the communication zone of the domains have to be. generally twice the size of the largest interaction radius
References interactionDistance_.
Referenced by Domain::findNearbyBoundaries(), Domain::isInGreaterDomain(), Domain::isInInnerDomain(), and DPMBase::updateGhostGrid().
|
finalvirtual |
std::vector< unsigned > DomainHandler::getNumberOfDomains | ( | ) |
Gets the number of domains in the domain handler.
The number of domains is given as a vector in the form of (nx,ny,nz) where nx,ny,nz are the number of domains in their respective direction
References numberOfDomains_.
Referenced by Domain::createLookUpTable(), Domain::disableBoundaries(), and getParticleDomainGlobalIndex().
Domain * DomainHandler::getParticleDomain | ( | int | globalIndex | ) |
References BaseHandler< Domain >::getObject().
int DomainHandler::getParticleDomainGlobalIndex | ( | BaseParticle * | particle | ) |
MX: function under construction
TW@Marnix should this be unsigned int?
References BaseHandler< Domain >::getDPMBase(), getNumberOfDomains(), DPMBase::getNumberOfDomains(), BaseInteractable::getPosition(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getYMin(), DPMBase::getZMax(), DPMBase::getZMin(), constants::i, Vec3D::X, Vec3D::Y, and Vec3D::Z.
Referenced by SubcriticalMaserBoundaryTEST::copyExtraParticles(), SubcriticalMaserBoundaryTEST::extendBottom(), and PeriodicBoundaryHandler::findTargetProcessor().
int DomainHandler::getParticleProcessor | ( | int | globalIndex | ) |
Referenced by SubcriticalMaserBoundaryTEST::copyExtraParticles(), SubcriticalMaserBoundaryTEST::extendBottom(), and PeriodicBoundaryHandler::findTargetProcessor().
void DomainHandler::initialise | ( | ) |
References BaseHandler< Domain >::copyAndAddObject(), currentDomainIndex_, constants::inf, Domain::setBounds(), and Domain::setHandler().
Referenced by DPMBase::constructor(), and DPMBase::DPMBase().
DomainHandler & DomainHandler::operator= | ( | const DomainHandler & | rhs | ) |
Assignment operator.
[in] | rhs | The DomainHandler on the right hand side of the assignment. |
This is not a copy assignment operator! It copies the DPMBase and all Domain, and sets the other variables to 0.
References BaseHandler< Domain >::clear(), BaseHandler< Domain >::copyContentsFromOtherHandler(), DEBUG, and logger.
|
finalvirtual |
reads a domain object
There is no need to read domain object, they can be computed easily
Implements BaseHandler< Domain >.
void DomainHandler::readOldObject | ( | std::istream & | is | ) |
reads an old domain object
There is no need to read a domain object, they can be computed easily
void DomainHandler::setCurrentDomainIndex | ( | unsigned int | index | ) |
This sets a domain to the processor.
[in] | index | An integer to a Domain in the DomainHandler |
Sets an index to a Domain in the DomainHandler which belongs to the current processor.
References currentDomainIndex_.
Referenced by DPMBase::decompose().
void DomainHandler::setInteractionDistance | ( | Mdouble | interactionDistance | ) |
Sets the interaction distance of the domain handler.
Sets the interaction distance of the domainHandler.
The interaction distance is used to define how large the communication zone of the domains have to be. generally twice the size of the largest interaction radius
[in] | interactionDistance | Interaction distance between domain boundary and communication zone boundary |
References getCurrentDomain(), Domain::getDomainMax(), Domain::getDomainMin(), interactionDistance_, and logger.
Referenced by DPMBase::read(), and DPMBase::updateGhostGrid().
void DomainHandler::setNumberOfDomains | ( | std::vector< unsigned > & | numberOfDomains | ) |
Sets the number of domains in the domain handler.
The number of domains is given as a vector in the form of (nx,ny,nz) where nx,ny,nz are the number of domains in their respective direction
[in} | numberOfDomains the number of domains in Cartesian direction |
References numberOfDomains_.
Referenced by createMesh().
void DomainHandler::updateStatus | ( | std::set< BaseParticle * > & | particlesToBeDeleted | ) |
References getCurrentDomain(), and Domain::updateStatus().
Referenced by DPMBase::performGhostParticleUpdate().
void DomainHandler::updateVelocity | ( | ) |
References getCurrentDomain(), and Domain::updateVelocity().
|
private |
Index to the particular domain of this process.
Referenced by DomainHandler(), getCurrentDomain(), getCurrentDomainIndex(), initialise(), and setCurrentDomainIndex().
|
private |
look-up table to find the processor of a domain given the globalIndex of the domain
|
private |
Interaction distance between a domain boundary and the communication zone boundary.
Referenced by DomainHandler(), getInteractionDistance(), and setInteractionDistance().
|
private |
vector containing the number of domains in Cartesian direction
Referenced by getNumberOfDomains(), and setNumberOfDomains().