MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DPMBase.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 MD_H
27 #define MD_H
28 
29 #include <string>
30 #include <string.h>
31 #include <iomanip>
32 #include <cstdlib> //needed to be cygwin compatible (system not found)
33 //This is the class that defines the std_save routines
34 #include "FilesAndRunNumber.h"
35 //The vector class contains a 3D vector class.
36 #include "Math/Vector.h"
37 //This class defines the particle handler
38 #include "ParticleHandler.h"
39 //This class defines the base particle (such that not every Driver has to include it)
40 #include "Particles/BaseParticle.h"
41 //This class defines the wall handler
42 #include "WallHandler.h"
43 //This class defines the boundary handler
44 #include "BoundaryHandler.h"
45 //This class defines the interaction handler
46 #include "InteractionHandler.h"
47 //This class defines the Species handler
48 #include "SpeciesHandler.h"
49 //#include "Species/Species.h"
50 //This class defines the posibleContact lists
51 #ifdef CONTACT_LIST_HGRID
52  #include "PossibleContactList.h"
53 #endif
54 //This class defines the random number generator
55 #include "Math/RNG.h"
56 
65 class DPMBase : public FilesAndRunNumber
66 {
67 public:
73  void constructor();
74 
78  DPMBase();
79 
83  DPMBase(const FilesAndRunNumber& other);
84 
88  DPMBase(const DPMBase& other);
89 
93  virtual ~DPMBase();
94 
98  void solve();
99 
107  void checkSettings();
108 
112  virtual void writeOutputFiles();
113 
117  void solve(int argc, char* argv[]);
118 
129  virtual void setupInitialConditions();
130 
135  virtual void writeXBallsScript() const;
136 
141  virtual double getInfo(const BaseParticle& P) const;
142 
147  virtual void writeRestartFile();
148 
154  bool readRestartFile(bool restarted = true);
155 
160  int readRestartFile(std::string fileName);
161 
162 // /*!
163 // * \brief Loads all MD data and plots statistics for all timesteps in the .data file
164 // */
165 // void statisticsFromRestartData(const char *name);
167 
171  virtual void write(std::ostream& os, bool writeAllParticles=true) const;
172 
177  virtual void read(std::istream& is);
178 
179  virtual bool readUserDefinedWall(std::string type, std::istream& is) { return false;}
180 
184  virtual void readOld(std::istream &is);
185 
197  bool readDataFile(const std::string fileName, unsigned int format = 0);
198 
202  bool readParAndIniFiles(const std::string fileName);
203 
209  bool readNextDataFile(unsigned int format = 0);
210 
214  bool findNextExistingDataFile(Mdouble tMin, bool verbose = true);
215 
219  friend inline std::ostream& operator<<(std::ostream& os, const DPMBase &md);
220 
225  bool readArguments(int argc, char *argv[]);
226 
230  virtual bool readNextArgument(int& i, int argc, char *argv[]);
231 
235  virtual bool checkParticleForInteraction(const BaseParticle& P);
236 
240  virtual bool checkParticleForInteractionLocal(const BaseParticle& P);
242 
243  //getters and setters
244 
248  Mdouble getTime() const;
249 
253  unsigned int getNtimeSteps() const;
254 
258  void setTime(Mdouble time);
259 
263  void setTimeMax(Mdouble newTMax);
264 
269  Mdouble getTimeMax() const;
270 
271  #ifdef CONTACT_LIST_HGRID
272 
275  PossibleContactList& getPossibleContactList();
276  #endif
277 
282  void setDoCGAlways(bool newDoCGFlag);
283 
292  void setRotation(bool newRotFlag);
293 
297  bool getRotation() const;
298 
303  void setWallsWriteVTK(FileType writeWallsVTK);
304 
309  void setParticlesWriteVTK(bool writeParticlesVTK);
310 
314  FileType getWallsWriteVTK() const;
315 
319  bool getParticlesWriteVTK() const;
320 
325  bool getDoCGAlways() const;
326 
330  Vec3D getMin() const {return Vec3D(xMin_,yMin_,zMin_);}
331 
335  Vec3D getMax() const {return Vec3D(xMax_,yMax_,zMax_);}
336 
341  Mdouble getXMin() const;
342 
347  Mdouble getXMax() const;
348 
353  Mdouble getYMin() const;
354 
359  Mdouble getYMax() const;
360 
365  Mdouble getZMin() const;
366 
371  Mdouble getZMax() const;
372 
376  void setMin(Vec3D min);
377 
381  void setMax(Vec3D max);
382 
387  void setXMin(Mdouble newXMin);
388 
393  void setYMin(Mdouble newYMin);
394 
399  void setZMin(Mdouble newZMin);
400 
405  void setXMax(Mdouble newXMax);
406 
411  void setYMax(Mdouble newYMax);
412 
417  void setZMax(Mdouble newZMax);
418 
423  int getAddLarge() const;
424 
429  int getAddSmall() const;
430 
435  void setAddLarge(int new_addL);
436 
441  void setAddSmall(int new_addS);
442 
446  void setTimeStep(Mdouble newDt);
447 
451  Mdouble getTimeStep() const;
452 
456  void setXBallsColourMode(int newCMode);
457 
461  int getXBallsColourMode() const;
462 
466  void setXBallsVectorScale(double newVScale);
467 
471  double getXBallsVectorScale() const;
472 
476  void setXBallsAdditionalArguments(std::string newXBArgs);
477 
481  std::string getXBallsAdditionalArguments() const;
482 
487  void setXBallsScale(Mdouble newScale);
488 
492  double getXBallsScale() const;
493 
497  void setGravity(Vec3D newGravity);
498 
502  Vec3D getGravity() const;
503 
507  void setDimension(unsigned int newDim);
508 
512  void setSystemDimensions(unsigned int newDim);
513 
518  unsigned int getSystemDimensions() const;
519 
524  void setParticleDimensions(unsigned int particleDimensions);
525 
529  unsigned int getParticleDimensions() const;
530 
535  std::string getRestartVersion() const;
536 
540  void setRestartVersion(std::string newRV);
541 
545  bool getRestarted() const;
546 
550  void setRestarted(bool newRestartedFlag);
551 
555  bool getAppend() const;
556 
560  void setAppend(bool newAppendFlag);
561 
565  Mdouble getElasticEnergy() const;
566 
570  Mdouble getKineticEnergy() const;
571 
576 
580  bool areInContact(const BaseParticle* pI, const BaseParticle* pJ) const;
581 
583 
586  virtual void hGridInsertParticle(BaseParticle *obj UNUSED);
587 
591  virtual void hGridUpdateParticle(BaseParticle *obj UNUSED);
592 
596  virtual void hGridRemoveParticle(BaseParticle *obj UNUSED);
597 
601  virtual void hGridUpdateMove(BaseParticle*, Mdouble);
602 
607  virtual void gatherContactStatistics(unsigned int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED);
608 
609 //functions that should only be used in the class definitions
610 protected:
611 
616  virtual void computeAllForces();
617 
622  virtual void computeInternalForces(BaseParticle* i);
623 
628  virtual void computeInternalForces(BaseParticle* P1, BaseParticle* P2);
629 
633  virtual void computeExternalForces(BaseParticle* PI);
634 
638  virtual void computeForcesDueToWalls(BaseParticle* PI);
639 
644  virtual void actionsOnRestart();
645 
650  virtual void actionsBeforeTimeLoop();
651 
656  virtual void hGridActionsBeforeTimeLoop();
657 
662  virtual void hGridActionsBeforeTimeStep();
663 
667  virtual bool getHGridUpdateEachTimeStep() const;
668 
673  virtual void actionsBeforeTimeStep();
674 
679  virtual void actionsAfterSolve();
680 
685  virtual void actionsAfterTimeStep();
686 
692  virtual void outputXBallsData(std::ostream& os) const;
693 
698  virtual void outputXBallsDataParticle(const unsigned int i,const unsigned int format, std::ostream& os) const;
699 
703  virtual void writeEneHeader(std::ostream& os) const;
704 
708  virtual void writeFstatHeader(std::ostream& os) const;
709 
715  virtual void writeEneTimestep(std::ostream& os) const;
716 
717  // Functions for statistics
721  virtual void initialiseStatistics();
722 
726  virtual void outputStatistics();
727 
732 
736  virtual void processStatistics(bool usethese UNUSED);
737 
741  virtual void finishStatistics();
742 
748  virtual void integrateBeforeForceComputation();
749 
754  virtual void integrateAfterForceComputation();
755 
761  virtual void checkInteractionWithBoundaries();
762 
766  virtual void hGridActionsBeforeIntegration();
767 
771  virtual void hGridActionsAfterIntegration();
772 
777  virtual void broadPhase(BaseParticle* i);
778 
782  void setFixedParticles(unsigned int n);
783 
789 
793  virtual void printTime() const;
794 
798  virtual bool continueSolve() const;
799 
804  void outputInteractionDetails() const;
805 
809  bool isTimeEqualTo(Mdouble time) const;
810 
815 
822 
823  Mdouble domainSize() const;
824 
825  void writeVTK() const;
826 
827 private:
828 
832  unsigned int systemDimensions_;
833 
837  unsigned int particleDimensions_;
838 
843 
849 
855 
861 
867 
873 
879 
880 
881 
886  int addL_;
887 
892  int addS_;
893 
894 
895 
900 
904  unsigned int ntimeSteps_;
905 
910 
915 
922 
928  std::string restartVersion_;
929 
933  bool restarted_;
934 
939  bool append_;
940 
944  bool rotation_;
945 
950 
955 
956  //This is the private data that is only used by the xballs output
957 
963 
968 
973 
978 
979  //This belongs to the hGrid
980 
981  // defines a Macro for creating an instance of class PossibleContactList. See PossbileContactList.h
982  #ifdef CONTACT_LIST_HGRID
983  PossibleContactList possibleContactList;
984  #endif
985 
986 public:
987 
992 
997 
1002 
1007 
1012 
1017 
1018 };
1019 #endif
Container to store all ParticleSpecies.
virtual bool readUserDefinedWall(std::string type, std::istream &is)
Definition: DPMBase.h:179
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:914
void setTime(Mdouble time)
Access function for the time.
Definition: DPMBase.cc:185
virtual void actionsBeforeTimeLoop()
A virtual function. Allows one to carry out any operations before the start of the time loop...
Definition: DPMBase.cc:722
void setXBallsVectorScale(double newVScale)
Set the scale of vectors in xballs.
Definition: DPMBase.cc:489
virtual void write(std::ostream &os, bool writeAllParticles=true) const
Loads all MD data and plots statistics for all timesteps in the .data file.
Definition: DPMBase.cc:1897
FileType getWallsWriteVTK() const
Returns a flag indicating if particle rotation is enabled or disabled.
Definition: DPMBase.cc:263
virtual void hGridUpdateParticle(BaseParticle *obj UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:757
Container to store pointers to all BaseBoundary objects.
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:415
void setWallsWriteVTK(FileType writeWallsVTK)
Allows to set the flag for enabling or disabling particle rotation in the simulations.
Definition: DPMBase.cc:247
void solve()
The work horse of the code.
Definition: DPMBase.cc:2188
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
virtual void hGridInsertParticle(BaseParticle *obj UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:750
int addL_
Stores the number of large particles that are to be added on restart.
Definition: DPMBase.h:886
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:65
virtual void integrateAfterForceComputation()
Integration is done after force computations. We apply the Velocity verlet scheme. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet.
Definition: DPMBase.cc:1779
void checkAndDuplicatePeriodicParticles()
In case of periodic boundaries, the below methods checks and adds particles when necessary into the p...
Definition: DPMBase.cc:2782
int getXBallsColourMode() const
Get the xball colour mode (CMode)
Definition: DPMBase.cc:481
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Definition: DPMBase.cc:199
bool areInContact(const BaseParticle *pI, const BaseParticle *pJ) const
Checks if two particle are in contact or is there any positive overlap.
Definition: DPMBase.cc:713
void constructor()
A function which initialises the member variables to default values, so that the problem can be solve...
Definition: DPMBase.cc:905
unsigned int getSystemDimensions() const
Returns the dimension of the simulation. Note there is also a particle dimension. ...
Definition: DPMBase.cc:575
bool readArguments(int argc, char *argv[])
Can interpret main function input arguments that are passed by the driver codes.
Definition: DPMBase.cc:2320
int getAddLarge() const
returns the number of large particles that are to be added on restart.
Definition: DPMBase.cc:327
void setAddLarge(int new_addL)
sets the number of large particles that are to be added on restart.
Definition: DPMBase.cc:351
unsigned int particleDimensions_
determines if 2D or 3D particle volume is used for mass calculations
Definition: DPMBase.h:837
bool readRestartFile(bool restarted=true)
Reads all the particle data corresponding to the current saved time step. Which is what the restart f...
Definition: DPMBase.cc:1629
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
void setYMin(Mdouble newYMin)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin...
Definition: DPMBase.cc:371
virtual void computeInternalForces(BaseParticle *i)
Computes the forces between particles (internal in the sense that the sum over all these forces is ze...
Definition: DPMBase.cc:1888
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
void setAddSmall(int new_addS)
sets the number of small particles that are to be added on restart.
Definition: DPMBase.cc:343
unsigned int getParticleDimensions() const
Returns the particle dimensions.
Definition: DPMBase.cc:599
bool readDataFile(const std::string fileName, unsigned int format=0)
This allows particle data to be reloaded from data files.
Definition: DPMBase.cc:1202
Vec3D getMin() const
Return the "bottom left" corner of the domain, a vector with xMin_, yMin_ and zMin_.
Definition: DPMBase.h:330
void setParticlesWriteVTK(bool writeParticlesVTK)
Allows to set the flag for enabling or disabling particle rotation in the simulations.
Definition: DPMBase.cc:255
virtual void initialiseStatistics()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:800
Mdouble elasticEnergy_
used in force calculations
Definition: DPMBase.h:921
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:295
void setXBallsColourMode(int newCMode)
Set the xball output mode.
Definition: DPMBase.cc:473
double Mdouble
virtual void readOld(std::istream &is)
Reads all data from a restart file, e.g. domain data and particle data; old version.
Definition: DPMBase.cc:2063
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
Definition: DPMBase.cc:583
virtual ~DPMBase()
virtual destructor
Definition: DPMBase.cc:151
virtual void actionsAfterTimeStep()
A virtual function which allows to define operations to be executed after time step.
Definition: DPMBase.cc:793
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:439
void setDimension(unsigned int newDim)
Sets the system and particle dimension.
Definition: DPMBase.cc:553
void setAppend(bool newAppendFlag)
Allows to set the append option.
Definition: DPMBase.cc:651
virtual void writeOutputFiles()
Writes the simulation data onto all the files i.e. .data, .ene, .fstat ...
Definition: DPMBase.cc:2139
void setSystemDimensions(unsigned int newDim)
Allows for the dimension of the simulation to be changed.
Definition: DPMBase.cc:562
void writeVTK() const
Definition: DPMBase.cc:1080
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
Definition: DPMBase.cc:537
virtual void outputXBallsData(std::ostream &os) const
This function writes the location of the walls and particles in a format the XBalls program can read...
Definition: DPMBase.cc:1147
virtual bool getHGridUpdateEachTimeStep() const
Definition: DPMBase.cc:771
bool rotation_
A flag to turn on/off particle rotation.
Definition: DPMBase.h:944
bool getParticlesWriteVTK() const
Returns a flag indicating if particle rotation is enabled or disabled.
Definition: DPMBase.cc:271
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
FileType
With FileType options, one is able to choose if data is to be read/written from/into no or single or ...
Definition: File.h:35
bool restarted_
A bool to check if the simulation was restarted or not, ie. if setupInitialConditionsShould be run an...
Definition: DPMBase.h:933
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
void setRotation(bool newRotFlag)
Allows to set the flag for enabling or disabling particle rotation in the simulations.
Definition: DPMBase.cc:231
virtual void processStatistics(bool usethese UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:831
bool findNextExistingDataFile(Mdouble tMin, bool verbose=true)
Useful when fileType is chosen as Multiple Files or Multiple files with padded.
Definition: DPMBase.cc:1401
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:427
unsigned int systemDimensions_
The dimensions of the simulation i.e. 2D or 3D.
Definition: DPMBase.h:832
This is a class that generates random numbers i.e. named the Random Number Generator (RNG)...
Definition: RNG.h:52
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:659
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
Mdouble getGravitationalEnergy() const
Returns the global gravitational potential energy stored in the system.
Definition: DPMBase.cc:686
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
virtual void writeEneTimestep(std::ostream &os) const
This function enables one to write the global energy available in the system after each time step...
Definition: DPMBase.cc:1044
virtual void hGridActionsBeforeIntegration()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:852
void initialiseTangentialSprings()
bool getAppend() const
Returns the flag denoting if the append option is on or off.
Definition: DPMBase.cc:643
virtual bool readNextArgument(int &i, int argc, char *argv[])
Interprets the i^th command-line argument.
Definition: DPMBase.cc:2349
virtual bool checkParticleForInteraction(const BaseParticle &P)
Checks if the particle having any interaction with walls or other particles.
Definition: DPMBase.cc:2632
bool getRestarted() const
Returns the flag denoting if the simulation was restarted or not.
Definition: DPMBase.cc:626
int xBallsColourMode_
XBalls is a package to view the particle data. As an alternative MercuryDPM also supports Paraview...
Definition: DPMBase.h:962
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
Mdouble xBallsScale_
sets the xballs argument scale (see XBalls/xballs.txt)
Definition: DPMBase.h:972
void setXMin(Mdouble newXMin)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin...
Definition: DPMBase.cc:359
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
int addS_
Stores the number of small particles that are to be added on restart.
Definition: DPMBase.h:892
Container to store Interaction objects.
Mdouble domainSize() const
Definition: DPMBase.cc:2818
unsigned int getNtimeSteps() const
Returns the current counter of time steps.
Definition: DPMBase.cc:177
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:672
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
virtual void outputXBallsDataParticle(const unsigned int i, const unsigned int format, std::ostream &os) const
This function writes out the particle locations into an output stream in a format the XBalls program ...
void setRestartVersion(std::string newRV)
Sets restart_version.
Definition: DPMBase.cc:617
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:545
void checkSettings()
Checks if the essentials are set properly to go ahead with solving the problem.
Definition: DPMBase.cc:2115
#define UNUSED
Definition: GeneralDefine.h:39
virtual void hGridActionsBeforeTimeLoop()
A virtual function that allows one to carry out hGrid operations before the start of the time loop...
Definition: DPMBase.cc:729
bool readParAndIniFiles(const std::string fileName)
Allows the user to read par.ini files (useful to read MDCLR files)
Definition: DPMBase.cc:1231
virtual void computeAllForces()
Computes all the forces acting on the particles by using the setTorque and setForce methods...
Definition: DPMBase.cc:1841
bool readNextDataFile(unsigned int format=0)
Reads the next data file with default format=0. However, one can modify the format based on whether t...
Definition: DPMBase.cc:1434
void setZMin(Mdouble newZMin)
If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin...
Definition: DPMBase.cc:383
virtual void actionsAfterSolve()
A virtual function which allows to define operations to be executed after the solve().
Definition: DPMBase.cc:786
virtual void printTime() const
Displays the current simulation time onto your screen for example.
Definition: DPMBase.cc:886
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
FileType writeWallsVTK_
A flag to turn on/off the vtk writer for walls.
Definition: DPMBase.h:949
virtual void writeXBallsScript() const
This writes a script which can be used to load the xballs problem to display the data just generated...
void outputInteractionDetails() const
Displays the interaction details corresponding to the pointer objects in the interaction handler...
Definition: DPMBase.cc:2798
Vec3D getMax() const
Return the "upper right" corner of the domain, a vector with xMin_, yMin_ and zMin_.
Definition: DPMBase.h:335
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:505
Container to store all BaseParticle.
void setFixedParticles(unsigned int n)
Definition: DPMBase.cc:877
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
Mdouble xBallsVectorScale_
sets the xballs argument vscale (see XBalls/xballs.txt)
Definition: DPMBase.h:967
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
virtual void actionsBeforeTimeStep()
A virtual function which allows to define operations to be executed before the new time step...
Definition: DPMBase.cc:779
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:909
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
Container to store all BaseWall.
Definition: WallHandler.h:42
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:996
virtual void hGridRemoveParticle(BaseParticle *obj UNUSED)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:764
virtual double getInfo(const BaseParticle &P) const
A virtual method that allows the user to overrride and set what is written into the info column in th...
Definition: DPMBase.cc:703
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:954
virtual void actionsOnRestart()
A virtual function where the users can add extra code which is executed only when the code is restart...
Definition: DPMBase.cc:736
Manages the linked list of PossibleContact.
virtual void writeEneHeader(std::ostream &os) const
Writes a header with a certain format for ENE file.
Definition: DPMBase.cc:973
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
int getAddSmall() const
returns the number of small particles that are to be added on restart.
Definition: DPMBase.cc:335
void gatherContactStatistics()
Definition: DPMBase.cc:811
virtual void outputStatistics()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:807
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:451
void removeDuplicatePeriodicParticles()
Removes periodic duplicate Particles.
Definition: DPMBase.cc:2765
bool checkParticleForInteractionLocalPeriodic(const BaseParticle &P)
Definition: DPMBase.cc:2680
void setMin(Vec3D min)
Sets the values xMin, yMin, zMin of the problem domain, which is [xMin,xMax]x[yMin,yMax]x[zMin,zMax].
Definition: DPMBase.cc:405
virtual void integrateBeforeForceComputation()
This is were the integration is done, at the moment it is velocity Verlet integration and is done bef...
Definition: DPMBase.cc:1748
virtual void writeRestartFile()
Stores all the particle data for current save time step. Calls the write function.
Definition: DPMBase.cc:1618
std::string xBallsAdditionalArguments_
A string of additional arguments for xballs can be specified (see XBalls/xballs.txt). e.g. "-solidf -v0".
Definition: DPMBase.h:977
double getXBallsVectorScale() const
Returns the scale of vectors used in xballs.
Definition: DPMBase.cc:497
virtual bool continueSolve() const
Definition: DPMBase.cc:897
It is publicly inherited from class Files. It defines an awesome feature that is ideal when doing a p...
virtual void hGridUpdateMove(BaseParticle *, Mdouble)
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:845
virtual void computeForcesDueToWalls(BaseParticle *PI)
Computes the forces on the particles due to the walls (normals are outward normals) ...
Definition: DPMBase.cc:1717
std::string restartVersion_
Previous versions of MercuryDPM had a different restart file format, the below member variable allows...
Definition: DPMBase.h:928
friend std::ostream & operator<<(std::ostream &os, const DPMBase &md)
Operator overloading of DPMBase class, writes the StatType to the given ostream.
void setRestarted(bool newRestartedFlag)
Allows to set the flag stating if the simulation is to be restarted or not.
Definition: DPMBase.cc:634
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
std::string getXBallsAdditionalArguments() const
Returns the additional arguments for xballs.
Definition: DPMBase.cc:513
void setDoCGAlways(bool newDoCGFlag)
virtual void hGridActionsAfterIntegration()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:859
bool getDoCGAlways() const
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
double getXBallsScale() const
Returns the scale of the view in xballs.
Definition: DPMBase.cc:529
virtual void hGridActionsBeforeTimeStep()
A virtual function that allows one to set or execute hGrid parameters or operations before every simu...
Definition: DPMBase.cc:743
void setXBallsScale(Mdouble newScale)
Sets the scale of the view (either normal, zoom in or zoom out) to display in xballs. The default is fit to screen.
Definition: DPMBase.cc:521
bool getRotation() const
Returns a flag indicating if particle rotation is enabled or disabled.
Definition: DPMBase.cc:239
virtual void finishStatistics()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:838
virtual void broadPhase(BaseParticle *i)
By broad one means to screen and determine an approximate number of particles that a given particle c...
Definition: DPMBase.cc:866
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
virtual void checkInteractionWithBoundaries()
There are a range of boundaries one could implement depending on ones' problem. This methods checks f...
Definition: DPMBase.cc:1763
virtual void writeFstatHeader(std::ostream &os) const
Writes a header with a certain format for FStat file.
Definition: DPMBase.cc:994
virtual void read(std::istream &is)
Reads all data from a restart file, e.g. domain data and particle data.
Definition: DPMBase.cc:1955
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:214
DPMBase()
Constructor that calls the "void constructor()".
Definition: DPMBase.cc:143
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:842
virtual bool checkParticleForInteractionLocal(const BaseParticle &P)
Checks if a particle P has any interaction with walls or other particles in the local domain...
Definition: DPMBase.cc:2718
virtual void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: DPMBase.cc:966
bool append_
A flag to determine if the file has to be appended or not. See DPMBase::Solve() for example...
Definition: DPMBase.h:939
void setMax(Vec3D max)
Sets the values xMax, yMax, zMax of the problem domain, which is [xMin,xMax]x[yMin,yMax]x[zMin,zMax].
Definition: DPMBase.cc:395
virtual void computeExternalForces(BaseParticle *PI)
Computes the external forces acting on particles (e.g. gravitational)
Definition: DPMBase.cc:1703
std::string getRestartVersion() const
This is to take into account for different Mercury versions. Returns the version of the restart file...
Definition: DPMBase.cc:608
bool isTimeEqualTo(Mdouble time) const
Checks if the input variable "time" is the current time in the simulation.
Definition: DPMBase.cc:2813