BaseBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef BaseBoundary_H
27 #define BaseBoundary_H
28 
29 #include <set>
30 #include "BaseObject.h"
31 #include "Math/ExtendedMath.h"
32 
33 class BoundaryHandler;
34 
36 
37 class ParticleHandler;
38 
39 class BaseParticle;
40 
41 class DPMBase;
42 
48 class BaseBoundary : public BaseObject
49 {
50 public:
54  BaseBoundary();
55 
59  BaseBoundary(const BaseBoundary& b);
60 
64  ~BaseBoundary() override;
65 
70  virtual BaseBoundary* copy() const = 0;
71 
76  void read(std::istream& is) override = 0;
77 
82  void write(std::ostream& os) const override = 0;
83 
84 
89 
94 
99 
103  virtual void checkBoundaryBeforeTimeStep(DPMBase* md);
104 
108  virtual void actionsBeforeTimeLoop();
109 
110  virtual void modifyGhostAfterCreation(BaseParticle* particle, int i);
111 
112  virtual void writeVTK(std::fstream& file) {}
113 
117  void setHandler(BoundaryHandler* handler);
118 
122  BoundaryHandler* getHandler() const;
123 
124 #ifdef MERCURYDPM_USE_MPI
131  std::set<BaseParticle*>& getParticlesToBeDeleted();
132 #endif
133 
134 protected:
135 #ifdef MERCURYDPM_USE_MPI
143  std::set<BaseParticle*> particlesToBeDeleted_;
144 
145 #endif
146 
147 private:
148 
153 
154 };
155 
156 #endif
#define UNUSED
Definition: GeneralDefine.h:39
Definition: BaseBoundary.h:49
virtual void createPeriodicParticle(BaseParticle *p UNUSED, ParticleHandler &pH UNUSED)
Creates a periodic particle in case of periodic boundaries in serial build.
Definition: BaseBoundary.cc:81
void read(std::istream &is) override=0
Reads the object's id_ from given istream NB: purely virtual function, overriding the version of Base...
Definition: BaseBoundary.cc:61
virtual void createPeriodicParticles(ParticleHandler &pH UNUSED)
Creates periodic copies of given particle in case of periodic boundaries.
Definition: BaseBoundary.cc:91
void write(std::ostream &os) const override=0
Adds object's id_ to given ostream NB: purely virtual function, overriding the version of BaseObject.
Definition: BaseBoundary.cc:70
~BaseBoundary() override
destructor
Definition: BaseBoundary.cc:52
virtual BaseBoundary * copy() const =0
Used to create a copy of the object NB: purely virtual function.
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
Definition: BaseBoundary.cc:143
BoundaryHandler * handler_
pointer to the boundary's BoundaryHandler
Definition: BaseBoundary.h:152
virtual void checkBoundaryAfterParticlesMove(ParticleHandler &pH)
Virtual function that does things to particles, each time step after particles have moved.
Definition: BaseBoundary.cc:113
virtual void checkBoundaryBeforeTimeStep(DPMBase *md)
Virtual function that does things before each time step.
Definition: BaseBoundary.cc:101
virtual void actionsBeforeTimeLoop()
Virtual function that does something after DPMBase::setupInitialConditions but before the first time ...
Definition: BaseBoundary.cc:125
void setHandler(BoundaryHandler *handler)
Sets the boundary's BoundaryHandler.
Definition: BaseBoundary.cc:134
virtual void modifyGhostAfterCreation(BaseParticle *particle, int i)
Definition: BaseBoundary.cc:117
BaseBoundary()
default constructor.
Definition: BaseBoundary.cc:32
virtual void writeVTK(std::fstream &file)
Definition: BaseBoundary.h:112
It is an abstract base class due to the purely virtual functions declared below. Even if the function...
Definition: BaseObject.h:51
Definition: BaseParticle.h:54
Container to store pointers to all BaseBoundary objects.
Definition: BoundaryHandler.h:39
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
Container to store pointers to all BasePeriodicBoundary objects.
Definition: PeriodicBoundaryHandler.h:46
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51