Skip to content
Snippets Groups Projects
Commit 53c6e4c8 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

COMP: Clear more warning and clean up

parent 981ebb50
No related branches found
No related tags found
No related merge requests found
Showing
with 57 additions and 61 deletions
......@@ -229,9 +229,9 @@ main()
const double distanceY = 5.0;
const double minHeight = -5.0;
std::vector<std::shared_ptr<SurfaceMesh>> surfaceMeshes;
std::vector<std::shared_ptr<PbdObject>> pbdObjs;
std::vector<std::shared_ptr<PbdSolver>> pbdSolvers;
std::vector<std::shared_ptr<SurfaceMesh>> surfaceMeshes;
std::vector<std::shared_ptr<PbdObject>> pbdObjs;
//std::vector<std::shared_ptr<PbdSolver>> pbdSolvers;
std::vector<std::shared_ptr<CollisionData>> allCollisionData;
size_t numTriangles = 0;
......@@ -260,7 +260,7 @@ main()
generateDragon(scene, translation, mesh, pbdObj, solver);
surfaceMeshes.push_back(mesh);
pbdObjs.push_back(pbdObj);
pbdSolvers.push_back(solver);
//pbdSolvers.push_back(solver);
numTriangles += mesh->getNumTriangles();
// Collision between dragon with floor
......
......@@ -20,16 +20,8 @@
=========================================================================*/
#include "imstkSimulationManager.h"
#include "imstkRigidObject.h"
#include "imstkRigidBodyModel.h"
#include "imstkSceneObject.h"
#include "imstkTetrahedralMesh.h"
#include "imstkCube.h"
#include "imstkPlane.h"
#include "imstkSphere.h"
#include "imstkMeshIO.h"
#include "imstkIsometricMap.h"
#include "imstkSimulationManager.h"
#include "imstkVirtualCouplingCH.h"
#include "imstkHDAPIDeviceServer.h"
......
......@@ -77,9 +77,9 @@ public:
///
/// \brief Constructor
///
RenderParticleEmitter(std::shared_ptr<Geometry> geometry,
const float time = 3000.0f,
Mode mode = Mode::CONTINUOUS);
explicit RenderParticleEmitter(std::shared_ptr<Geometry> geometry,
const float time = 3000.0f,
Mode mode = Mode::CONTINUOUS);
///
/// \brief Set animation geometry
......
......@@ -178,9 +178,9 @@ CollisionDetection::makeCollisionDetectionObject(const Type
}
}
CollisionDetection::CollisionDetection(const CollisionDetection::Type& type, std::shared_ptr<CollisionData> colData) : m_type(type)
CollisionDetection::CollisionDetection(const CollisionDetection::Type& type, std::shared_ptr<CollisionData> colData) : m_type(type),
m_colData((colData == nullptr) ? std::make_shared<CollisionData>() : colData)
{
m_colData = (colData == nullptr) ? std::make_shared<CollisionData>() : colData;
}
// Static functions ==>
......
......@@ -47,7 +47,7 @@ public:
/// \param name Name of the octree
///
explicit OctreeBasedCD(const Vec3r& center, const Real width, const Real minWidth,
const Real minWidthRatio = 1.0, const std::string name = "OctreeBasedCD") :
const Real minWidthRatio = 1.0, const std::string& name = "OctreeBasedCD") :
LooseOctree(center, width, minWidth, minWidthRatio, name) {}
///
......
......@@ -34,10 +34,12 @@ SurfaceMeshToSurfaceMeshCCD::SurfaceMeshToSurfaceMeshCCD(std::shared_ptr<Surface
std::shared_ptr<CollisionData> colData) :
CollisionDetection(CollisionDetection::Type::SurfaceMeshToSurfaceMeshCCD, colData),
m_meshA(meshA),
m_meshB(meshB)
m_meshB(meshB),
m_modelA(std::make_shared<DeformModel>(meshA->getVertexPositions(), meshA->getTrianglesVertices())),
m_modelB(std::make_shared<DeformModel>(meshB->getVertexPositions(), meshB->getTrianglesVertices()))
{
m_modelA = std::make_shared<DeformModel>(meshA->getVertexPositions(), meshA->getTrianglesVertices());
m_modelB = std::make_shared<DeformModel>(meshB->getVertexPositions(), meshB->getTrianglesVertices());
//m_modelA = std::make_shared<DeformModel>(meshA->getVertexPositions(), meshA->getTrianglesVertices());
//m_modelB = std::make_shared<DeformModel>(meshB->getVertexPositions(), meshB->getTrianglesVertices());
// Setup Callbacks
m_modelA->SetEECallBack(SurfaceMeshToSurfaceMeshCCD::EECallback, this);
......
......@@ -86,6 +86,6 @@ public:
private:
std::shared_ptr<DeformableObject> m_object; ///> Deformable object
std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints;
std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints = nullptr;
};
}
......@@ -39,7 +39,7 @@ protected:
};
std::shared_ptr<TetrahedralMesh>
loadMesh(std::string externalDataSuffix)
loadMesh(const std::string& externalDataSuffix)
{
std::string file = iMSTK_DATA_ROOT + externalDataSuffix;
std::shared_ptr<TetrahedralMesh> volMesh
......
......@@ -29,12 +29,10 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A,
std::shared_ptr<CollidingObject> B,
CollisionDetection::Type CDType,
CollisionHandling::Type CHAType,
CollisionHandling::Type CHBType)
CollisionHandling::Type CHBType) :
m_colData(std::make_shared<CollisionData>()),
m_valid(false)
{
m_colData = std::make_shared<CollisionData>();
m_valid = false;
// Check that objects exist
CHECK(A != nullptr && B != nullptr) << "InteractionPair error: invalid objects (nullptr).";
......
......@@ -78,8 +78,8 @@ private:
std::shared_ptr<PbdObject> m_firstObj;
std::shared_ptr<PbdObject> m_secondObj;
double m_firstObjProximity;
double m_secondObjProximity;
unsigned int maxIter;
double m_firstObjProximity = MAX_D;
double m_secondObjProximity = MAX_D;
unsigned int maxIter = 50;
};
}
......@@ -36,7 +36,7 @@ public:
///
/// \brief Constructor
///
LinearProjectionConstraint(const size_t& nodeId, const bool isFixed = false);
explicit LinearProjectionConstraint(const size_t& nodeId, const bool isFixed = false);
LinearProjectionConstraint() = delete;
///
......
......@@ -108,7 +108,7 @@ public:
///
void printTimeElapsed(std::string const& name = std::string("noName"), const TimeUnitType unitType = TimeUnitType::milliSeconds);
private:
TimerState state;
TimerState state = TimerState::stopped;
std::vector<double> lapTimes;
std::vector<std::string> lapNames;
std::chrono::high_resolution_clock::time_point wallClockTimeKeeper; ///> time keeper for wall clock time
......@@ -145,7 +145,7 @@ public:
double getTimeElapsed(const TimeUnitType unitType = TimeUnitType::milliSeconds) override;
private:
std::clock_t cpuTimeKeeper; ///> time keeper for cpu time
std::clock_t cpuTimeKeeper = std::clock_t(); ///> time keeper for cpu time
};
///
......
......@@ -20,22 +20,20 @@
=========================================================================*/
#include "imstkLogger.h"
#include "imstkLogUtility.h"
#include <cstring>
namespace imstk
{
Logger::Logger(std::string filename)
Logger::Logger(const std::string& filename) :
m_filename(filename + "_" + this->getCurrentTimeFormatted() + ".log"),
m_thread(std::thread(Logger::eventLoop, this))
{
m_filename = filename + "_" + this->getCurrentTimeFormatted() + ".log";
m_mutex = new std::mutex();
m_thread = new std::thread(Logger::eventLoop, this);
}
Logger::~Logger()
{
delete m_mutex;
m_thread->join();
delete m_thread;
m_thread.join();
}
std::string
......@@ -85,8 +83,14 @@ Logger::eventLoop(Logger* logger)
std::ofstream file(logger->m_filename);
std::string buffer;
while (logger->m_running) {
std::unique_lock<std::mutex> ul(*logger->m_mutex);
if (!file.is_open())
{
LOG(FATAL) << "Failed to open file: " << logger->m_filename;
}
while (logger->m_running)
{
std::unique_lock<std::mutex> ul(logger->m_mutex);
logger->m_condition.wait(ul, [logger] { return logger->m_changed; });
if (!logger->m_running)
......@@ -109,7 +113,7 @@ Logger::eventLoop(Logger* logger)
}
void
Logger::log(std::string message, bool prependTime /* = false */)
Logger::log(const std::string& message, bool prependTime /* = false */)
{
m_message = "";
if (prependTime)
......@@ -120,12 +124,12 @@ Logger::log(std::string message, bool prependTime /* = false */)
// Safely setting the change state
{
std::lock_guard<std::mutex> guard(*m_mutex);
std::lock_guard<std::mutex> guard(m_mutex);
m_changed = true;
}
m_condition.notify_one();
std::unique_lock<std::mutex> ul(*m_mutex);
std::unique_lock<std::mutex> ul(m_mutex);
m_condition.wait(ul, [this] { return !m_changed; });
ul.unlock();
}
......@@ -165,13 +169,13 @@ Logger::shutdown()
{
// Safely setting the running state
{
std::lock_guard<std::mutex> guard(*m_mutex);
std::lock_guard<std::mutex> guard(m_mutex);
m_changed = true;
m_running = false;
}
m_condition.notify_one();
std::unique_lock<std::mutex> ul(*m_mutex);
std::unique_lock<std::mutex> ul(m_mutex);
m_condition.wait(ul, [this] { return !m_changed; });
ul.unlock();
}
......
......@@ -47,7 +47,7 @@ public:
/// \brief Logger instantiation method
/// \params filename this name will be used in the file name of the log file
///
Logger(std::string filename);
explicit Logger(const std::string& filename);
virtual ~Logger();
///
......@@ -56,7 +56,7 @@ public:
/// \params prependTime defines if the current time is prepended to
/// the message. Disabled by default.
///
void log(std::string message, bool prependTime = false);
void log(const std::string& message, bool prependTime = false);
///
/// \brief Sets the frequency in Hz. This also updates the period.
......@@ -102,7 +102,7 @@ private:
static std::string getCurrentTimeFormatted();
// Mutex for performance reasons
std::mutex* m_mutex;
std::mutex m_mutex;
std::string m_message;
bool m_changed = false;
bool m_running = true;
......@@ -111,8 +111,8 @@ private:
int m_period = 1000 / 30;
long long m_lastLogTime = 0;
std::string m_filename;
std::thread* m_thread;
std::string m_filename;
std::thread m_thread;
std::condition_variable m_condition;
};
}
......@@ -55,7 +55,7 @@ public:
///
/// \brief Constructor
///
Module(std::string name, int loopDelay = 0) :
Module(const std::string& name, int loopDelay = 0) :
m_name(name),
m_loopDelay(loopDelay) {}
......
......@@ -44,7 +44,7 @@ public:
///
/// \brief Constructor/destructor
///
Graph(const size_t size) { m_adjList.resize(size); }
explicit Graph(const size_t size) { m_adjList.resize(size); }
~Graph() = default;
///
......
......@@ -38,7 +38,7 @@ public:
/// \brief Construct class with search radius
/// \param radius The search radius
///
GridBasedNeighborSearch(const Real radius) : m_SearchRadius(radius), m_SearchRadiusSqr(radius * radius) {}
explicit GridBasedNeighborSearch(const Real radius) : m_SearchRadius(radius), m_SearchRadiusSqr(radius * radius) {}
///
/// \brief Set the search radius
......
......@@ -46,7 +46,7 @@ public:
/// \brief Constructor
/// \param The selected search method
///
NeighborSearch(Method searchMethod, Real searchRadius = 0);
explicit NeighborSearch(Method searchMethod, Real searchRadius = 0);
///
/// \brief Set the search radius
......
......@@ -23,10 +23,10 @@
namespace imstk
{
SpatialHashTableSeparateChaining::SpatialHashTableSeparateChaining()
: SpatialHashTable()
SpatialHashTableSeparateChaining::SpatialHashTableSeparateChaining() :
SpatialHashTable(),
m_table(std::make_shared<std::unordered_set<PointEntry>>())
{
m_table = std::make_shared<std::unordered_set<PointEntry>>();
this->clear();
}
......
......@@ -100,7 +100,7 @@ protected:
///
/// \brief Constructor
///
DeviceClient(std::string name, std::string ip) :
DeviceClient(const std::string& name, const std::string& ip) :
m_deviceName(name),
m_ip(ip)
{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment