MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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< unsignedgetNumberOfDomains ()
 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 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)
 This function sets the id and ensures that nextId is a bigger value than id. More...
 
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< unsignednumberOfDomains_
 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

Definition at line 46 of file DomainHandler.h.

Constructor & Destructor Documentation

DomainHandler::DomainHandler ( )

Default constructor, it creates an empty DomainHandler.

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

Definition at line 40 of file DomainHandler.cc.

References currentDomainIndex_, DEBUG, interactionDistance_, and logger.

41 {
44  logger(DEBUG, "DomainHandler::DomainHandler() finished");
45 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
unsigned int currentDomainIndex_
Index to the particular domain of this process.
Mdouble interactionDistance_
Interaction distance between a domain boundary and the communication zone boundary.
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.

Definition at line 52 of file DomainHandler.cc.

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

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

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

All Domain are destroyed, the DomainHandler afterwards.

Definition at line 78 of file DomainHandler.cc.

References DEBUG, and logger.

79 {
80  logger(DEBUG, "DomainHandler::~DomainHandler() finished");
81 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")

Member Function Documentation

void DomainHandler::addNewParticles ( )

Definition at line 429 of file DomainHandler.cc.

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

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

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

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.

Reimplemented from BaseHandler< Domain >.

Definition at line 203 of file DomainHandler.cc.

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

204 {
205  //Puts the particle in the Particle list
207  //set the particleHandler pointer
208  D->setHandler(this);
209 }
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:431
void setHandler(DomainHandler *handler)
Sets the domainHandler.
Definition: Domain.cc:337
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

Definition at line 156 of file DomainHandler.cc.

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

Referenced by createMesh().

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
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
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.
const Mdouble inf
Definition: GeneralDefine.h:44
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.
The simulation can be subdivided into Domain's used in parallel code.
Definition: Domain.h:63
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)

Definition at line 93 of file DomainHandler.cc.

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

Referenced by DPMBase::decompose().

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 }
void setNumberOfDomains(std::vector< unsigned > &numberOfdomains)
Sets the number of domains in the domain handler.
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
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.
#define PROCESSOR_ID
Definition: GeneralDefine.h:63
std::vector< Domain * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:302
The simulation can be subdivided into Domain's used in parallel code.
Definition: Domain.h:63
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

Definition at line 250 of file DomainHandler.cc.

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(), setInteractionDistance(), DPMBase::updateGhostGrid(), updateStatus(), and updateVelocity().

251 {
253 }
unsigned int currentDomainIndex_
Index to the particular domain of this process.
Domain * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
const Domain * DomainHandler::getCurrentDomain ( ) const

Definition at line 255 of file DomainHandler.cc.

References currentDomainIndex_, and BaseHandler< Domain >::getObject().

256 {
258 }
unsigned int currentDomainIndex_
Index to the particular domain of this process.
Domain * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
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

Definition at line 265 of file DomainHandler.cc.

References currentDomainIndex_.

266 {
267  return currentDomainIndex_;
268 }
unsigned int currentDomainIndex_
Index to the particular domain of this process.
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

Definition at line 324 of file DomainHandler.cc.

References interactionDistance_.

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

325 {
326  return interactionDistance_;
327 }
Mdouble interactionDistance_
Interaction distance between a domain boundary and the communication zone boundary.
std::string DomainHandler::getName ( ) const
finalvirtual

returns the name of the class

Todo:
Still has to be implemented

Implements BaseHandler< Domain >.

Definition at line 230 of file DomainHandler.cc.

231 {
232  return "DomainHandler";
233 }
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

Definition at line 287 of file DomainHandler.cc.

References numberOfDomains_.

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

288 {
289  return numberOfDomains_;
290 }
std::vector< unsigned > numberOfDomains_
vector containing the number of domains in Cartesian direction
Domain * DomainHandler::getParticleDomain ( int  globalIndex)
Todo:
TW should this be unsigned int?

Definition at line 414 of file DomainHandler.cc.

References BaseHandler< Domain >::getObject().

415 {
416  return getObject(globalIndex);
417 }
Domain * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
int DomainHandler::getParticleDomainGlobalIndex ( BaseParticle particle)
Todo:

MX: function under construction

TW 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

Definition at line 330 of file DomainHandler.cc.

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

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 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble X
the vector components
Definition: Vector.h:65
double Mdouble
Definition: GeneralDefine.h:34
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.h:617
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.h:586
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.h:599
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.h:593
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.h:605
Mdouble Y
Definition: Vector.h:65
std::vector< unsigned > getNumberOfDomains()
returns the number of domains
Definition: DPMBase.cc:5025
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.h:611
std::vector< unsigned > getNumberOfDomains()
Gets the number of domains in the domain handler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Mdouble Z
Definition: Vector.h:65
int DomainHandler::getParticleProcessor ( int  globalIndex)
Todo:
TW should this be unsigned int?

Definition at line 409 of file DomainHandler.cc.

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

410 {
411  return globalIndex;//ToProcessorList_[globalIndex];
412 }
void DomainHandler::initialise ( )

Definition at line 434 of file DomainHandler.cc.

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

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

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
unsigned int currentDomainIndex_
Index to the particular domain of this process.
const Mdouble inf
Definition: GeneralDefine.h:44
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.
The simulation can be subdivided into Domain's used in parallel code.
Definition: Domain.h:63
void setHandler(DomainHandler *handler)
Sets the domainHandler.
Definition: Domain.cc:337
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.

Definition at line 64 of file DomainHandler.cc.

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

65 {
66  if (this != &rhs)
67  {
68  clear();
70  }
71  logger(DEBUG, "DomainHandler DomainHandler::operator =(const DomainHandler& rhs)");
72  return *this;
73 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void copyContentsFromOtherHandler(const BaseHandler< Domain > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
virtual void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
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 >.

Definition at line 215 of file DomainHandler.cc.

216 {
217 }
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

Definition at line 223 of file DomainHandler.cc.

224 {
225 }
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.

Definition at line 240 of file DomainHandler.cc.

References currentDomainIndex_.

241 {
242  currentDomainIndex_ = index;
243 }
unsigned int currentDomainIndex_
Index to the particular domain of this process.
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

Definition at line 299 of file DomainHandler.cc.

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

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

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 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
std::vector< double > getDomainMin()
Gets the minimum domain bounds.
Definition: Domain.cc:310
std::vector< double > getDomainMax()
Gets the maximum domain bounds.
Definition: Domain.cc:319
The simulation can be subdivided into Domain's used in parallel code.
Definition: Domain.h:63
Domain * getCurrentDomain()
Gets the domain assigned to the processor.
Mdouble interactionDistance_
Interaction distance between a domain boundary and the communication zone boundary.
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

Definition at line 276 of file DomainHandler.cc.

References numberOfDomains_.

Referenced by createMesh().

277 {
278  numberOfDomains_ = numberOfDomains;
279 }
std::vector< unsigned > numberOfDomains_
vector containing the number of domains in Cartesian direction
void DomainHandler::updateStatus ( std::set< BaseParticle * > &  particlesToBeDeleted)

Definition at line 419 of file DomainHandler.cc.

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

Referenced by DPMBase::performGhostParticleUpdate().

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:1604
Domain * getCurrentDomain()
Gets the domain assigned to the processor.
void DomainHandler::updateVelocity ( )

Definition at line 424 of file DomainHandler.cc.

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

425 {
427 }
Domain * getCurrentDomain()
Gets the domain assigned to the processor.
void updateVelocity()
Updates MPI particle velocity at the half-time step.
Definition: Domain.cc:1619

Member Data Documentation

unsigned int DomainHandler::currentDomainIndex_
private

Index to the particular domain of this process.

Definition at line 161 of file DomainHandler.h.

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

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

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

Definition at line 166 of file DomainHandler.h.

Mdouble DomainHandler::interactionDistance_
private

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

Definition at line 176 of file DomainHandler.h.

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

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

vector containing the number of domains in Cartesian direction

Definition at line 171 of file DomainHandler.h.

Referenced by getNumberOfDomains(), and setNumberOfDomains().


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