DomainHandler Class Referencefinal

Container to store all Domain. More...

#include <DomainHandler.h>

+ Inheritance diagram for DomainHandler:

Public Member Functions

 DomainHandler ()
 Default constructor, it creates an empty DomainHandler. More...
 
 DomainHandler (const DomainHandler &DH)
 Constructor that copies all Domain it contains. More...
 
DomainHandleroperator= (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...
 
DomaingetCurrentDomain ()
 Gets the domain assigned to the processor. More...
 
const DomaingetCurrentDomain () 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)
 
DomaingetParticleDomain (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...
 
DomaingetObjectById (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...
 
DomaingetObject (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler.
More...
 
const DomaingetObject (const unsigned int id) const
 Gets a constant pointer to the Object at the specified index in the BaseHandler. More...
 
DomaingetLastObject ()
 Gets a pointer to the last Object in this BaseHandler. More...
 
const DomaingetLastObject () 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)
 
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 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...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ DomainHandler() [1/2]

DomainHandler::DomainHandler ( )

Default constructor, it creates an empty DomainHandler.

Constructor of the DomainHandler class. It creates and empty DomainHandler.

41 {
44  logger(DEBUG, "DomainHandler::DomainHandler() finished");
45 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ DEBUG
unsigned int currentDomainIndex_
Index to the particular domain of this process.
Definition: DomainHandler.h:161
Mdouble interactionDistance_
Interaction distance between a domain boundary and the communication zone boundary.
Definition: DomainHandler.h:176

References currentDomainIndex_, DEBUG, interactionDistance_, and logger.

◆ DomainHandler() [2/2]

DomainHandler::DomainHandler ( const DomainHandler DH)

Constructor that copies all Domain it contains.

Parameters
[in]DHThe 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.

54 {
56  logger(DEBUG, "DomainHandler::DomainHandler(const DomainHandler &DH) finished");
57 }
void copyContentsFromOtherHandler(const BaseHandler< Domain > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
Definition: BaseHandler.h:367

References BaseHandler< Domain >::copyContentsFromOtherHandler(), DEBUG, and logger.

◆ ~DomainHandler()

DomainHandler::~DomainHandler ( )
final

Destructor, it destructs the DomainHandler and all Domain it contains.

All Domain are destroyed, the DomainHandler afterwards.

79 {
80  logger(DEBUG, "DomainHandler::~DomainHandler() finished");
81 }

References DEBUG, and logger.

Member Function Documentation

◆ addNewParticles()

void DomainHandler::addNewParticles ( )
430 {
432 }
Domain * getCurrentDomain()
Gets the domain assigned to the processor.
Definition: DomainHandler.cc:250
void addNewParticles()
Initialises the MPIParticles by communicating newly found particles.
Definition: Domain.cc:1588

References Domain::addNewParticles(), and getCurrentDomain().

Referenced by DPMBase::initialiseSolve(), DPMBase::performGhostParticleUpdate(), DPMBase::read(), and DPMBase::updateGhostGrid().

◆ addObject()

void DomainHandler::addObject ( Domain D)
final

Adds a Domain to the DomainHandler.

Parameters
[in]DA 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.

204 {
205  //Puts the particle in the Particle list
207  //set the particleHandler pointer
208  D->setHandler(this);
209 }
dominoes D
Definition: Domino.cpp:76
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:431

References BaseHandler< T >::addObject(), and D.

◆ createDomains()

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.

Parameters
[in,out]domainMinThe minimum simulation values in Cartesian direction as input and the minimum domain values as output/input
[in]domainMaxThe maximum simulation values in Cartesian direction as input and the maximum domain values as output/intput
[in]globalMeshIndexA Vector containing the mesh indices, i.e. (i,j,k) = (3,5,2)
[in]numberOfDomainsA vector containg the number of domoains in Cartesian direction
[in]dimCounterThe dimension counter that keeps track in whicn direction the rescursive function is working
[in]opendetermines if a domain boundary is open (inf) or closed
159 {
160  //
161  if (dimCounter == 0)
162  {
163  //Create a new domain
164  Domain domain(globalMeshIndex);
165  domain.setHandler(this);
166  const std::vector<double>& domainBoundMin = domainMin;
167  const std::vector<double>& domainBoundMax = domainMax;
168  domain.setBounds(domainBoundMin, domainBoundMax, true);
169  this->copyAndAddObject(domain);
170  }
171  else
172  {
173  dimCounter--;
174  //Compute size of a domain in the dimCounter'th direction.
175  Mdouble boundLeft = domainMin[dimCounter];
176  //Starting with the bound left, create the number of domains in the given dimCounter-direction
177  for (int i = 0; i < numberOfDomains[dimCounter]; i++)
178  {
179  globalMeshIndex[dimCounter] = i;
180  domainMin[dimCounter] = boundLeft + i * meshSize[dimCounter];
181  domainMax[dimCounter] = boundLeft + (i + 1) * meshSize[dimCounter];
182  if ((i == 0) && (open))
183  {
184  domainMin[dimCounter] = -constants::inf;
185  }
186 
187  if ((i == numberOfDomains[dimCounter] - 1) && (open))
188  {
189  domainMax[dimCounter] = constants::inf;
190  }
191 
192  //Start recursively a new createDomains function
193  createDomains(domainMin, domainMax, globalMeshIndex, numberOfDomains, dimCounter, meshSize, open);
194  }
195  }
196 }
double Mdouble
Definition: GeneralDefine.h:34
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.
Definition: BaseHandler.h:379
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.
Definition: DomainHandler.cc:156
The simulation can be subdivided into Domain's used in parallel code.
Definition: Domain.h:64
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
const Mdouble inf
Definition: GeneralDefine.h:44

References BaseHandler< Domain >::copyAndAddObject(), constants::i, constants::inf, Domain::setBounds(), and Domain::setHandler().

Referenced by createMesh().

◆ 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.

Parameters
[in]simulationMinThe minimum values of the simulation domain in cartesian coordinates
[in]simulationMaxThe maximum values of the simulation domain in cartesian coordinates
[in]numberOfDomainsThe number of domains in cartesian direction
[in]openDetermines if the boundary domains have infinite limits (true) or not (false)
95 {
96  //Clear the objects in the list, we're gonna make a new mesh, owyeah
97  objects_.clear();
98 
99  //Create the mesh
100  setNumberOfDomains(numberOfDomains);
101 
102  std::vector<unsigned> globalMeshIndex(3);
103  //Recursive function creating the domains
104  int dimCounter = 3;
105  //Compute the mesh size in each direction
106  std::vector<Mdouble> meshSize;
107  for (int d = 0; d < 3; d++)
108  {
109  meshSize.push_back((simulationMax[d] - simulationMin[d]) / numberOfDomains[d]);
110  }
111  //Create the domains
112  createDomains(simulationMin, simulationMax, globalMeshIndex, numberOfDomains, dimCounter, meshSize, open);
113 
114  //Create lookup tables
115  for (Domain* domain : objects_)
116  {
117  domain->setRank(domain->getGlobalIndex());
118  domain->createLookUpTable();
119  }
120 
121  //Disable boundaries that dont require communication
122  for (Domain* domain : objects_)
123  {
124  domain->disableBoundaries();
125  }
126 
127  //Output the result
128  std::string meshType;
129  if (open)
130  {
131  meshType = "open";
132  }
133  else
134  {
135  meshType = "closed";
136  }
137  if (PROCESSOR_ID == 0)
138  {
139  logger(INFO, "A simulation mesh has been created with % number of domains and % boundaries.", this->getSize(),
140  meshType);
141  }
142 }
#define PROCESSOR_ID
Definition: GeneralDefine.h:63
@ INFO
std::vector< Domain * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:302
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
void setNumberOfDomains(std::vector< unsigned > &numberOfdomains)
Sets the number of domains in the domain handler.
Definition: DomainHandler.cc:276

References createDomains(), BaseHandler< Domain >::getSize(), INFO, logger, BaseHandler< Domain >::objects_, PROCESSOR_ID, and setNumberOfDomains().

Referenced by DPMBase::decompose().

◆ getCurrentDomain() [1/2]

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

Returns
Pointer to a Domain on which the processor has to do computations
251 {
253 }
Domain * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613

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().

◆ getCurrentDomain() [2/2]

const Domain * DomainHandler::getCurrentDomain ( ) const

◆ getCurrentDomainIndex()

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

Returns
Index of a Domain on which the processor has to do computations
266 {
267  return currentDomainIndex_;
268 }

References currentDomainIndex_.

◆ getInteractionDistance()

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

Returns
Returns the interaction distance of the communication zone
325 {
326  return interactionDistance_;
327 }

References interactionDistance_.

Referenced by Domain::findNearbyBoundaries(), Domain::isInGreaterDomain(), Domain::isInInnerDomain(), and DPMBase::updateGhostGrid().

◆ getName()

std::string DomainHandler::getName ( ) const
finalvirtual

returns the name of the class

Todo:
Still has to be implemented

Implements BaseHandler< Domain >.

231 {
232  return "DomainHandler";
233 }

◆ getNumberOfDomains()

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

Returns
The number of domains in Cartesian direction
288 {
289  return numberOfDomains_;
290 }
std::vector< unsigned > numberOfDomains_
vector containing the number of domains in Cartesian direction
Definition: DomainHandler.h:171

References numberOfDomains_.

Referenced by Domain::createLookUpTable(), Domain::disableBoundaries(), and getParticleDomainGlobalIndex().

◆ getParticleDomain()

Domain * DomainHandler::getParticleDomain ( int  globalIndex)
Todo:
TW@Marnix should this be unsigned int?
415 {
416  return getObject(globalIndex);
417 }

References BaseHandler< Domain >::getObject().

◆ getParticleDomainGlobalIndex()

int DomainHandler::getParticleDomainGlobalIndex ( BaseParticle particle)
Todo:

MX: function under construction

TW@Marnix should this be unsigned int?

Todo:
MX: This function is still under development the goal of this function is to obtain the globalIndex of the domain the particle is located in
331 {
332  //Step 1: obtain values i,j,k by looking at the position
333  //TODO this could possibly be stored in the domainHandler to save computational power
334  std::vector<int> decompositionVector(3);
335 
336  int i, j, k;
340 
341  //x-direction
342  if ((particle->getPosition().X - getDPMBase()->getXMin()) <= 0)
343  {
344  i = 0;
345  }
346  else
347  {
348  //Compute the relative domain cell it is in
349  i = floor((particle->getPosition().X - getDPMBase()->getXMin()) / dx);
350 
351  //Make sure we dont go over our number of domain bounds
352  if (i >= getDPMBase()->getNumberOfDomains()[0] - 1)
353  {
354  i = getDPMBase()->getNumberOfDomains()[0] - 1;
355  }
356  if (i < 0)
357  {
358  i = 0;
359  }
360  }
361 
362  //y-direction
363  if ((particle->getPosition().Y - getDPMBase()->getYMin()) <= 0)
364  {
365  j = 0;
366  }
367  else
368  {
369  j = floor((particle->getPosition().Y - getDPMBase()->getYMin()) / dy);
370 
371  //Make sure we dont go over our number of domain bounds
372  if (j >= getDPMBase()->getNumberOfDomains()[1] - 1)
373  {
374  j = getDPMBase()->getNumberOfDomains()[1] - 1;
375  }
376  if (i < 0)
377  {
378  j = 0;
379  }
380  }
381 
382  //z-direction
383  if ((particle->getPosition().Z - getDPMBase()->getZMin()) <= 0)
384  {
385  k = 0;
386  }
387  else
388  {
389  k = floor((particle->getPosition().Z - getDPMBase()->getZMin()) / dz);
390  //Make sure we dont go over our number of domain bounds
391  if (k >= getDPMBase()->getNumberOfDomains()[2] - 1)
392  {
393  k = getDPMBase()->getNumberOfDomains()[2] - 1;
394  }
395  if (k < 0)
396  {
397  k = 0;
398  }
399 
400  }
401 
402  //Step 2: obtain the processor number
403  int globalIndex = i +
404  getDPMBase()->getNumberOfDomains()[0] * j +
406  return globalIndex;
407 }
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:619
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:626
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.
Definition: DPMBase.h:632
std::vector< unsigned > getNumberOfDomains()
returns the number of domains
Definition: DPMBase.cc:5280
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:638
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:650
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:644
std::vector< unsigned > getNumberOfDomains()
Gets the number of domains in the domain handler.
Definition: DomainHandler.cc:287
Mdouble Y
Definition: Vector.h:66
Mdouble Z
Definition: Vector.h:66
Mdouble X
the vector components
Definition: Vector.h:66

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().

◆ getParticleProcessor()

int DomainHandler::getParticleProcessor ( int  globalIndex)
Todo:
TW@Marnix should this be unsigned int?
410 {
411  return globalIndex;//ToProcessorList_[globalIndex];
412 }

Referenced by SubcriticalMaserBoundaryTEST::copyExtraParticles(), SubcriticalMaserBoundaryTEST::extendBottom(), and PeriodicBoundaryHandler::findTargetProcessor().

◆ initialise()

void DomainHandler::initialise ( )
435 {
436  //Create a single domain
437  Domain domain;
438  domain.setHandler(this);
439  std::vector<double> domainBoundMin = {-constants::inf, -constants::inf, -constants::inf};
440  std::vector<double> domainBoundMax = {constants::inf, constants::inf, constants::inf};
441  domain.setBounds(domainBoundMin, domainBoundMax, false);
442  this->copyAndAddObject(domain);
444 }
void setBounds(std::vector< double > domainLeft, std::vector< double > domainRight, bool computeMiddle)
Sets the domain bounds.
Definition: Domain.cc:268
void setHandler(DomainHandler *handler)
Sets the domainHandler.
Definition: Domain.cc:337

References BaseHandler< Domain >::copyAndAddObject(), currentDomainIndex_, constants::inf, Domain::setBounds(), and Domain::setHandler().

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

◆ operator=()

DomainHandler & DomainHandler::operator= ( const DomainHandler rhs)

Assignment operator.

Parameters
[in]rhsThe 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.

65 {
66  if (this != &rhs)
67  {
68  clear();
70  }
71  logger(DEBUG, "DomainHandler DomainHandler::operator =(const DomainHandler& rhs)");
72  return *this;
73 }
virtual void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.
Definition: BaseHandler.h:528

References BaseHandler< Domain >::clear(), BaseHandler< Domain >::copyContentsFromOtherHandler(), DEBUG, and logger.

◆ readAndAddObject()

void DomainHandler::readAndAddObject ( std::istream &  is)
finalvirtual

reads a domain object

Todo:
Still has to be implemented

There is no need to read domain object, they can be computed easily

Implements BaseHandler< Domain >.

216 {
217 }

◆ readOldObject()

void DomainHandler::readOldObject ( std::istream &  is)

reads an old domain object

Todo:
Still has to be implemented

There is no need to read a domain object, they can be computed easily

224 {
225 }

◆ setCurrentDomainIndex()

void DomainHandler::setCurrentDomainIndex ( unsigned int  index)

This sets a domain to the processor.

Parameters
[in]indexAn integer to a Domain in the DomainHandler

Sets an index to a Domain in the DomainHandler which belongs to the current processor.

241 {
242  currentDomainIndex_ = index;
243 }

References currentDomainIndex_.

Referenced by DPMBase::decompose().

◆ setInteractionDistance()

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

Parameters
[in]interactionDistanceInteraction distance between domain boundary and communication zone boundary
300 {
301  //Update the interaction distance
302  interactionDistance_ = interactionDistance;
303 
304  //Check if the domainsize is not too small
305  Domain* domain = getCurrentDomain();
306  logger.assert_always((domain->getDomainMax()[0] - domain->getDomainMin()[0]) > 2 * interactionDistance_,
307  "Size of the domain in x-direction is smaller than communication zone. Size: %, communication zone: %",
308  (domain->getDomainMax()[0] - domain->getDomainMin()[0]), 2 * interactionDistance_);
309  logger.assert_always((domain->getDomainMax()[1] - domain->getDomainMin()[1]) > 2 * interactionDistance_,
310  "Size of the domain in y-direction is smaller than communication zone. Size: %, communication zone: %",
311  (domain->getDomainMax()[1] - domain->getDomainMin()[1]), 2 * interactionDistance);
312  logger.assert_always((domain->getDomainMax()[2] - domain->getDomainMin()[2]) > 2 * interactionDistance_,
313  "Size of the domain in z-direction is smaller than communication zone. Size: %, communication zone: %",
314  (domain->getDomainMax()[2] - domain->getDomainMin()[2]), 2 * interactionDistance_);
315 }
std::vector< double > getDomainMax()
Gets the maximum domain bounds.
Definition: Domain.cc:319
std::vector< double > getDomainMin()
Gets the minimum domain bounds.
Definition: Domain.cc:310

References getCurrentDomain(), Domain::getDomainMax(), Domain::getDomainMin(), interactionDistance_, and logger.

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

◆ setNumberOfDomains()

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

Parameters
[in}numberOfDomains the number of domains in Cartesian direction
277 {
278  numberOfDomains_ = numberOfDomains;
279 }

References numberOfDomains_.

Referenced by createMesh().

◆ updateStatus()

void DomainHandler::updateStatus ( std::set< BaseParticle * > &  particlesToBeDeleted)
420 {
421  getCurrentDomain()->updateStatus(particlesToBeDeleted);
422 }
void updateStatus(std::set< BaseParticle * > &ghostParticlesToBeDeleted)
Updates particles that are not in the current domain and communicates newly added particles.
Definition: Domain.cc:1633

References getCurrentDomain(), and Domain::updateStatus().

Referenced by DPMBase::performGhostParticleUpdate().

◆ updateVelocity()

void DomainHandler::updateVelocity ( )
425 {
427 }
void updateVelocity()
Updates MPI particle velocity at the half-time step.
Definition: Domain.cc:1648

References getCurrentDomain(), and Domain::updateVelocity().

Member Data Documentation

◆ currentDomainIndex_

unsigned int DomainHandler::currentDomainIndex_
private

Index to the particular domain of this process.

Referenced by DomainHandler(), getCurrentDomain(), getCurrentDomainIndex(), initialise(), and setCurrentDomainIndex().

◆ globalIndexToProcessorList_

std::vector<int> DomainHandler::globalIndexToProcessorList_
private

look-up table to find the processor of a domain given the globalIndex of the domain

◆ interactionDistance_

Mdouble DomainHandler::interactionDistance_
private

Interaction distance between a domain boundary and the communication zone boundary.

Referenced by DomainHandler(), getInteractionDistance(), and setInteractionDistance().

◆ numberOfDomains_

std::vector<unsigned> DomainHandler::numberOfDomains_
private

vector containing the number of domains in Cartesian direction

Referenced by getNumberOfDomains(), and setNumberOfDomains().


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