diff --git a/Source/Collision/CollisionDetection/imstkMeshToMeshBruteForceCD.cpp b/Source/Collision/CollisionDetection/imstkMeshToMeshBruteForceCD.cpp index 14ae29baabddf4509447e30f5c387d9d62e9ed90..3a04e5b6b3eade7016df3a574b112579389b5d98 100644 --- a/Source/Collision/CollisionDetection/imstkMeshToMeshBruteForceCD.cpp +++ b/Source/Collision/CollisionDetection/imstkMeshToMeshBruteForceCD.cpp @@ -42,6 +42,7 @@ MeshToMeshBruteForceCD::MeshToMeshBruteForceCD(std::shared_ptr<Geometry> ob { } +// The above error is caused by the void MeshToMeshBruteForceCD::computeCollisionData() { @@ -80,7 +81,7 @@ MeshToMeshBruteForceCD::computeCollisionData() m_proximityTolerance, m_proximityTolerance)) { - m_colData->VTColData.safeAppend({ static_cast<unsigned int>(i), static_cast<unsigned int>(j), 0.0 }); + m_colData->VTColData.safeAppend({ static_cast<uint32_t>(i), static_cast<uint32_t>(j), 0.0 }); } } } @@ -90,7 +91,7 @@ MeshToMeshBruteForceCD::computeCollisionData() std::vector<std::vector<bool>> E2(numVertices, std::vector<bool>(numVertices, 1)); const auto triangleVertices = mesh2->getTrianglesVertices(); - for (int k = 0; k < numLines; ++k) + for (size_t k = 0; k < numLines; ++k) { const auto nodes = mesh1->getLinesVertices()[k]; const size_t i1 = nodes[0]; @@ -113,7 +114,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[0], e[1] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[0], (uint32_t)e[1] }, 0.0 }); } E2[e[0]][e[1]] = 0; } @@ -125,7 +126,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[1], e[2] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[1], (uint32_t)e[2] }, 0.0 }); } E2[e[1]][e[2]] = 0; } @@ -137,7 +138,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p2[0], p2[1], p2[2], p0[0], p0[1], p0[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[2], e[0] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[2], (uint32_t)e[0] }, 0.0 }); } E2[e[2]][e[0]] = 0; } @@ -167,7 +168,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->VTColData.safeAppend({ static_cast<unsigned int>(i), static_cast<unsigned int>(j), 0.0 }); + m_colData->VTColData.safeAppend({ static_cast<uint32_t>(i), static_cast<uint32_t>(j), 0.0 }); } } } @@ -195,7 +196,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->VTColData.safeAppend({ static_cast<unsigned int>(i), static_cast<unsigned int>(j), 0.0 }); + m_colData->VTColData.safeAppend({ static_cast<uint32_t>(i), static_cast<uint32_t>(j), 0.0 }); } } } @@ -212,8 +213,9 @@ MeshToMeshBruteForceCD::computeCollisionData() for (size_t k = 0; k < elements.size(); ++k) { const SurfaceMesh::TriangleArray& tri = elements[k]; - size_t i1 = tri[0]; - size_t i2 = tri[1]; + + size_t i1 = tri[0]; + size_t i2 = tri[1]; if (E[i1][i2] && E[i2][i1]) { @@ -234,7 +236,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[0], e[1] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[0], (uint32_t)e[1] }, 0.0 }); E2[e[0]][e[1]] = 0; } } @@ -246,7 +248,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[1], e[2] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[1], (uint32_t)e[2] }, 0.0 }); E2[e[1]][e[2]] = 0; } } @@ -258,7 +260,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p2[0], p2[1], p2[2], p0[0], p0[1], p0[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[2], e[0] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[2], (uint32_t)e[0] }, 0.0 }); E2[e[2]][e[0]] = 0; } } @@ -288,7 +290,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[0], e[1] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[0], (uint32_t)e[1] }, 0.0 }); E2[e[0]][e[1]] = 0; } } @@ -300,7 +302,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[1], e[2] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[1], (uint32_t)e[2] }, 0.0 }); E2[e[1]][e[2]] = 0; } } @@ -312,7 +314,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p2[0], p2[1], p2[2], p0[0], p0[1], p0[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[2], e[0] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[2], (uint32_t)e[0] }, 0.0 }); E2[e[2]][e[0]] = 0; } } @@ -341,7 +343,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[0], e[1] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[0], (uint32_t)e[1] }, 0.0 }); E2[e[0]][e[1]] = 0; } } @@ -353,7 +355,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[1], e[2] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[1], (uint32_t)e[2] }, 0.0 }); E2[e[1]][e[2]] = 0; } } @@ -365,7 +367,7 @@ MeshToMeshBruteForceCD::computeCollisionData() p2[0], p2[1], p2[2], p0[0], p0[1], p0[2], m_proximityTolerance, m_proximityTolerance)) { - m_colData->EEColData.safeAppend({ { i1, i2 }, { e[2], e[0] }, 0.0 }); + m_colData->EEColData.safeAppend({ { (uint32_t)i1, (uint32_t)i2 }, { (uint32_t)e[2], (uint32_t)e[0] }, 0.0 }); E2[e[2]][e[0]] = 0; } } diff --git a/Source/Collision/CollisionDetection/imstkTetraToTetraCD.cpp b/Source/Collision/CollisionDetection/imstkTetraToTetraCD.cpp index 9720f9212a87315600f069b345ab9cfa2456c9b0..d394fe0e4e5d239a383434edfdfa497d9b6a3533 100644 --- a/Source/Collision/CollisionDetection/imstkTetraToTetraCD.cpp +++ b/Source/Collision/CollisionDetection/imstkTetraToTetraCD.cpp @@ -43,7 +43,7 @@ TetraToTetraCD::TetraToTetraCD(std::shared_ptr<TetrahedralMesh> meshA, void TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<TetrahedralMesh> mesh, size_t idOffset) { - const auto eps = VERY_SMALL_EPSILON; + constexpr const auto eps = VERY_SMALL_EPSILON; const double eps2 = 1e-10; //tetrahedron belonging part of penetration type does not change @@ -97,8 +97,11 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra && bCoord[2] >= -eps && bCoord[3] >= -eps) { +#pragma warning( push ) +#pragma warning( disable : 4189 ) auto coordSum = bCoord[0] + bCoord[1] + bCoord[2] + bCoord[3]; assert(coordSum <= 1.0 + eps2 && coordSum >= 1.0 - eps2); +#pragma warning( pop ) m_colData->PTColData.safeAppend({ cType, static_cast<uint32_t>(vId), static_cast<uint32_t>(tId), bCoord }); } } //if not this tetrahedron @@ -118,4 +121,4 @@ TetraToTetraCD::computeCollisionData() this->findCollisionsForMeshWithinHashTable(m_meshA, 0); this->findCollisionsForMeshWithinHashTable(m_meshB, m_meshA->getNumVertices()); } -} +} \ No newline at end of file diff --git a/Source/Collision/imstkPbdInteractionPair.cpp b/Source/Collision/imstkPbdInteractionPair.cpp index 32f9f94596eda2b583a497482d64dd9a46bf6cec..2c7fadbb848cd950f1ed4e2df63eebd8c0997adf 100644 --- a/Source/Collision/imstkPbdInteractionPair.cpp +++ b/Source/Collision/imstkPbdInteractionPair.cpp @@ -104,9 +104,9 @@ PbdInteractionPair::doNarrowPhaseCollision() for (int k = 0; k < nL1; ++k) { - auto nodes = mesh1->getLinesVertices()[k]; - unsigned int i1 = nodes[0]; - unsigned int i2 = nodes[1]; + auto nodes = mesh1->getLinesVertices()[k]; + size_t i1 = nodes[0]; + size_t i2 = nodes[1]; const Vec3d P = mesh1->getVertexPosition(i1); const Vec3d Q = mesh1->getVertexPosition(i2); diff --git a/Source/Core/imstkMath.h b/Source/Core/imstkMath.h index f0d60ff6ca582bc93885d415ef26a7fb45faf399..7de6ed1099516d12ff9af25312f90d199a743236 100644 --- a/Source/Core/imstkMath.h +++ b/Source/Core/imstkMath.h @@ -22,7 +22,12 @@ #pragma once #include <Eigen/Geometry> + +#pragma warning( push ) +#pragma warning( disable : 4127 ) #include <Eigen/Sparse> +#pragma warning( pop ) + #include <Eigen/StdVector> #include <vector> diff --git a/Source/Devices/imstkVRPNArduinoDeviceClient.cpp b/Source/Devices/imstkVRPNArduinoDeviceClient.cpp index f0dc07aedc77c8a2f33a9091c5d33b94effd76be..b85b03ee7036ebf5fd254b7cbcbd31c5f204473d 100644 --- a/Source/Devices/imstkVRPNArduinoDeviceClient.cpp +++ b/Source/Devices/imstkVRPNArduinoDeviceClient.cpp @@ -56,6 +56,6 @@ VRPNArduinoDeviceClient::analogChangeHandler(void* userData, const _vrpn_ANALOGC //deviceClient->m_ypr << a.channel[0], a.channel[1], a.channel[2]; //deviceClient->m_accel << a.channel[3], a.channel[4], a.channel[5]; - deviceClient->m_roll = a.channel[0]; + deviceClient->m_roll = (float)a.channel[0]; } } // imstk diff --git a/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h index eda6d438dbda3a2ed6bc4e24b28dbd7b49e54f8f..e0996c9fbb55c28a94f676d1d4960d65781178b6 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h @@ -28,8 +28,11 @@ //imstk #include "imstkInternalForceModel.h" +#pragma warning( push ) +#pragma warning( disable : 4458 ) //vega #include "corotationalLinearFEM.h" +#pragma warning( pop ) namespace imstk { diff --git a/Source/DynamicalModels/InternalForceModel/imstkInternalForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkInternalForceModel.h index 08fd7b2648ff8e478eb49cec4ab30ee4953a9912..579b6de4811a3db8d85abb2b8c95926d0be9a5ea 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkInternalForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkInternalForceModel.h @@ -25,8 +25,12 @@ #include "imstkMath.h" +#pragma warning( push ) +#pragma warning( disable : 4458 ) +#pragma warning( disable : 4100 ) //vega #include "forceModel.h" +#pragma warning( pop ) namespace imstk { diff --git a/Source/DynamicalModels/InternalForceModel/imstkIsotropicHyperelasticFEMForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkIsotropicHyperelasticFEMForceModel.h index ef924f5449ab6eaac05204649ce499e8131cb328..296976ae988746416e2da9bc8aa13b18b765ddf4 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkIsotropicHyperelasticFEMForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkIsotropicHyperelasticFEMForceModel.h @@ -27,7 +27,11 @@ #include "imstkInternalForceModel.h" //vega +#pragma warning( push ) +#pragma warning( disable : 4458 ) #include "isotropicHyperelasticFEM.h" +#pragma warning( pop ) + #include "StVKIsotropicMaterial.h" #include "neoHookeanIsotropicMaterial.h" #include "MooneyRivlinIsotropicMaterial.h" diff --git a/Source/DynamicalModels/InternalForceModel/imstkLinearFEMForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkLinearFEMForceModel.h index 285092a9463508ac21f29202a3d936aa62b98bbd..a5f56293df3477aca55007e860c2342cd1d18de7 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkLinearFEMForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkLinearFEMForceModel.h @@ -88,14 +88,19 @@ public: m_stiffnessMatrix->MultiplyVector(data, internalForce.data()); } +#pragma warning( push ) +#pragma warning( disable : 4100 ) /// /// \brief Get the tangent stiffness matrix + /// \todo Clear warning C4100 /// inline void getTangentStiffnessMatrix(const Vectord& u, SparseMatrixd& tangentStiffnessMatrix) override { InternalForceModel::updateValuesFromMatrix(m_stiffnessMatrix, tangentStiffnessMatrix.valuePtr()); } +#pragma warning( pop ) + /// /// \brief Get the tangent stiffness matrix topology /// diff --git a/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h index 6aef0952dbd0d1ec5996deb11aaf1a9e5a2ad174..777a4241ba997847faea915d781e00ed650c5f7e 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h @@ -25,8 +25,11 @@ #include "imstkInternalForceModel.h" +#pragma warning( push ) +#pragma warning( disable : 4458 ) //vega #include "massSpringSystem.h" +#pragma warning( pop ) namespace imstk { diff --git a/Source/DynamicalModels/InternalForceModel/imstkStVKForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkStVKForceModel.h index 34f725eae2988b9a02f885af20dbf02018558e21..96cb82bb1e73c07fb8eadb55f92f45d3510ae4ed 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkStVKForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkStVKForceModel.h @@ -27,8 +27,12 @@ //imstk #include "imstkInternalForceModel.h" +#pragma warning( push ) +#pragma warning( disable : 4458 ) //vega #include "StVKInternalForces.h" +#pragma warning( pop ) + #include "StVKStiffnessMatrix.h" #include "StVKElementABCDLoader.h" diff --git a/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp b/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp index 4063f686670852590460024e8aebe047c23bfdac..7e7eb229ce65ac751530bbaa284a0f2540997c6a 100644 --- a/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp @@ -27,7 +27,11 @@ // vega #include "generateMassMatrix.h" #include "generateMeshGraph.h" + +#pragma warning( push ) +#pragma warning( disable : 4458 ) #include "configFile.h" +#pragma warning( pop ) namespace imstk { @@ -279,7 +283,7 @@ FEMDeformableBodyModel::initializeForceModel() const double g = m_FEModelConfig->m_gravity; const bool isGravityPresent = (g > 0) ? true : false; - m_numDOF = m_vegaPhysicsMesh->getNumVertices() * 3; + m_numDOF = (size_t)m_vegaPhysicsMesh->getNumVertices() * 3; switch (m_FEModelConfig->m_femMethod) { @@ -389,7 +393,7 @@ FEMDeformableBodyModel::initializeTangentStiffness() CHECK(m_internalForceModel) << "DeformableBodyModel::initializeTangentStiffness: Tangent stiffness cannot be initialized without force model"; - vega::SparseMatrix* matrix; + vega::SparseMatrix* matrix = nullptr; m_internalForceModel->getTangentStiffnessMatrixTopology(&matrix); CHECK(matrix) << "DeformableBodyModel::initializeTangentStiffness - Tangent stiffness matrix topology not avaliable!"; @@ -476,10 +480,10 @@ FEMDeformableBodyModel::computeSemiImplicitSystemRHS(kinematicState& state kinematicState& newState, const StateUpdateType updateType) { - auto& uPrev = stateAtT.getQ(); + //auto& uPrev = stateAtT.getQ(); auto& vPrev = stateAtT.getQDot(); auto& u = newState.getQ(); - auto& v = newState.getQDot(); + //auto& v = newState.getQDot(); // Do checks if there are uninitialized matrices m_internalForceModel->getTangentStiffnessMatrix(u, m_K); @@ -515,11 +519,15 @@ FEMDeformableBodyModel::computeImplicitSystemLHS(const kinematicState& stateAtT, kinematicState& newState, const StateUpdateType updateType) { + + const double dT = m_timeIntegrator->getTimestepSize(); switch (updateType) { case StateUpdateType::deltaVelocity: + + stateAtT;// supress warning (state is not used in this update type hence can be ignored) this->updateMassMatrix(); m_internalForceModel->getTangentStiffnessMatrix(newState.getQ(), m_K); @@ -646,10 +654,10 @@ FEMDeformableBodyModel::updateBodyIntermediateStates( const Vectord& solution, const StateUpdateType updateType) { - auto& uPrev = m_previousState->getQ(); - auto& u = m_currentState->getQ(); - auto& v = m_currentState->getQDot(); - const double dT = m_timeIntegrator->getTimestepSize(); + auto& uPrev = m_previousState->getQ(); + //auto& u = m_currentState->getQ(); + auto& v = m_currentState->getQDot(); + const double dT = m_timeIntegrator->getTimestepSize(); switch (updateType) { @@ -674,6 +682,9 @@ FEMDeformableBodyModel::updateBodyIntermediateStates( NonLinearSystem::VectorFunctionType FEMDeformableBodyModel::getFunction() { +#pragma warning( push ) +#pragma warning( disable : 4100 ) + // Function to evaluate the nonlinear objective function given the current state return [&, this](const Vectord& q, const bool semiImplicit)->const Vectord& { @@ -686,11 +697,15 @@ FEMDeformableBodyModel::getFunction() } return m_Feff; }; + +#pragma warning( pop ) } NonLinearSystem::MatrixFunctionType FEMDeformableBodyModel::getFunctionGradient() { +#pragma warning( push ) +#pragma warning( disable : 4100 ) // Gradient of the nonlinear objective function given the current state return [&, this](const Vectord& q)->const SparseMatrixd& { @@ -702,6 +717,8 @@ FEMDeformableBodyModel::getFunctionGradient() } return m_Keff; }; + +#pragma warning( pop ) } NonLinearSystem::UpdateFunctionType diff --git a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp index 0f27a22b435cea0f36096aaadb68b1f3609f4a72..ff422455e2a77c45973fb0c4d3b6b982e0655ba5 100644 --- a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp @@ -85,38 +85,39 @@ RigidBodyModel::initialize() void RigidBodyModel::createSphere() { - const auto physxMaterial = m_rigidBodyWorld->m_Physics->createMaterial(m_material->m_staticFriction, - m_material->m_dynamicFriction, - m_material->m_restitution); + const auto physxMaterial = m_rigidBodyWorld->m_Physics->createMaterial((PxReal)m_material->m_staticFriction, + (PxReal)m_material->m_dynamicFriction, + (PxReal)m_material->m_restitution); const auto physics = m_rigidBodyWorld->m_Physics; const auto PxScene = m_rigidBodyWorld->m_Scene; const auto sphereGeo = std::dynamic_pointer_cast<imstk::Sphere>(m_geometry); - auto r = sphereGeo->getRadius(); + auto r = (PxReal)sphereGeo->getRadius(); const auto p = sphereGeo->getPosition() + sphereGeo->getTranslation(); - auto trans = PxTransform(p[0], p[1], p[2]); + auto trans = PxTransform((float)p[0], (float)p[1], (float)p[2]); if (m_isStatic) { - if (m_pxStaticActor = PxCreateStatic(*physics, - trans, - PxSphereGeometry(r), - *physxMaterial)) + m_pxStaticActor = PxCreateStatic(*physics, + trans, + PxSphereGeometry(r), + *physxMaterial); + if (m_pxStaticActor) { PxScene->addActor(*m_pxStaticActor); } } else { - PxGeometry s = PxSphereGeometry(2 * r); - - if (m_pxDynamicActor = PxCreateDynamic(*physics, - trans, - s, - *physxMaterial, - 1.)) + PxGeometry s = PxSphereGeometry((PxReal)2. * r); + m_pxDynamicActor = PxCreateDynamic(*physics, + trans, + s, + *physxMaterial, + 1.); + if (m_pxDynamicActor) { PxScene->addActor(*m_pxDynamicActor); } @@ -126,9 +127,9 @@ RigidBodyModel::createSphere() void RigidBodyModel::createPlane() { - const auto physxMaterial = m_rigidBodyWorld->m_Physics->createMaterial(m_material->m_staticFriction, - m_material->m_dynamicFriction, - m_material->m_restitution); + const auto physxMaterial = m_rigidBodyWorld->m_Physics->createMaterial((PxReal)m_material->m_staticFriction, + (PxReal)m_material->m_dynamicFriction, + (PxReal)m_material->m_restitution); const auto physics = m_rigidBodyWorld->m_Physics; const auto PxScene = m_rigidBodyWorld->m_Scene; @@ -141,11 +142,13 @@ RigidBodyModel::createPlane() if (m_isStatic) { - auto plane = PxPlane(PxVec3(0., 0., 0.), PxVec3(n[0], n[1], n[2])); - if (m_pxStaticActor = PxCreateStatic(*physics, - PxTransformFromPlaneEquation(plane), - PxPlaneGeometry(), - *physxMaterial)) + auto plane = PxPlane(PxVec3(0., 0., 0.), PxVec3((float)n[0], (float)n[1], (float)n[2])); + + m_pxStaticActor = PxCreateStatic(*physics, + PxTransformFromPlaneEquation(plane), + PxPlaneGeometry(), + *physxMaterial); + if (m_pxStaticActor) { PxScene->addActor(*m_pxStaticActor); } @@ -159,39 +162,42 @@ RigidBodyModel::createPlane() void RigidBodyModel::createCube() { - const auto physxMaterial = m_rigidBodyWorld->m_Physics->createMaterial(m_material->m_staticFriction, - m_material->m_dynamicFriction, - m_material->m_restitution); + const auto physxMaterial = m_rigidBodyWorld->m_Physics->createMaterial((PxReal)m_material->m_staticFriction, + (PxReal)m_material->m_dynamicFriction, + (PxReal)m_material->m_restitution); const auto physics = m_rigidBodyWorld->m_Physics; const auto PxScene = m_rigidBodyWorld->m_Scene; const auto cubeGeo = std::dynamic_pointer_cast<imstk::Cube>(m_geometry); - auto l = cubeGeo->getWidth(); + auto l = (PxReal)cubeGeo->getWidth(); const auto p = cubeGeo->getPosition() + cubeGeo->getTranslation(); const Quatd q(cubeGeo->getRotation()); - PxTransform trans(p[0], p[1], p[2], PxQuat(q.x(), q.y(), q.z(), q.w())); + PxTransform trans((float)p[0], (float)p[1], (float)p[2], PxQuat((float)q.x(), (float)q.y(), (float)q.z(), (float)q.w())); if (m_isStatic) { - if (m_pxStaticActor = PxCreateStatic(*physics, - trans, - PxBoxGeometry(l / 2., l / 2., l / 2.), - *physxMaterial)) + m_pxStaticActor = PxCreateStatic(*physics, + trans, + PxBoxGeometry(l / (PxReal)2., l / (PxReal)2., l / (PxReal)2.), + *physxMaterial); + if (m_pxStaticActor) { PxScene->addActor(*m_pxStaticActor); } } else { - if (m_pxDynamicActor = PxCreateDynamic(*physics, - trans, - PxBoxGeometry(l / 2., l / 2., l / 2.), - *physxMaterial, - 0.1)) + m_pxDynamicActor = PxCreateDynamic(*physics, + trans, + PxBoxGeometry(l / (PxReal)2., l / (PxReal)2., l / (PxReal)2.), + *physxMaterial, + (PxReal)0.1); + + if (m_pxDynamicActor) { m_pxDynamicActor->setSleepThreshold(0); PxScene->addActor(*m_pxDynamicActor); @@ -219,26 +225,33 @@ RigidBodyModel::createMesh() for (size_t i = 0; i < numVerts; ++i) { auto v = vertData[i]; - vertices[i] = PxVec3(v.x(), v.y(), v.z()); + vertices[i] = PxVec3((float)v.x(), (float)v.y(), (float)v.z()); } for (size_t i = 0; i < numTriangles; ++i) { auto t = triVerts[i]; - indices[3 * i] = t[0]; - indices[3 * i + 1] = t[1]; - indices[3 * i + 2] = t[2]; + indices[3 * i] = (PxU32)t[0]; + indices[3 * i + 1] = (PxU32)t[1]; + indices[3 * i + 2] = (PxU32)t[2]; } - PxTriangleMesh* triMesh = createBV34TriangleMesh(numVerts, vertices, numTriangles, indices, false, false, false, 4); + PxTriangleMesh* triMesh = createBV34TriangleMesh((PxU32)numVerts, vertices, (PxU32)numTriangles, indices, false, false, false, 4); PxTransform trans(PxIdentity); - const auto physxMaterial = PxPhysics->createMaterial(m_material->m_staticFriction, m_material->m_dynamicFriction, m_material->m_restitution); + const auto physxMaterial = PxPhysics->createMaterial((PxReal)m_material->m_staticFriction, + (PxReal)m_material->m_dynamicFriction, + (PxReal)m_material->m_restitution); // Add mesh actor if (m_isStatic) { m_pxStaticActor = PxPhysics->createRigidStatic(trans); PxShape* aConvexShape = PxRigidActorExt::createExclusiveShape(*m_pxStaticActor, PxTriangleMeshGeometry(triMesh), *physxMaterial, PxShapeFlag::eSIMULATION_SHAPE); + if (!aConvexShape) + { + LOG(FATAL) << "Could not create convex shape!"; + } + PxScene->addActor(*m_pxStaticActor); } else @@ -250,6 +263,12 @@ RigidBodyModel::createMesh() } PxShape* aConvexShape = PxRigidActorExt::createExclusiveShape(*m_pxDynamicActor, PxTriangleMeshGeometry(triMesh), *physxMaterial, PxShapeFlag::eSIMULATION_SHAPE); + + if (!aConvexShape) + { + LOG(FATAL) << "Could not create convex shape!"; + } + PxScene->addActor(*m_pxDynamicActor); } } @@ -288,15 +307,23 @@ RigidBodyModel::addForce(const Vec3d& force, const Vec3d& pos, bool wakeup) { m_force += force; m_forcePos = pos; - PxRigidBodyExt::addForceAtLocalPos(*m_pxDynamicActor, physx::PxVec3(force[0], force[1], force[2]), physx::PxVec3(pos[0], pos[1], pos[2]), PxForceMode::eFORCE, wakeup); + PxRigidBodyExt::addForceAtLocalPos(*m_pxDynamicActor, + physx::PxVec3((float)force[0], (float)force[1], (float)force[2]), + physx::PxVec3((float)pos[0], (float)pos[1], (float)pos[2]), + PxForceMode::eFORCE, wakeup); } +#pragma warning( push ) +#pragma warning( disable : 4100 ) //TODO updating body states as in void RigidBodyModel::updateBodyStates(const Vectord& q, const StateUpdateType updateType /* = stateUpdateType::displacement*/) { + LOG(WARNING) << "RigidBodyModel::updateBodyStates Not implemented!"; } +#pragma warning( pop ) + void RigidBodyModel::configure(const std::shared_ptr<Geometry> geom, const std::shared_ptr<RigidBodyPropertyDesc> matProperty, diff --git a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h index 0bcf8b23fdc35fe25050960596abb01e6f1c08a3..d849241ee12d8596a7b57db0b6601a670942a6a1 100644 --- a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h +++ b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h @@ -113,7 +113,13 @@ public: /// /// \brief Set the time step size /// - void setTimeStep(const double timeStep) {} + void setTimeStep(const double timeStep) + { + if (m_rigidBodyWorld) + { + m_rigidBodyWorld->setTimeStep((float)timeStep); + } + } /// /// \brief Returns the time step size @@ -130,7 +136,7 @@ public: //auto q = Quatd(r); PxTransform pose; //pose.q = PxQuat(q.x(), q.y(), q.z(), q.w()); - pose.p = PxVec3(p.x(), p.y(), p.z()); + pose.p = PxVec3((float)p.x(), (float)p.y(), (float)p.z()); m_pxDynamicActor->setGlobalPose(pose); } diff --git a/Source/DynamicalModels/ObjectModels/imstkRigidBodyWorld.h b/Source/DynamicalModels/ObjectModels/imstkRigidBodyWorld.h index 47ecff1300fb197d74476f0800cdd369b6fd62dd..30f4e882d2284e2aebaaa788d4a20708d65373a8 100644 --- a/Source/DynamicalModels/ObjectModels/imstkRigidBodyWorld.h +++ b/Source/DynamicalModels/ObjectModels/imstkRigidBodyWorld.h @@ -83,7 +83,21 @@ public: PxScene* m_Scene = NULL; PxPvd* m_Pvd = NULL; + /// + /// \brief Set the time step for the entire physX scene + /// + void setTimeStep(const float dT) { m_timeStep = dT; }; + + /// + /// \brief Return the time step size + /// + float getTimeStep() const { return m_timeStep; } + +protected: + float m_timeStep = 1.f / 300.f; private: + + static RigidBodyWorld* m_rigidBodyWorldInstance; /// diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHKernels.h b/Source/DynamicalModels/ObjectModels/imstkSPHKernels.h index 3bc038819f4423d241c8c84bacdf4a043107c3f7..7b0030908c6dc951e14e79880563d32f94cde31d 100644 --- a/Source/DynamicalModels/ObjectModels/imstkSPHKernels.h +++ b/Source/DynamicalModels/ObjectModels/imstkSPHKernels.h @@ -50,7 +50,10 @@ public: m_radius = radius; m_radius2 = m_radius * m_radius; +#pragma warning(push) +#pragma warning(disable:4127) if (N == 2) +#pragma warning(pop) { m_k = Real(4.0) / (PI * std::pow(m_radius, 8)); m_l = -Real(24.0) / (PI * std::pow(m_radius, 8)); @@ -152,7 +155,10 @@ public: m_radius = radius; m_radius2 = m_radius * m_radius; +#pragma warning(push) +#pragma warning(disable:4127) if (N == 2) +#pragma warning(pop) { const auto radius5 = std::pow(m_radius, 5); m_k = Real(10.0) / (PI * radius5); @@ -234,7 +240,10 @@ public: m_radius = radius; m_radius2 = m_radius * m_radius; +#pragma warning(push) +#pragma warning(disable:4127) CHECK(N != 2) << "Unimplemented function"; +#pragma warning(pop) m_k = Real(32.0) / (PI * std::pow(m_radius, 9)); m_c = std::pow(m_radius, 6) / Real(64.0); diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp b/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp index 05ea0523ee68e202b3eef71df2405d8c016484b0..31e2efc2794b3d8dc1c9b83bb564550210de5673 100644 --- a/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp @@ -254,7 +254,7 @@ SPHModel::normalizeDensity() if (m_modelParameters->m_bDensityWithBoundary) { - const auto& BDNeighborList = getState().getBoundaryNeighborLists()[p]; + //const auto& BDNeighborList = getState().getBoundaryNeighborLists()[p]; #if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG) LOG_IF(FATAL, (fluidNeighborList.size() + BDNeighborList.size() != neighborInfo.size())) << "Invalid neighborInfo computation"; diff --git a/Source/Geometry/Decal/imstkDecal.cpp b/Source/Geometry/Decal/imstkDecal.cpp index 29fcb147c3a7b8ae200f6da7ffb6434e2eada575..a037fc8257da20daddfc4c0bbffd8123d07c2768 100644 --- a/Source/Geometry/Decal/imstkDecal.cpp +++ b/Source/Geometry/Decal/imstkDecal.cpp @@ -40,7 +40,7 @@ Decal::print() const double Decal::getVolume() const { - return m_dimensions.x * m_dimensions.y * m_dimensions.z; + return (double)m_dimensions.x * (double)m_dimensions.y * (double)m_dimensions.z; } void @@ -49,8 +49,11 @@ Decal::applyScaling(const double s) m_dimensions *= s; } +#pragma warning(push) +#pragma warning( disable : 4100 ) void Decal::updateDecal(glm::mat4& viewMatrix) +#pragma warning(pop) { glm::mat4 transform; diff --git a/Source/Geometry/Decal/imstkDecal.h b/Source/Geometry/Decal/imstkDecal.h index bbf872e0d9cce7f9d047071a187c5bb40a1d0a33..780bf247ebff04a2ffbfc7d530128bc9476b80e2 100644 --- a/Source/Geometry/Decal/imstkDecal.h +++ b/Source/Geometry/Decal/imstkDecal.h @@ -21,9 +21,12 @@ #pragma once +#pragma warning( push ) +#pragma warning( disable : 4201 ) #include "glm/glm.hpp" #include "glm/gtc/matrix_transform.hpp" #include "glm/gtc/quaternion.hpp" +#pragma warning( pop ) #include "imstkMath.h" #include "imstkAnalyticalGeometry.h" @@ -47,6 +50,7 @@ public: /// /// \brief Update decal transforms + /// \todo clear warning C4100 /// void updateDecal(glm::mat4& viewMatrix); diff --git a/Source/Geometry/Decal/imstkDecalPool.h b/Source/Geometry/Decal/imstkDecalPool.h index 1a2ceed70095612fbe10a3ba4145c10c14bb3714..83acdf8d571719b834143abc6f92ae120eeff203 100644 --- a/Source/Geometry/Decal/imstkDecalPool.h +++ b/Source/Geometry/Decal/imstkDecalPool.h @@ -58,9 +58,12 @@ protected: std::deque<std::shared_ptr<Decal>> m_orderedDecals; std::deque<std::shared_ptr<Decal>> m_freeDecals; +#pragma warning( push ) +#pragma warning( disable : 4100 ) void applyTranslation(const Vec3d t) override {} void applyRotation(const Mat3d r) override {} void applyScaling(const double s) override {} +#pragma warning( push ) virtual void updatePostTransformData() const override {} unsigned int m_maxNumDecals; diff --git a/Source/Geometry/Mesh/imstkSurfaceMesh.cpp b/Source/Geometry/Mesh/imstkSurfaceMesh.cpp index 01fdbca079974756fa8f3d38be09904b1d016dcf..4cf59846585bd02e82179b9ee3e23b75f571bd84 100644 --- a/Source/Geometry/Mesh/imstkSurfaceMesh.cpp +++ b/Source/Geometry/Mesh/imstkSurfaceMesh.cpp @@ -149,7 +149,7 @@ SurfaceMesh::computeTrianglesNormals() } bool hasUVs = this->hasPointDataArray(m_defaultTCoords); - const StdVectorOfVectorf* UVs; + const StdVectorOfVectorf* UVs = nullptr; if (hasUVs) { @@ -258,14 +258,14 @@ SurfaceMesh::optimizeForDataLocality() // First find the list of triangles a given vertex is part of std::vector<std::vector<size_t>> vertexNeighbors; vertexNeighbors.resize(this->getNumVertices()); - size_t triId = 0; + size_t triangleId = 0; for (const auto& tri : this->getTrianglesVertices()) { - vertexNeighbors[tri[0]].push_back(triId); - vertexNeighbors[tri[1]].push_back(triId); - vertexNeighbors[tri[2]].push_back(triId); + vertexNeighbors[tri[0]].push_back(triangleId); + vertexNeighbors[tri[1]].push_back(triangleId); + vertexNeighbors[tri[2]].push_back(triangleId); - triId++; + triangleId++; } std::vector<TriangleArray> optimizedConnectivity; @@ -637,11 +637,11 @@ SurfaceMesh::markPointsInsideAndOut(const StdVectorOfVec3d& coords) auto intersectTriangle = [](const Vec3d& xyz, const Vec3d& xyz0, const Vec3d& xyz1, const Vec3d& xyz2, const Vec3d& dir) { // const double eps = 1e-15; - const double eps = std::numeric_limits<double>::epsilon(); - Vec3d edge0 = xyz1 - xyz0; - Vec3d edge1 = xyz2 - xyz0; - Vec3d pvec = dir.cross(edge1); - double det = edge0.dot(pvec); + constexpr const double eps = std::numeric_limits<double>::epsilon(); + Vec3d edge0 = xyz1 - xyz0; + Vec3d edge1 = xyz2 - xyz0; + Vec3d pvec = dir.cross(edge1); + double det = edge0.dot(pvec); if (det > -eps && det < eps) { diff --git a/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp b/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp index f0aa462fe57d3d6a31c5ef7763d97a8097f316cd..c05812d25a412bff6c6311f9ca098733a5b7ee9b 100644 --- a/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp +++ b/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp @@ -152,7 +152,7 @@ TetrahedralMesh::extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh, { surfaceTri.push_back(triArray { { a, b, c } }); surfaceTriTet.push_back(tetId); - tetRemainingVert.push_back(3 - t); + tetRemainingVert.push_back((size_t)(3 - t)); } else { @@ -460,9 +460,9 @@ TetrahedralMesh::createTetrahedralMeshCover(std::shared_ptr<SurfaceMesh> surfMes { const auto& xyz = surfMesh->getVertexPosition(i); // find the hex that encloses the point; - size_t idX = (xyz[0] - aabbMin[0]) / h[0]; - size_t idY = (xyz[1] - aabbMin[1]) / h[1]; - size_t idZ = (xyz[2] - aabbMin[2]) / h[2]; + size_t idX = (size_t)((xyz[0] - aabbMin[0]) / h[0]); + size_t idY = (size_t)((xyz[1] - aabbMin[1]) / h[1]); + size_t idZ = (size_t)((xyz[2] - aabbMin[2]) / h[2]); size_t hexId = idX + idY * nx + idZ * nx * ny; // the index range of tets inside the enclosing hex diff --git a/Source/Geometry/Mesh/imstkVolumetricMesh.h b/Source/Geometry/Mesh/imstkVolumetricMesh.h index 4c2e15dab4e39c4a2850f0f59a46dddf266358e3..ec274ffe7e76a5f212d2d764ebe1365d92bd2e1d 100644 --- a/Source/Geometry/Mesh/imstkVolumetricMesh.h +++ b/Source/Geometry/Mesh/imstkVolumetricMesh.h @@ -26,8 +26,11 @@ #include "imstkPointSet.h" #include "imstkSurfaceMesh.h" +#pragma warning( push ) +#pragma warning( disable : 4458 ) // Vega #include "volumetricMesh.h" +#pragma warning( pop ) namespace imstk { diff --git a/Source/Geometry/Particles/imstkRenderParticles.h b/Source/Geometry/Particles/imstkRenderParticles.h index 923c41fb5de64de75669fe6b1e798e297e29f7b9..6f4b6980bb12f0311f99b47ae1561815f83b4e03 100644 --- a/Source/Geometry/Particles/imstkRenderParticles.h +++ b/Source/Geometry/Particles/imstkRenderParticles.h @@ -25,7 +25,10 @@ #include <climits> #include <memory> +#pragma warning( push ) +#pragma warning( disable : 4201 ) #include "glm/glm.hpp" +#pragma warning( pop ) #include "imstkGeometry.h" #include "imstkMath.h" @@ -124,9 +127,13 @@ protected: glm::vec2 m_vertexUVs[4]; glm::ivec3 m_triangles[2]; - void applyTranslation(const Vec3d t) override {} - void applyRotation(const Mat3d r) override {} - void applyScaling(const double s) override {} +#pragma warning( push ) +#pragma warning( disable : 4100 ) + void applyTranslation(const Vec3d t) override { LOG(WARNING) << "applyTranslation Not implemented!";} + void applyRotation(const Mat3d r) override { LOG(WARNING) << "applyRotation Not implemented!"; } + void applyScaling(const double s) override { LOG(WARNING) << "applyScaling Not implemented!"; } +#pragma warning( pop ) + virtual void updatePostTransformData() const override {} }; } diff --git a/Source/Geometry/Reader/imstkMSHMeshIO.cpp b/Source/Geometry/Reader/imstkMSHMeshIO.cpp index 6376fda639a8608413d477ae2184e0e62cd2eaef..a2480cff4c43337875c6caea450d378aed68cc42 100644 --- a/Source/Geometry/Reader/imstkMSHMeshIO.cpp +++ b/Source/Geometry/Reader/imstkMSHMeshIO.cpp @@ -41,18 +41,18 @@ MSHMeshIO::read(const std::string& filePath, const MeshFileType meshType) // based on the format provided on // http://www.manpagez.com/info/gmsh/gmsh-2.2.6/gmsh_63.php - size_t nNodes; // number-of-nodes - size_t nElements; // number-of-elements - std::vector<size_t> nodeIDs; // number assigned to each node (node number) - StdVectorOfVec3d nodesCoords; // nodes coordinates - std::vector<size_t> tetrahedronIDs; // tet elements IDs - std::vector<size_t> hexahedronIDs; // hex elements IDs - std::vector<TetrahedralMesh::TetraArray> tetrahedronConnectivity; // tet element connectivity - std::vector<HexahedralMesh::HexaArray> hexahedronConnectivity; // hex element connectivity - std::map<ElemType, size_t> elemCountMap; // map of the element types to their number of counts - std::string subString; // to store space separated strings in a line - std::string mshLine; // a msh file line - std::stringstream mshLineStream; // sting stream object which represent a line in the .msh file + size_t nNodes = 0; // number-of-nodes + size_t nElements = 0; // number-of-elements + std::vector<size_t> nodeIDs; // number assigned to each node (node number) + StdVectorOfVec3d nodesCoords; // nodes coordinates + std::vector<size_t> tetrahedronIDs; // tet elements IDs + std::vector<size_t> hexahedronIDs; // hex elements IDs + std::vector<TetrahedralMesh::TetraArray> tetrahedronConnectivity; // tet element connectivity + std::vector<HexahedralMesh::HexaArray> hexahedronConnectivity; // hex element connectivity + std::map<ElemType, size_t> elemCountMap; // map of the element types to their number of counts + std::string subString; // to store space separated strings in a line + std::string mshLine; // a msh file line + std::stringstream mshLineStream; // sting stream object which represent a line in the .msh file // Open the file std::ifstream mshStream(filePath); @@ -252,8 +252,8 @@ MSHMeshIO::read(const std::string& filePath, const MeshFileType meshType) hexahedronConnectivity.resize(elemCountMap[ElemType::hexahedron]); size_t tetElemCount = 0; size_t hexElemCount = 0; - TetrahedralMesh::TetraArray tmp_4arr; // Temp array to store the connectivity of a tet element (if any) - HexahedralMesh::HexaArray tmp_8arr; // Temp array to store the connectivity of a hex element (if any) + TetrahedralMesh::TetraArray tmp_4arr = {}; // Temp array to store the connectivity of a tet element (if any) + HexahedralMesh::HexaArray tmp_8arr = {}; // Temp array to store the connectivity of a hex element (if any) // Look for "$Elements" field mshStream.clear(); mshStream.seekg(0, std::ios::beg); diff --git a/Source/Geometry/Reader/imstkVTKMeshIO.cpp b/Source/Geometry/Reader/imstkVTKMeshIO.cpp index f8b9ec312868035d123effba2c146ef142d30522..99994fde02fd94e46fd9a19deaa60e11e69c197d 100644 --- a/Source/Geometry/Reader/imstkVTKMeshIO.cpp +++ b/Source/Geometry/Reader/imstkVTKMeshIO.cpp @@ -163,15 +163,14 @@ VTKMeshIO::readVtkGenericFormatData(const std::string& filePath) { return GeometryUtils::convertVtkPolyDataToSurfaceMesh(vtkMesh); } - else if (vtkUnstructuredGrid* vtkMesh = reader->GetUnstructuredGridOutput()) + + if (vtkUnstructuredGrid* vtkMesh = reader->GetUnstructuredGridOutput()) { return GeometryUtils::convertVtkUnstructuredGridToVolumetricMesh(vtkMesh); } - else - { - LOG(FATAL) << "VTKMeshIO::readVtkGenericFormatData error: could not read with VTK reader."; - return nullptr; - } + + LOG(FATAL) << "VTKMeshIO::readVtkGenericFormatData error: could not read with VTK reader."; + return nullptr; } template<typename ReaderType> diff --git a/Source/Geometry/imstkGeometry.cpp b/Source/Geometry/imstkGeometry.cpp index 2444e2696d5e14109f6381ce7f2791601687fa70..b03022d1697b224a03cdc00f659482f5153d41bd 100644 --- a/Source/Geometry/imstkGeometry.cpp +++ b/Source/Geometry/imstkGeometry.cpp @@ -258,8 +258,10 @@ Geometry::getTypeName() const case Type::DecalPool: return "DecalPool"; case Type::RenderParticles: return "RenderParticles"; case Type::ImageData: return "ImageData"; + default: + LOG(FATAL) << "Mesh type to string has not been completely implemented"; + return ""; } - LOG(FATAL) << "Mesh type to string has not been completely implemented"; } bool diff --git a/Source/Geometry/imstkGeometry.h b/Source/Geometry/imstkGeometry.h index 1f30549765faacb4460c3ba1f5f8d83d2b934af8..fc9c0993c012b9a769dd7481b71b1e56559f84cf 100644 --- a/Source/Geometry/imstkGeometry.h +++ b/Source/Geometry/imstkGeometry.h @@ -205,7 +205,7 @@ protected: virtual void applyTranslation(const Vec3d t) = 0; virtual void applyRotation(const Mat3d r) = 0; virtual void applyScaling(const double s) = 0; - virtual void updatePostTransformData() const const = 0; + virtual void updatePostTransformData() const = 0; Type m_type; ///> Type of geometry std::string m_name; ///> Unique name for each geometry diff --git a/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp b/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp index 0a85019246ae8665d16199984351ccf6ebe44446..51e8711b8bf27403c3cc70094dff3507896d4b88 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp +++ b/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp @@ -85,10 +85,5 @@ Widget::isVisible() { return m_visible; } - -void -Widget::render(const bool inWindow) -{ -} } // GUI } // imstk diff --git a/Source/Rendering/GUIOverlay/imstkGUIWidget.h b/Source/Rendering/GUIOverlay/imstkGUIWidget.h index a1d2706c4c122de8cc07bcd2faa3fa26a5071d10..75f425a5e01187ad3973dd58102cb5fbb9ffddf7 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWidget.h +++ b/Source/Rendering/GUIOverlay/imstkGUIWidget.h @@ -98,7 +98,7 @@ public: /// /// \brief Render /// - virtual void render(const bool inWindow = false); + virtual void render(const bool inWindow = false)=0; protected: Widget() = delete; diff --git a/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp b/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp index e34f0ac08f2c9738bce1a1f6c3a1c45e82c2f7cd..ab5b6b8c52cfcde208225a76022dbce7dc4f5357 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp +++ b/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp @@ -50,8 +50,12 @@ Window::clear() m_widgets.clear(); } +#pragma warning(push) +#pragma warning( disable : 4100 ) +/// \todo clear C4100 void Window::render(const bool inWindow) +#pragma warning(pop) { ImGui::SetNextWindowPos(ImVec2(m_position[0], m_position[1])); ImGui::SetNextWindowSize(ImVec2(m_width, m_height)); diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.cpp b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.cpp index b36b12e1a20f816eb949263c2132df3bedc16805..4947eeee17582d1e307e543ea5cf7e6cd2f69386 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.cpp +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.cpp @@ -30,7 +30,7 @@ VTKCylinderRenderDelegate::VTKCylinderRenderDelegate(std::shared_ptr<VisualModel auto geometry = std::static_pointer_cast<Cylinder>(visualModel->getGeometry()); - Geometry::DataType type = Geometry::DataType::PreTransform; + //Geometry::DataType type = Geometry::DataType::PreTransform; cylinderSource = vtkSmartPointer<vtkCylinderSource>::New(); cylinderSource->SetCenter(0., 0., 0.); cylinderSource->SetRadius(1.); diff --git a/Source/Rendering/imstkRenderer.cpp b/Source/Rendering/imstkRenderer.cpp index 5c3bd5a60bfbe6b604da4d51f85c1b9b48f4b23c..1a21d84bc50086e1262370b69f0c3d773d2a23ef 100644 --- a/Source/Rendering/imstkRenderer.cpp +++ b/Source/Rendering/imstkRenderer.cpp @@ -26,6 +26,7 @@ namespace imstk void Renderer::setMode(const Renderer::Mode mode, const bool enableVR) { + m_VrEnabled = enableVR; m_currentMode = mode; } diff --git a/Source/Rendering/imstkRenderer.h b/Source/Rendering/imstkRenderer.h index b34ed8574cd85c7d50bf2764728df0ad104ae59b..6d8f9338cfe5a2b18c7440a4ab4e113ba1f2eaf3 100644 --- a/Source/Rendering/imstkRenderer.h +++ b/Source/Rendering/imstkRenderer.h @@ -34,7 +34,7 @@ public: /// /// \brief Enumerations for the render mode /// - enum Mode + enum class Mode { EMPTY, DEBUG, @@ -57,6 +57,7 @@ public: virtual void updateBackground(const Vec3d color1, const Vec3d color2 = Vec3d::Zero(), const bool gradientBackground = false) = 0; protected: + bool m_VrEnabled = false; Renderer::Mode m_currentMode = Renderer::Mode::EMPTY; }; } diff --git a/Source/Rendering/vtkCapsuleSource.cpp b/Source/Rendering/vtkCapsuleSource.cpp index c28b98256471cd06ec470a9b5705d1c52ed610ba..db6a43ae0c0476feb2fb67be0213698a59810e6a 100644 --- a/Source/Rendering/vtkCapsuleSource.cpp +++ b/Source/Rendering/vtkCapsuleSource.cpp @@ -402,12 +402,15 @@ vtkCapsuleSource::PrintSelf(ostream& os, vtkIndent indent) } //---------------------------------------------------------------------------- +#pragma warning(push) +#pragma warning(disable : 4100) int vtkCapsuleSource::RequestInformation( vtkInformation* vtkNotUsed(request), vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector) { + std::cout << "WARNING-vtkCapsuleSource::RequestInformation is not implemented!" << std::endl; // get the info object /*vtkInformation *outInfo = outputVector->GetInformationObject(0); @@ -425,3 +428,5 @@ vtkCapsuleSource::RequestInformation( return 1; } + +#pragma warning(pop) diff --git a/Source/Scene/imstkScene.cpp b/Source/Scene/imstkScene.cpp index e3bd72fbeff62992d82c2a18171803987e5cb04d..8f18f1377c2af347d2deea8684b6cd0a31b164c1 100644 --- a/Source/Scene/imstkScene.cpp +++ b/Source/Scene/imstkScene.cpp @@ -364,7 +364,7 @@ Scene::advance(const double dt) { // PhysX update; move this to solver auto physxScene = RigidBodyWorld::getInstance()->m_Scene; - physxScene->simulate(1.0f / 300.0f); // TODO: update the time step + physxScene->simulate(RigidBodyWorld::getInstance()->getTimeStep()); // TODO: update the time step physxScene->fetchResults(true); // Reset Contact forces to 0 diff --git a/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.cpp b/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.cpp index 4c39e35b17cafb6d497db5ad2fc89e5620a31727..45f42ec848139d50c54e54bf004caa7f34bbc0ff 100644 --- a/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.cpp +++ b/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.cpp @@ -35,6 +35,11 @@ OpenVRCommand::Execute( unsigned long eventId, void* callData) { + /// \todo Clear warnings caller, callData are not used! + // prevent warnings + caller; + callData; + if (!m_simManager) { return; @@ -125,7 +130,7 @@ OpenVRCommand::Execute( // override DoOneEvent() by calling itself and then updateRenderDelegates() if (eventId == vtkCommand::StartEvent) { - SimulationStatus status = m_simManager->getStatus(); + //SimulationStatus status = m_simManager->getStatus(); #ifndef iMSTK_USE_Vulkan std::dynamic_pointer_cast<VTKRenderer>(m_simManager->getViewer()->getActiveRenderer())->updateRenderDelegates(); @@ -133,7 +138,7 @@ OpenVRCommand::Execute( } else { - int a = eventId; + //int a = eventId; } } } // imstk diff --git a/Source/SimulationManager/imstkViewer.cpp b/Source/SimulationManager/imstkViewer.cpp index 18c7be2727c5525ff923d46e4f097e9004818eb5..690953f737748cd900606db28ae0e9c6a3379ee0 100644 --- a/Source/SimulationManager/imstkViewer.cpp +++ b/Source/SimulationManager/imstkViewer.cpp @@ -32,14 +32,9 @@ Viewer::getActiveScene() const const std::shared_ptr<Renderer>& Viewer::getActiveRenderer() const { - if (m_activeScene) - { - return m_rendererMap.at(m_activeScene); - } - else - { - return nullptr; - } + CHECK(m_activeScene) << "no active scene!"; + + return m_rendererMap.at(m_activeScene); } const bool& diff --git a/Source/Solvers/imstkConjugateGradient.h b/Source/Solvers/imstkConjugateGradient.h index dc190c5f8770221b1f7c69b6ef274eb927981f35..357e02e88f0b88f237d50cb9af3ce9d6a06091cd 100644 --- a/Source/Solvers/imstkConjugateGradient.h +++ b/Source/Solvers/imstkConjugateGradient.h @@ -54,7 +54,7 @@ public: /// /// \brief Do one iteration of the method. /// - void iterate(Vectord& x, bool updateResidual = true) override {}; + //void iterate(Vectord& x, bool updateResidual = true) override {}; /// /// \brief Solve the system of equations. diff --git a/Source/Solvers/imstkDirectLinearSolver.h b/Source/Solvers/imstkDirectLinearSolver.h index fb82df0d2fb96702af3f1b60e0a4571f7bec3abc..b3d70a0b245333ad552162b7916791885a2468ef 100644 --- a/Source/Solvers/imstkDirectLinearSolver.h +++ b/Source/Solvers/imstkDirectLinearSolver.h @@ -21,8 +21,11 @@ #pragma once +#pragma warning( push ) +#pragma warning( disable : 4127 ) #include <Eigen/Sparse> #include <Eigen/SparseLU> +#pragma warning( pop ) // iMSTK includes #include "imstkLinearSolver.h" diff --git a/Source/Solvers/imstkGaussSeidel.h b/Source/Solvers/imstkGaussSeidel.h index 0def124314ec17bc174f201e143cf39f9d47dd07..875338f37e9759c7d43927b856658291292bb783 100644 --- a/Source/Solvers/imstkGaussSeidel.h +++ b/Source/Solvers/imstkGaussSeidel.h @@ -54,7 +54,7 @@ public: /// /// \brief Do one iteration of the method. /// - void iterate(Vectord& x, bool updateResidual = true) override {}; + //void iterate(Vectord& x, bool updateResidual = true) override {}; /// /// \brief Gauss-Seidel solver diff --git a/Source/Solvers/imstkIterativeLinearSolver.cpp b/Source/Solvers/imstkIterativeLinearSolver.cpp index 4d3751abcfb3611e654f089e4ba683799c784fd4..ab6f3bec3cc1d2b82c4773f165a0407db6f6c514 100644 --- a/Source/Solvers/imstkIterativeLinearSolver.cpp +++ b/Source/Solvers/imstkIterativeLinearSolver.cpp @@ -64,9 +64,13 @@ IterativeLinearSolver::print() const LOG(INFO) << "Solver type (direct/iterative): Iterative"; } + void IterativeLinearSolver::solve(Vectord& x) { + LOG(WARNING) << "IterativeLinearSolver::solve is not implemented!"; + x; + /* if (!m_linearSystem) { LOG(WARNING) << "IterativeLinearSolver::solve: The linear system should be assigned before solving!"; @@ -85,5 +89,6 @@ IterativeLinearSolver::solve(Vectord& x) this->iterate(x); } + */ } } //imstk \ No newline at end of file diff --git a/Source/Solvers/imstkIterativeLinearSolver.h b/Source/Solvers/imstkIterativeLinearSolver.h index 67b928df275aae2fc86faf509f03ea4b1245e83b..abd69933df28673600c26c2ebae4c2bb8cda3cd1 100644 --- a/Source/Solvers/imstkIterativeLinearSolver.h +++ b/Source/Solvers/imstkIterativeLinearSolver.h @@ -41,7 +41,7 @@ public: /// /// \brief Do one iteration of the method. /// - virtual void iterate(Vectord& x, bool updateResidual = true) = 0; + //virtual void iterate(Vectord& x, bool updateResidual = true) = 0; /// /// \brief set/get the maximum number of iterations for the iterative solver. @@ -68,7 +68,7 @@ public: /// /// \brief Solve the linear system using Gauss-Seidel iterations. /// - virtual void solve(Vectord& x) override; + virtual void solve(Vectord& x); /// /// \brief Returns true if the solver is iterative diff --git a/Source/Solvers/imstkJacobi.h b/Source/Solvers/imstkJacobi.h index 588cd5935c2ccfbbe2efc7554915fb87eba70087..22a76b792a26c807f927dfef7e44821803e9d6a1 100644 --- a/Source/Solvers/imstkJacobi.h +++ b/Source/Solvers/imstkJacobi.h @@ -54,7 +54,7 @@ public: /// /// \brief Do one iteration of the method. /// - void iterate(Vectord& x, bool updateResidual = true) override {}; + //void iterate(Vectord& x, bool updateResidual = true) override {}; /// /// \brief Jacobi solver @@ -131,7 +131,7 @@ public: private: - std::vector<LinearProjectionConstraint>* m_FixedLinearProjConstraints; - std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints; + std::vector<LinearProjectionConstraint>* m_FixedLinearProjConstraints = nullptr; + std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints = nullptr; }; } // imstk diff --git a/Source/Solvers/imstkNewtonSolver.cpp b/Source/Solvers/imstkNewtonSolver.cpp index ee0972d62d48d3ad9875b34aa405de8a8c707622..b3468f991d559c0678a9ce71d31a942764a0af5f 100644 --- a/Source/Solvers/imstkNewtonSolver.cpp +++ b/Source/Solvers/imstkNewtonSolver.cpp @@ -97,7 +97,7 @@ NewtonSolver::solve() auto& u = m_nonLinearSystem->getUnknownVector(); Vectord du = u; // make this a class member in future - double error0, error; + double error0 = MAX_D, error = MAX_D; double epsilon = m_relativeTolerance * m_relativeTolerance; for (iterNum = 0; iterNum < m_maxIterations; ++iterNum) { diff --git a/Source/Solvers/imstkNewtonSolver.h b/Source/Solvers/imstkNewtonSolver.h index 3cce604f281fe8e6ec1c0777db796dca5c898e1f..047f58392e255641d9034d534b8a4d69fc9c677d 100644 --- a/Source/Solvers/imstkNewtonSolver.h +++ b/Source/Solvers/imstkNewtonSolver.h @@ -191,10 +191,9 @@ public: /// /// \brief Set the Newton solver to be fully implicit /// - virtual void setToFullyImplicit(const int maxNumIter = 50) override + virtual void setToFullyImplicit() override { m_isSemiImplicit = false; - m_maxIterations = maxNumIter; } /// diff --git a/Source/Solvers/imstkNonLinearSolver.h b/Source/Solvers/imstkNonLinearSolver.h index 34b498cd589247e15a62e4dc11847732d40afafa..3de7c1b4fae6784f7874007d7e18262f6443ee36 100644 --- a/Source/Solvers/imstkNonLinearSolver.h +++ b/Source/Solvers/imstkNonLinearSolver.h @@ -118,7 +118,7 @@ public: /// /// \brief Set the Newton solver to be fully implicit /// - virtual void setToFullyImplicit(const int maxNumIter = 50) + virtual void setToFullyImplicit() { m_isSemiImplicit = false; } diff --git a/Source/Solvers/imstkSOR.h b/Source/Solvers/imstkSOR.h index e9ab1a00f5243fbbebad1727d93788a70695a64a..25f049239578a667e379a70ffbf0930f43ebe15d 100644 --- a/Source/Solvers/imstkSOR.h +++ b/Source/Solvers/imstkSOR.h @@ -41,7 +41,7 @@ public: /// /// \brief Constructors/Destructor /// - SOR(const double relaxationFactor = 0.5) { m_type = Type::SuccessiveOverRelaxation; }; + SOR(const double relaxationFactor = 0.5) : m_relaxationFactor(relaxationFactor) { m_type = Type::SuccessiveOverRelaxation; }; SOR(const SparseMatrixd& A, const Vectord& rhs); ~SOR() = default; @@ -54,7 +54,7 @@ public: /// /// \brief Do one iteration of the method. /// - void iterate(Vectord& x, bool updateResidual = true) override {}; + //void iterate(Vectord& x, bool updateResidual = true) override {}; /// /// \brief Gauss-Seidel solver @@ -137,7 +137,7 @@ public: private: double m_relaxationFactor = 0.5; - std::vector<LinearProjectionConstraint>* m_FixedLinearProjConstraints; - std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints; + std::vector<LinearProjectionConstraint>* m_FixedLinearProjConstraints = nullptr; + std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints = nullptr; }; } // imstk diff --git a/Source/apiUtilities/imstkPlotterUtils.h b/Source/apiUtilities/imstkPlotterUtils.h index 64d3fabece1a5723bd03a781b1d083ffd017b0b9..367d3c37c227588176f4702ef5d90fafd048e332 100644 --- a/Source/apiUtilities/imstkPlotterUtils.h +++ b/Source/apiUtilities/imstkPlotterUtils.h @@ -29,6 +29,8 @@ #include "imstkMath.h" #include "g3log/g3log.hpp" +#pragma warning( push ) +#pragma warning( disable : 4505 ) // Warning C4505 will vanish upon calls to the following functions namespace imstk { namespace plotterutils @@ -169,3 +171,5 @@ writePlotterVecVsVecMatPlotlib(Vectord& x, Vectord& y, const char* fileName) } } // plotters } // imstk + +#pragma warning( pop )