MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseBoundary.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 BaseBoundary_H
27 #define BaseBoundary_H
28 
29 #include "WallHandler.h"
30 #include "ParticleHandler.h"
31 #include "RNG.h"
32 
33 
35 {
36  public:
39  virtual BaseBoundary* copy() const = 0;
40  virtual ~BaseBoundary() {};
41 
42 
43  virtual int createPeriodicParticles(BaseParticle *P UNUSED, ParticleHandler &pH UNUSED){return 0;};
44 
45  virtual bool checkBoundaryAfterParticleMoved(BaseParticle *P UNUSED, ParticleHandler &pH UNUSED){return false;};
46 
47  virtual void checkBoundaryActionsBeforeTimeStep(ParticleHandler &pH UNUSED, WallHandler &wH UNUSED, RNG &random UNUSED){};
48 
49  void set_Index(int index) {_index=index;}
50  void set_Id(int id) {_id=id;}
51  void setHandler(BoundaryHandler* handler) {_handler=handler;}
52 
54  friend inline std::ostream& operator<<(std::ostream& os, const BaseBoundary &b);
55 
57  friend inline std::istream& operator>>(std::istream& is, BaseBoundary &b);
58 
60  virtual void read(std::istream& is UNUSED) = 0;
61 
63  virtual void print(std::ostream& os UNUSED) const = 0;
64 
65  virtual void moveInHandler(int newPos){_index=newPos;}
66 
67  private:
69  int _index;
70  int _id;
71 };
72 
73 inline std::ostream& operator<<(std::ostream& os, const BaseBoundary &b)
74 {
75  b.print(os);
76  return os;
77 }
78 
79 inline std::istream& operator>>(std::istream& is, BaseBoundary &b)
80 {
81  b.read(is);
82  return(is);
83 }
84 #endif
virtual void moveInHandler(int newPos)
Definition: BaseBoundary.h:65
Container to store all BaseBoundary.
void set_Index(int index)
Definition: BaseBoundary.h:49
virtual ~BaseBoundary()
Definition: BaseBoundary.h:40
friend std::ostream & operator<<(std::ostream &os, const BaseBoundary &b)
writes wall
Definition: BaseBoundary.h:73
virtual bool checkBoundaryAfterParticleMoved(BaseParticle *P UNUSED, ParticleHandler &pH UNUSED)
Definition: BaseBoundary.h:45
virtual BaseBoundary * copy() const =0
BaseBoundary copy method.
virtual void read(std::istream &is UNUSED)=0
reads boundary
This is a class that generates random numbers i.e.
Definition: RNG.h:38
void set_Id(int id)
Definition: BaseBoundary.h:50
void setHandler(BoundaryHandler *handler)
Definition: BaseBoundary.h:51
friend std::istream & operator>>(std::istream &is, BaseBoundary &b)
reads wall
Definition: BaseBoundary.h:79
virtual void print(std::ostream &os UNUSED) const =0
outputs boundary
Container to store all BaseParticle.
virtual int createPeriodicParticles(BaseParticle *P UNUSED, ParticleHandler &pH UNUSED)
Definition: BaseBoundary.h:43
Container to store all BaseWall.
Definition: WallHandler.h:36
#define UNUSED
Definition: ExtendedMath.h:38
virtual void checkBoundaryActionsBeforeTimeStep(ParticleHandler &pH UNUSED, WallHandler &wH UNUSED, RNG &random UNUSED)
Definition: BaseBoundary.h:47
std::ostream & operator<<(std::ostream &os, const BaseBoundary &b)
Definition: BaseBoundary.h:73
BoundaryHandler * _handler
Definition: BaseBoundary.h:68
std::istream & operator>>(std::istream &is, BaseBoundary &b)
Definition: BaseBoundary.h:79