Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 265ecd83 authored by Nghia Truong's avatar Nghia Truong
Browse files

COMP: Fix imstkModule.cpp compiling warnings when compare double number == 0

parent 6ca7aede
......@@ -39,7 +39,7 @@ TetraToTetraCD::TetraToTetraCD(std::shared_ptr<TetrahedralMesh> meshA,
void
TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<TetrahedralMesh> mesh, size_t idOffset)
{
const auto eps = MACHINE_PRECISION;
const auto eps = VERY_SMALL_EPSILON;
const double eps2 = 1e-10;
//tetrahedron belonging part of penetration type does not change
......
......@@ -122,15 +122,15 @@ using AffineTransform3d = Eigen::Affine3d;
#define LN2 Real(0.693147180559945309417)
#define LN10 Real(2.30258509299404568402)
#define MAX_REAL std::numeric_limits<Real>::max()
#define MIN_REAL std::numeric_limits<Real>::min()
#define MACHINE_PRECISION std::numeric_limits<Real>::epsilon()
#define MAX_REAL std::numeric_limits<Real>::max()
#define MIN_REAL std::numeric_limits<Real>::min()
#define VERY_SMALL_EPSILON std::numeric_limits<Real>::epsilon()
#define MAX_D std::numeric_limits<double>::max()
#define MIN_D std::numeric_limits<double>::min()
#define MACHINE_PRECISION_D std::numeric_limits<double>::epsilon()
#define MAX_D std::numeric_limits<double>::max()
#define MIN_D std::numeric_limits<double>::min()
#define VERY_SMALL_EPSILON_D std::numeric_limits<double>::epsilon()
#define MAX_F std::numeric_limits<float>::max()
#define MIN_F std::numeric_limits<float>::min()
#define MACHINE_PRECISION_F std::numeric_limits<float>::epsilon()
#define MAX_F std::numeric_limits<float>::max()
#define MIN_F std::numeric_limits<float>::min()
#define VERY_SMALL_EPSILON_F std::numeric_limits<float>::epsilon()
} // end namespace imstk
......@@ -20,7 +20,7 @@
=========================================================================*/
#include "imstkModule.h"
#include "imstkMath.h"
#include "g3log/g3log.hpp"
namespace imstk
......@@ -65,7 +65,7 @@ Module::start()
{
// Short path to run module if loop delay = 0
// (updating as fast as possible)
if (m_loopDelay == 0)
if (m_loopDelay < VERY_SMALL_EPSILON_D)
{
if (m_preUpdateCallback)
{
......@@ -158,7 +158,7 @@ Module::end()
while (m_status != ModuleStatus::INACTIVE) {}
}
const ModuleStatus
ModuleStatus
Module::getStatus() const
{
return m_status.load();
......@@ -188,7 +188,7 @@ Module::setLoopDelay(const double milliseconds)
double Module::getFrequency() const
{
if (m_loopDelay == 0)
if (m_loopDelay < VERY_SMALL_EPSILON_D)
{
LOG(WARNING) << "Module::getFrequency warning: loop delay is set to 0ms, "
<< "therefore not regulated by a frequency. Returning 0.";
......@@ -206,7 +206,7 @@ Module::setFrequency(const double f)
<< "or equal to 0 to run the module in a closed loop.";
return;
}
if (f == 0)
if (f < VERY_SMALL_EPSILON_D)
{
m_loopDelay = 0;
return;
......
......@@ -62,7 +62,7 @@ public:
///
/// \brief Destructor
///
~Module() = default;
virtual ~Module() = default;
///
/// \brief Start the module
......@@ -94,7 +94,7 @@ public:
///
/// \brief Get the status of the module
///
const ModuleStatus getStatus() const;
ModuleStatus getStatus() const;
///
/// \brief Get the name of the module
......@@ -148,7 +148,7 @@ protected:
std::atomic<ModuleStatus> m_status {ModuleStatus::INACTIVE}; ///> Module status
std::string m_name; ///> Name of the module
double m_loopDelay; ///> Loop delay
double m_loopDelay = 0; ///> Loop delay
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment