DomainHandler.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
10 #ifndef DOMAINHANDLER_H
11 #define DOMAINHANDLER_H
12 
13 #include "BaseHandler.h"
15 #include "Domain.h"
16 
25 class DomainHandler final : public BaseHandler<Domain>
26 {
27 public:
31  DomainHandler();
32 
36  DomainHandler(const DomainHandler& DH);
37 
42 
46  ~DomainHandler() final;
47 
51  void createMesh(std::vector<Mdouble>& simulationMin, std::vector<Mdouble>& simulationMax,
52  std::vector<unsigned>& numberOfDomains, bool open);
53 
57  void createDomains(std::vector<Mdouble> domainMin, std::vector<Mdouble> domainMax,
58  std::vector<unsigned>& globalMeshIndex, std::vector<unsigned>& numberOfDomains, int dimCounter,
59  std::vector<Mdouble>& meshSize, bool open);
60 
64  void addObject(Domain* D) final;
65 
69  void readAndAddObject(std::istream& is) final;
70 
74  void readOldObject(std::istream& is);
75 
79  std::string getName() const final;
80 
84  void setCurrentDomainIndex(unsigned int index);
85 
90  const Domain* getCurrentDomain() const;
91 
95  unsigned int getCurrentDomainIndex() const;
96 
100  void setNumberOfDomains(std::vector<unsigned>& numberOfdomains);
101 
105  std::vector<unsigned> getNumberOfDomains();
106 
110  void setInteractionDistance(Mdouble interactionDistance);
111 
116 
120 
122  int getParticleProcessor(int globalIndex);
123 
125  Domain* getParticleDomain(int globalIndex);
126 
127  void updateStatus(std::set<BaseParticle*>& particlesToBeDeleted);
128 
129  void updateVelocity();
130 
131  void addNewParticles();
132 
133  void initialise();
134 
135 private:
136 
140  unsigned int currentDomainIndex_;
141 
145  std::vector<int> globalIndexToProcessorList_;
146 
150  std::vector<unsigned> numberOfDomains_;
151 
156 };
157 
158 #endif
159 
dominoes D
Definition: Domino.cpp:55
Container to store the pointers to all objects that one creates in a simulation.
Definition: BaseHandler.h:30
Definition: BaseParticle.h:33
Container to store all Domain.
Definition: DomainHandler.h:26
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:134
std::string getName() const final
returns the name of the class
Definition: DomainHandler.cc:208
void setCurrentDomainIndex(unsigned int index)
This sets a domain to the processor.
Definition: DomainHandler.cc:218
DomainHandler()
Default constructor, it creates an empty DomainHandler.
Definition: DomainHandler.cc:18
Mdouble getInteractionDistance()
Gets the interaction distance of the domain handler.
Definition: DomainHandler.cc:302
int getParticleDomainGlobalIndex(BaseParticle *particle)
Definition: DomainHandler.cc:308
void updateVelocity()
Definition: DomainHandler.cc:402
void setInteractionDistance(Mdouble interactionDistance)
Sets the interaction distance of the domain handler.
Definition: DomainHandler.cc:277
unsigned int currentDomainIndex_
Index to the particular domain of this process.
Definition: DomainHandler.h:140
void initialise()
Definition: DomainHandler.cc:412
unsigned int getCurrentDomainIndex() const
Gets the domain index assigned to the processor.
Definition: DomainHandler.cc:243
void addNewParticles()
Definition: DomainHandler.cc:407
void addObject(Domain *D) final
Adds a Domain to the DomainHandler.
Definition: DomainHandler.cc:181
void readOldObject(std::istream &is)
reads an old domain object
Definition: DomainHandler.cc:201
std::vector< unsigned > getNumberOfDomains()
Gets the number of domains in the domain handler.
Definition: DomainHandler.cc:265
Domain * getParticleDomain(int globalIndex)
Definition: DomainHandler.cc:392
void readAndAddObject(std::istream &is) final
reads a domain object
Definition: DomainHandler.cc:193
std::vector< unsigned > numberOfDomains_
vector containing the number of domains in Cartesian direction
Definition: DomainHandler.h:150
Mdouble interactionDistance_
Interaction distance between a domain boundary and the communication zone boundary.
Definition: DomainHandler.h:155
Domain * getCurrentDomain()
Gets the domain assigned to the processor.
Definition: DomainHandler.cc:228
std::vector< int > globalIndexToProcessorList_
look-up table to find the processor of a domain given the globalIndex of the domain
Definition: DomainHandler.h:145
~DomainHandler() final
Destructor, it destructs the DomainHandler and all Domain it contains.
Definition: DomainHandler.cc:56
void updateStatus(std::set< BaseParticle * > &particlesToBeDeleted)
Definition: DomainHandler.cc:397
DomainHandler & operator=(const DomainHandler &rhs)
Assignment operator.
Definition: DomainHandler.cc:42
void setNumberOfDomains(std::vector< unsigned > &numberOfdomains)
Sets the number of domains in the domain handler.
Definition: DomainHandler.cc:254
int getParticleProcessor(int globalIndex)
Definition: DomainHandler.cc:387
void createMesh(std::vector< Mdouble > &simulationMin, std::vector< Mdouble > &simulationMax, std::vector< unsigned > &numberOfDomains, bool open)
Creates a Cartesian square mesh in 3D.
Definition: DomainHandler.cc:71
The simulation can be subdivided into Domain's used in parallel code.
Definition: Domain.h:42
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286