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

170 {
172  PeriodicWallsWithSlidingFrictionUnitTest periodicWallsWithSlidingFrictionUnitTest;
173  periodicWallsWithSlidingFrictionUnitTest.setName("PeriodicWallsWithSlidingFrictionUnitTest");
174  periodicWallsWithSlidingFrictionUnitTest.solve();
175 
176  BaseParticle* pNormal = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(4);
177  BaseParticle* pCase1 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(0);
178  BaseParticle* pCase2 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(2);
179  Vec3D shift;
180 
181  shift = Vec3D(-0.58, -0.4, 0.0);
182  if (!pCase1->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
183  {
184  logger(FATAL, "E0 The particle is in the wrong position. It is %, however is should be %",
185  pCase1->getPosition(), pNormal->getPosition() + shift);
186  }
187  if (!pCase1->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
188  {
189  logger(FATAL, "E1 The particle has the wrong velocity. It is %, however is should be %", pCase1->getVelocity(),
190  pNormal->getVelocity());
191  }
192 
193  shift = Vec3D(0.0, -0.779, 0.0);
194  if (!pCase2->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
195  {
196  logger(FATAL, "E2 The particle is in the wrong position. It is %, however is should be %",
197  pCase2->getPosition(), pNormal->getPosition() + shift);
198  }
199  if (!pCase2->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
200  {
201  logger(FATAL, "E3 The particle has the wrong velocity. It is %, however is should be %", pCase2->getVelocity(),
202  pNormal->getVelocity());
203  }
204 
205  pNormal = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(5);
206  pCase1 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(1);
207  pCase2 = periodicWallsWithSlidingFrictionUnitTest.particleHandler.getObject(3);
208 
209  shift = Vec3D(1.0 - 0.58, -0.4, 0.0);
210  if (!pCase1->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
211  {
212  logger(FATAL, "E4 The particle is in the wrong position. It is %, however is should be %",
213  pCase1->getPosition(), pNormal->getPosition() + shift);
214  }
215  if (!pCase1->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
216  {
217  logger(FATAL, "E5 The particle has the wrong velocity. It is %, however is should be %", pCase1->getVelocity(),
218  pNormal->getVelocity());
219  }
220 
221  shift = Vec3D(0.0, 1.0 - 0.779, 0.0);
222  if (!pCase2->getPosition().isEqualTo(pNormal->getPosition() + shift, 1e-10))
223  {
224  logger(FATAL, "E6 The particle is in the wrong position. It is %, however is should be %",
225  pCase2->getPosition(), pNormal->getPosition() + shift);
226  }
227  if (!pCase2->getVelocity().isEqualTo(pNormal->getVelocity(), 1e-10))
228  {
229  logger(FATAL, "E7 The particle has the wrong velocity. It is %, however is should be %", pCase2->getVelocity(),
230  pNormal->getVelocity());
231  }
232 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
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:31
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:621
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:307
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
Definition: BaseParticle.h:33
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
Definition: PeriodicWallsWithSlidingFrictionUnitTest.cpp:17
Definition: Kernel/Math/Vector.h:30
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:313

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