MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Logger.h File Reference
#include <string>
#include <sstream>
#include <functional>
#include <type_traits>
#include "GeneralDefine.h"

Go to the source code of this file.

Classes

class  LoggerOutput
 Default functions for output generation. More...
 
class  Logger< L, ASSERTS >
 See How to use the logger for details on how to use the logger. More...
 
class  LL< Level >
 Tag for template metaprogramming. More...
 
class  Logger< L, ASSERTS >
 See How to use the logger for details on how to use the logger. More...
 

Macros

#define MERCURY_LOGLEVEL   Log::DEFAULT
 
#define MERCURY_ASSERTS   true
 
#define assert(e,...)   assert(true,"")
 

Enumerations

enum  Log : signed char {
  Log::FATAL = -20, Log::ERROR = -15, Log::WARN = -10, Log::INFO = -5,
  Log::DEFAULT = 0, Log::VERBOSE = 5, Log::DEBUG = 10
}
 The different loglevels. More...
 

Functions

constexpr bool operator<= (const Log rhs, const Log lhs)
 Internally used to filter on loglevel. Do not edit, as this is required for an optimised logger. More...
 

Variables

LoggerOutputloggerOutput
 Declaration of the output functions. If the output needs to be redirected, please swap the loggerOutput pointer to your preferred LoggerOutput instance, and make sure this exists until AFTER an std::exit() invocation. (e.g. clean up with std::atexit()) More...
 
LL< Log::FATAL > FATAL
 Fatal log level. More...
 
LL< Log::ERROR > ERROR
 Error log level. More...
 
LL< Log::WARN > WARN
 Warning log level. More...
 
LL< Log::INFO > INFO
 Info log level. More...
 
LL< Log::DEFAULT > DEFAULT
 Default log level. More...
 
LL< Log::VERBOSE > VERBOSE
 Verbose information. More...
 
LL< Log::DEBUG > DEBUG
 Debug information. More...
 
Logger< MERCURY_LOGLEVELlogger
 

Macro Definition Documentation

#define MERCURY_ASSERTS   true
Todo:
decide if this monologue of Chris should be moved elsewhere

Definition at line 54 of file Logger.h.

#define MERCURY_LOGLEVEL   Log::DEFAULT

Definition at line 36 of file Logger.h.

Enumeration Type Documentation

enum Log : signed char
strong

The different loglevels.

The different loglevels, represented as signed characters, in descending order of severeness. Worst is FATAL, best is DEBUG.

Please, use the tags FATAL/ERROR/etc without class/enum/namespace instead.

Enumerator
FATAL 
ERROR 
WARN 
INFO 
DEFAULT 
VERBOSE 
DEBUG 

Definition at line 155 of file Logger.h.

156  : signed char
157  {
158  FATAL = -20, ERROR = -15, WARN = -10, INFO = -5, DEFAULT = 0, VERBOSE = 5, DEBUG = 10
159 };
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:53
LL< Log::DEBUG > DEBUG
Debug information.
Definition: Logger.cc:56
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:51
LL< Log::DEFAULT > DEFAULT
Default log level.
Definition: Logger.cc:54
LL< Log::VERBOSE > VERBOSE
Verbose information.
Definition: Logger.cc:55
LL< Log::FATAL > FATAL
Fatal log level.
Definition: Logger.cc:50
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:52

Function Documentation

constexpr bool operator<= ( const Log  rhs,
const Log  lhs 
)

Internally used to filter on loglevel. Do not edit, as this is required for an optimised logger.

Definition at line 165 of file Logger.h.

166 {
167  return ((static_cast<signed char>(rhs)) <= (static_cast<signed char>(lhs)));
168 }

Variable Documentation

LL<Log::DEBUG> DEBUG

Debug information.

Only used for internal development. Can be very cryptic, as it is only meant for finding bugs / oddities by the internal development team.

Example: Collission found between Particle #38201 and Wall #5

Default behaviour: ignore.

Definition at line 56 of file Logger.cc.

Referenced by BaseHandler< T >::BaseHandler(), and BaseHandler< T >::~BaseHandler().

LL<Log::DEFAULT> DEFAULT

Default log level.

Only useful for defining the loglevel of the logger itself. Should not actually be used.

Definition at line 54 of file Logger.cc.

LL<Log::ERROR> ERROR

Error log level.

Error, as in, the program has found a severe problem which it cannot resolve any further. It does not know how to recover in a sane way.

Example: Negative timestep, Infinite end time and no override of the continuation function.

Default behaviour: log to std::cerr, followed by std::exit().

Definition at line 51 of file Logger.cc.

Referenced by BaseHandler< T >::getObjectById(), helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep(), main(), Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::mixAll(), and operator>>().

LL<Log::FATAL> FATAL

Fatal log level.

These are the loglevels which should be used to control the logger. They are declared here but defined in Logger.cpp

Fatal, as in, the program has suffered from the worst possible failure and there is no way it can gracefully recover.

Example: No memory allocations possible

Default behaviour: log to std::cerr, followed by std::exit().

Definition at line 50 of file Logger.cc.

Referenced by main(), and transformMercuryToVTK().

LL<Log::INFO> INFO

Info log level.

Useful information, small oddities found which should be of no real effect to the user. Also information about the current state and progress of the program.

Example: Finished inserting particles.

Default behaviour: log to std::cout, returns afterwards.

Definition at line 53 of file Logger.cc.

Referenced by helpers::compare(), helpers::loadingTest(), main(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), helpers::readFromFile(), SinterNormalSpecies::setParhamiMcKeeping(), and transformMercuryToVTK().

Default logger. Use this for general logging.

For very specific modules, define your own logger. If you want to make extensive use of Debug messages, please use a custom logger as well, to prevent polluting the output.

Referenced by PossibleContactList::add_PossibleContact(), ParticleHandler::addObject(), WallHandler::addObject(), IntersectionOfWalls::addObject(), MaserBoundary::addParticleToMaser(), AxisymmetricIntersectionOfWalls::AxisymmetricIntersectionOfWalls(), BaseHandler< T >::BaseHandler(), BaseInteractable::BaseInteractable(), BaseObject::BaseObject(), BaseParticle::BaseParticle(), BaseWall::BaseWall(), BoundaryHandler::BoundaryHandler(), helpers::check(), MaserBoundary::checkBoundaryAfterParticleMoved(), MercuryBase::checkParticleForInteractionLocal(), Chute::Chute(), Chute::cleanChute(), BaseWall::clear(), Coil::Coil(), helpers::compare(), ParticleHandler::computeLargestParticle(), ParticleSpecies::computeMass(), SinterInteraction::computeNormalForce(), ParticleHandler::computeSmallestParticle(), Chute::createBottom(), DeletionBoundary::DeletionBoundary(), FileReader::FileReader(), FilesAndRunNumber::FilesAndRunNumber(), Vec3D::getComponent(), AxisymmetricIntersectionOfWalls::getDistanceAndNormal(), IntersectionOfWalls::getDistanceAndNormal(), BaseHandler< T >::getDPMBase(), ChargedBondedInteraction::getElasticEnergy(), ParticleHandler::getFastestParticle(), ParticleHandler::getHighestPositionComponentParticle(), ParticleHandler::getHighestVelocityComponentParticle(), ReversibleAdhesiveSpecies::getInteractionDistance(), ParticleHandler::getLargestParticle(), ParticleHandler::getLightestParticle(), ParticleHandler::getLowestPositionComponentParticle(), ParticleHandler::getLowestVelocityComponentParticle(), SpeciesHandler::getMixedObject(), ParticleHandler::getNewObject(), PossibleContact::getNext(), BaseHandler< T >::getObject(), BaseHandler< T >::getObjectById(), PossibleContact::getPrevious(), helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep(), ParticleHandler::getSmallestParticle(), ChuteWithHopper::getTimeStepRatio(), BaseParticle::getVolume(), ParticleSpecies::getVolumeFromRadius(), HGrid::HGrid(), MercuryBase::hGridActionsBeforeTimeStep(), Mercury2D::hGridHasParticleContacts(), MercuryBase::hGridInfo(), MercuryBase::hGridNeedsRebuilding(), MercuryBase::hGridRebuild(), InfiniteWall::InfiniteWall(), HGrid::info(), HGrid::insertParticleToHgrid(), InteractionHandler::InteractionHandler(), IntersectionOfWalls::IntersectionOfWalls(), BaseWall::intersectVTK(), helpers::loadingTest(), main(), ChuteBottom::makeRoughBottom(), Mercury2D::Mercury2D(), Mercury3D::Mercury3D(), MercuryBase::MercuryBase(), MindlinInteraction::MindlinInteraction(), Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::mixAll(), InfiniteWall::move(), helpers::normalAndTangentialLoadingTest(), Vec3D::normalize(), helpers::objectivenessTest(), SpeciesHandler::operator=(), InteractionHandler::operator=(), BoundaryHandler::operator=(), ParticleHandler::operator=(), WallHandler::operator=(), IntersectionOfWalls::operator=(), TriangulatedWall::operator=(), operator>>(), ParticleHandler::ParticleHandler(), PeriodicBoundary::PeriodicBoundary(), PossibleContactList::PossibleContactList(), HGridOptimiser::radius2Cell(), ChargedBondedSpecies::read(), FileReader::read(), BaseHandler< T >::read(), Chute::read(), DPMBase::read(), helpers::readFromFile(), DPMBase::readNextDataFile(), SpeciesHandler::readObject(), InteractionHandler::readObject(), BoundaryHandler::readObject(), WallHandler::readObject(), ParticleHandler::readObject(), SpeciesHandler::readOldObject(), WallHandler::readOldObject(), ParticleHandler::readOldObject(), TriangulatedWall::readVTK(), PossibleContactList::remove_ParticlePosibleContacts(), BaseInteractable::removeInteraction(), BaseHandler< T >::removeLastObject(), BaseHandler< T >::removeObject(), RestrictedWall::RestrictedWall(), Screw::Screw(), PeriodicBoundary::set(), InfiniteWall::set(), Chute::setChuteAngle(), Chute::setChuteAngleAndMagnitudeOfGravity(), ChuteWithHopper::setChuteLength(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), Vec3D::setComponent(), ParticleSpecies::setDensity(), SinterNormalSpecies::setDissipation(), HertzianViscoelasticNormalSpecies::setElasticModulusAndRestitutionCoefficient(), Chute::setFixedParticleRadius(), ThermalSpecies< NormalForceSpecies >::setHeatCapacity(), ChuteWithHopper::setHopper(), ChuteWithHopper::setHopperShift(), BaseWall::setIndSpecies(), BaseParticle::setIndSpecies(), BaseParticle::setInertia(), Chute::setInflowParticleRadius(), Chute::setInflowVelocity(), Chute::setInflowVelocityVariance(), SinterNormalSpecies::setInverseSinterViscosity(), BaseParticle::setMass(), BaseParticle::setMassForP3Statistics(), Chute::setMaxInflowParticleRadius(), Chute::setMinInflowParticleRadius(), PossibleContact::setNextPosition(), SinterNormalSpecies::setParhamiMcKeeping(), DPMBase::setParticleDimensions(), PossibleContact::setPreviousPosition(), SphericalWall::setRadius(), Chute::setRoughBottomType(), SinterNormalSpecies::setSinterAdhesion(), SinterNormalSpecies::setSinterForceAndTime(), SinterNormalSpecies::setSinterRate(), SinterNormalSpecies::setSinterType(), BaseInteractable::setSpecies(), DPMBase::setSystemDimensions(), ThermalSpecies< NormalForceSpecies >::setThermalConductivity(), ChuteBottom::setThickness(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), DPMBase::setXMax(), DPMBase::setXMin(), DPMBase::setYMax(), DPMBase::setYMin(), DPMBase::setZMax(), DPMBase::setZMin(), DPMBase::solve(), SpeciesHandler::SpeciesHandler(), SphericalWall::SphericalWall(), transformMercuryToVTK(), TriangulatedWall::TriangulatedWall(), MercuryBase::userHGridCellSize(), WallHandler::WallHandler(), WallHandler::writeVTK(), InteractionHandler::writeVTK(), BaseWall::writeVTK(), ParticleHandler::writeVTK(), DPMBase::writeVTK(), WallHandler::writeVTKBoundingBox(), WallHandler::writeVTKFile(), AxisymmetricIntersectionOfWalls::~AxisymmetricIntersectionOfWalls(), BaseHandler< T >::~BaseHandler(), BaseInteractable::~BaseInteractable(), BaseObject::~BaseObject(), BaseParticle::~BaseParticle(), BaseWall::~BaseWall(), BoundaryHandler::~BoundaryHandler(), Coil::~Coil(), DeletionBoundary::~DeletionBoundary(), FileReader::~FileReader(), FilesAndRunNumber::~FilesAndRunNumber(), HGrid::~HGrid(), InfiniteWall::~InfiniteWall(), InteractionHandler::~InteractionHandler(), IntersectionOfWalls::~IntersectionOfWalls(), MercuryBase::~MercuryBase(), ParticleHandler::~ParticleHandler(), PeriodicBoundary::~PeriodicBoundary(), RestrictedWall::~RestrictedWall(), Screw::~Screw(), SpeciesHandler::~SpeciesHandler(), SphericalWall::~SphericalWall(), TriangulatedWall::~TriangulatedWall(), and WallHandler::~WallHandler().

LoggerOutput* loggerOutput

Declaration of the output functions. If the output needs to be redirected, please swap the loggerOutput pointer to your preferred LoggerOutput instance, and make sure this exists until AFTER an std::exit() invocation. (e.g. clean up with std::atexit())

Definition at line 143 of file Logger.cc.

Referenced by DPMBase::constructor().

LL<Log::VERBOSE> VERBOSE

Verbose information.

Information which is not useful to anybody except those looking for weird behaviour and statistics. These should however still be clear in meaning.

Example: Inserted 381 particles in Insertion Boundary #1.

Default behaviour: ignore.

Definition at line 55 of file Logger.cc.

Referenced by main(), and BaseHandler< T >::read().

LL<Log::WARN> WARN

Warning log level.

Warning, as in, the program has detected a problem but does know a solution. The simulation can continue with this fix, but the user should look at fixing his / her simulation so this won't occur in the future.

Example: Setting a smaller Xmax than Xmin.

Default behaviour: log to std::cerr, returns afterwards.

Definition at line 52 of file Logger.cc.

Referenced by main(), helpers::readFromFile(), BaseHandler< T >::removeLastObject(), and transformMercuryToVTK().