PeriodicWallsWithSlidingFrictionUnitTest.cpp File Reference

Classes

class  PeriodicWallsWithSlidingFrictionUnitTest
 

Functions

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

Function Documentation

◆ main()

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

Start off by solving the default problem

190 {
192  PeriodicWallsWithSlidingFrictionUnitTest periodicWallsWithSlidingFrictionUnitTest;
193  periodicWallsWithSlidingFrictionUnitTest.setName("PeriodicWallsWithSlidingFrictionUnitTest");
194  periodicWallsWithSlidingFrictionUnitTest.solve();
195 
196  BaseParticle* pNormal = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(4);
197  BaseParticle* pCase1 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(0);
198  BaseParticle* pCase2 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(2);
199  Vec3D shift;
200 
201  shift = Vec3D(-0.58, -0.4, 0.0);
202  if (!pCase1->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
203  {
204  logger(FATAL, "E0 The particle is in the wrong position. It is %, however is should be %",
205  pCase1->getPosition(), pNormal->getPosition() + shift);
206  }
207  if (!pCase1->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
208  {
209  logger(FATAL, "E1 The particle has the wrong velocity. It is %, however is should be %", pCase1->getVelocity(),
210  pNormal->getVelocity());
211  }
212 
213  shift = Vec3D(0.0, -0.779, 0.0);
214  if (!pCase2->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
215  {
216  logger(FATAL, "E2 The particle is in the wrong position. It is %, however is should be %",
217  pCase2->getPosition(), pNormal->getPosition() + shift);
218  }
219  if (!pCase2->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
220  {
221  logger(FATAL, "E3 The particle has the wrong velocity. It is %, however is should be %", pCase2->getVelocity(),
222  pNormal->getVelocity());
223  }
224 
225  pNormal = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(5);
226  pCase1 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(1);
227  pCase2 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(3);
228 
229  shift = Vec3D(1.0 - 0.58, -0.4, 0.0);
230  if (!pCase1->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
231  {
232  logger(FATAL, "E4 The particle is in the wrong position. It is %, however is should be %",
233  pCase1->getPosition(), pNormal->getPosition() + shift);
234  }
235  if (!pCase1->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
236  {
237  logger(FATAL, "E5 The particle has the wrong velocity. It is %, however is should be %", pCase1->getVelocity(),
238  pNormal->getVelocity());
239  }
240 
241  shift = Vec3D(0.0, 1.0 - 0.779, 0.0);
242  if (!pCase2->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
243  {
244  logger(FATAL, "E6 The particle is in the wrong position. It is %, however is should be %",
245  pCase2->getPosition(), pNormal->getPosition() + shift);
246  }
247  if (!pCase2->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
248  {
249  logger(FATAL, "E7 The particle has the wrong velocity. It is %, however is should be %", pCase2->getVelocity(),
250  pNormal->getVelocity());
251  }
252 }
LL< Log::FATAL > FATAL
Definition of the different loglevels by its wrapper class LL. These are used as tags in template met...
Definition: Logger.cc:52
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
Definition: BaseParticle.h:54
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
Definition: PeriodicWallsWithSlidingFrictionUnitTest.cpp:37
Definition: Vector.h:51
bool isEqualTo(const Vec3D &other, double tol) const
Checks if the length this Vec3D is equal the length of other with a certain tolerance.
Definition: Vector.cc:294

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