MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PeriodicWallsWithSlidingFrictionUnitTest.cpp File Reference

Go to the source code of this file.

Classes

class  PeriodicWallsWithSlidingFrictionUnitTest
 This test is a UnitTest for: Periodic Particles in combination with HGrid Tangential Springs over periodic contacts and during transitions from periodic to normal and reverse Removal of Particles while tangential spring information has to be conserved. More...
 

Functions

int main (int argc UNUSED, char *argv[] UNUSED)
 

Function Documentation

int main ( int argc  UNUSED,
char *argv[]  UNUSED 
)

Start off by solving the default problem

Definition at line 174 of file PeriodicWallsWithSlidingFrictionUnitTest.cpp.

References FATAL, BaseHandler< T >::getObject(), BaseInteractable::getPosition(), BaseInteractable::getVelocity(), Vec3D::isEqualTo(), logger, DPMBase::particleHandler, Files::setName(), and DPMBase::solve().

175 {
177  PeriodicWallsWithSlidingFrictionUnitTest periodicWallsWithSlidingFrictionUnitTest;
178  periodicWallsWithSlidingFrictionUnitTest.solve();
179 
180  periodicWallsWithSlidingFrictionUnitTest.setName("PeriodicWallsWithSlidingFrictionUnitTest");
181 
182  BaseParticle* PNormal;
183  BaseParticle* PCase1;
184  BaseParticle* PCase2;
185  Vec3D shift;
186  PNormal = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(4);
187  PCase1 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(0);
188  PCase2 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(2);
189 
190  shift = Vec3D(-0.58, -0.4, 0.0);
191  if (!PCase1->getPosition().isEqualTo(PNormal->getPosition() + shift, 1e-10))
192  {
193  logger(FATAL, "E0 The particle is in the wrong position. It is %, however is should be %", PCase1->getPosition(), PNormal->getPosition() + shift);
194  }
195  if (!PCase1->getVelocity().isEqualTo(PNormal->getVelocity(), 1e-10))
196  {
197  logger(FATAL, "E1 The particle has the wrong velocity. It is %, however is should be %", PCase1->getVelocity(), PNormal->getVelocity());
198  }
199 
200  shift = Vec3D(0.0, -0.779, 0.0);
201  if (!PCase2->getPosition().isEqualTo(PNormal->getPosition() + shift, 1e-10))
202  {
203  logger(FATAL, "E2 The particle is in the wrong position. It is %, however is should be %", PCase2->getPosition(), PNormal->getPosition() + shift);
204  }
205  if (!PCase2->getVelocity().isEqualTo(PNormal->getVelocity(), 1e-10))
206  {
207  logger(FATAL, "E3 The particle has the wrong velocity. It is %, however is should be %", PCase2->getVelocity(), PNormal->getVelocity());
208  }
209 
210  PNormal = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(5);
211  PCase1 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(1);
212  PCase2 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(3);
213 
214  shift = Vec3D(1.0 - 0.58, -0.4, 0.0);
215  if (!PCase1->getPosition().isEqualTo(PNormal->getPosition() + shift, 1e-10))
216  {
217  std::cout << PNormal->getPosition() - PCase1->getPosition() << " " << PNormal->getPosition() + PCase1->getPosition() << std::endl;
218  logger(FATAL, "E4 The particle is in the wrong position. It is %, however is should be %", PCase1->getPosition(), PNormal->getPosition() + shift);
219  }
220  if (!PCase1->getVelocity().isEqualTo(PNormal->getVelocity(), 1e-10))
221  {
222  logger(FATAL, "E5 The particle has the wrong velocity. It is %, however is should be %", PCase1->getVelocity(), PNormal->getVelocity());
223  }
224 
225  shift = Vec3D(0.0, 1.0 - 0.779, 0.0);
226  if (!PCase2->getPosition().isEqualTo(PNormal->getPosition() + shift, 1e-10))
227  {
228  logger(FATAL, "E6 The particle is in the wrong position. It is %, however is should be %", PCase2->getPosition(), PNormal->getPosition() + shift);
229  }
230  if (!PCase2->getVelocity().isEqualTo(PNormal->getVelocity(), 1e-10))
231  {
232  logger(FATAL, "E7 The particle has the wrong velocity. It is %, however is should be %", PCase2->getVelocity(), PNormal->getVelocity());
233  }
234 }
void solve()
The work horse of the code.
Definition: DPMBase.cc:1895
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
bool isEqualTo(const Vec3D &other, const double tol) const
Checks if the length this Vec3D is equal the length of other with a certain tolerance.
Definition: Vector.cc:390
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:149
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:415
LL< Log::FATAL > FATAL
Fatal log level.
Definition: Logger.cc:25
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
This test is a UnitTest for: Periodic Particles in combination with HGrid Tangential Springs over per...