MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InsertionBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, 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 BOUNDARIES_INSERTIONBOUNDARY_H
27 #define BOUNDARIES_INSERTIONBOUNDARY_H
28 
29 #include "BaseBoundary.h"
30 
31 class MD;
32 class RNG;
33 
40 {
41 public:
46 
51 
55  virtual ~InsertionBoundary();
56 
60  void set(BaseParticle* particleToCopy, unsigned int maxFailed);
61 
71  virtual BaseParticle* generateParticle(RNG &random)=0;
72 
76  virtual void checkBoundaryBeforeTimeStep(DPMBase* md);
77 
81  unsigned int getNumberOfParticlesInserted() const;
82 
86  void setMaxFailed(unsigned int maxFailed);
87 
91  unsigned int getMaxFailed() const;
92 
96  void setParticleToCopy(BaseParticle* particleToCopy);
97 
102 
106  void read(std::istream& is);
107 
111  void write(std::ostream& os) const;
112 
113 protected:
118 
122  unsigned int maxFailed_;
123 
128 };
129 
130 #endif
virtual void checkBoundaryBeforeTimeStep(DPMBase *md)
Fills the boundary with particles.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:65
InsertionBoundary()
Default constructor: set everything to 0/nullptr.
unsigned int getMaxFailed() const
Gets the number of times that the boundary may fail to insert a particle.
BaseParticle * particleToCopy_
Particle that will be inserted through the insertion boundary.
void setMaxFailed(unsigned int maxFailed)
Sets the number of times that the wall may fail to insert a particle.
unsigned int maxFailed_
Number of times that the wall may fail to insert a particle.
Boundary structure for boundaries used for insertion of particles.
void setParticleToCopy(BaseParticle *particleToCopy)
Sets the particle that will be inserted through the insertion boundary.
This is a class that generates random numbers i.e. named the Random Number Generator (RNG)...
Definition: RNG.h:52
unsigned int getNumberOfParticlesInserted() const
Gets the number of particles inserted by the boundary.
BaseParticle * getParticleToCopy() const
Gets the particle that will be inserted through the insertion boundary.
void set(BaseParticle *particleToCopy, unsigned int maxFailed)
Sets the particle that will be inserted and the maximum number of times for which insertion may fail...
virtual BaseParticle * generateParticle(RNG &random)=0
Purely virtual function that generates one particle.
virtual ~InsertionBoundary()
Destructor: delete the particle that has to be copied at every insertion.
unsigned int numberOfParticlesInserted_
Number of particles that are already inserted.
void read(std::istream &is)
Reads the boundary's id_ and maxFailed_.
void write(std::ostream &os) const
Writes the boundary's id_ and maxFailed_.