diff --git a/CMake/External/CMakeLists.txt b/CMake/External/CMakeLists.txt index c6b4108f4e9e31ce6311f33b4a97c13148f5193e..e658e3880847551a41eb101aeb1ad11befa85706 100644 --- a/CMake/External/CMakeLists.txt +++ b/CMake/External/CMakeLists.txt @@ -100,6 +100,7 @@ ExternalProject_Add( ${PROJECT_NAME} -D${PROJECT_NAME}_USE_VRPN:BOOL=${${PROJECT_NAME}_USE_VRPN} -D${PROJECT_NAME}_COLOR_OUTPUT:BOOL=${${PROJECT_NAME}_COLOR_OUTPUT} -D${PROJECT_NAME}_USE_VTK_OSMESA:BOOL=${${PROJECT_NAME}_USE_VTK_OSMESA} + -D${PROJECT_NAME}_COVERAGE:BOOL=${${PROJECT_NAME}_COVERAGE} # External Libraries -DEigen3_DIR:PATH=${Eigen3_DIR} -DGTest_DIR:PATH=${GTest_DIR} diff --git a/CMake/Utilities/imstkAddExecutable.cmake b/CMake/Utilities/imstkAddExecutable.cmake index 46aa3876c380f34d4d857784647da7d4da8fa8d7..18b7c7af4001d65b28c2deec66ee3a254410d71b 100644 --- a/CMake/Utilities/imstkAddExecutable.cmake +++ b/CMake/Utilities/imstkAddExecutable.cmake @@ -15,13 +15,13 @@ macro(imstk_add_executable target) $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: -Wall -Wno-unused-function -fdiagnostics-color=always> $<$<CXX_COMPILER_ID:MSVC>: - -W4 -MP -wd4505>) + -W4 -MP -wd4505 /bigobj /permissive->) else() target_compile_options(${target} PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: -Wall -Wno-unused-function> $<$<CXX_COMPILER_ID:MSVC>: - -W4 -MP -wd4505 /bigobj>) + -W4 -MP -wd4505 /bigobj /permissive->) endif() set_target_properties(${target} PROPERTIES diff --git a/CMakeLists.txt b/CMakeLists.txt index eef86fa2cb897f8b9e1a92b54d1e55bab0e7e688..58c7030918f8a11e142e7c88f492b2a8f9b53799 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,13 +91,15 @@ endif () if (UNIX) option(${PROJECT_NAME}_USE_MODEL_REDUCTION "Build with model reduction, requires a VegaFEM built with Intel MKL and arpack" OFF) option(${PROJECT_NAME}_COLOR_OUTPUT "For coloring output in gcc" OFF) + option(${PROJECT_NAME}_COVERAGE "Build for calculating coverage" OFF) + option(${PROJECT_NAME}_USE_VTK_OSMESA "Build with VTK OSMesa rendering" OFF) + + if (${PROJECT_NAME}_COVERAGE AND NOT ${CMAKE_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg]) + message(WARNING "Coverage requires a debug build forcing debug") + set(CMAKE_BUILD_TYPE "DEBUG") + endif() endif() option(${PROJECT_NAME}_USE_VRPN "Build with VRPN support" OFF) -option(${PROJECT_NAME}_USE_VTK_OSMESA "Build with VTK OSMesa rendering" OFF) -if (${${PROJECT_NAME}_USE_VTK_OSMESA} AND NOT UNIX) - message(WARNING "OSMesa only works on unix, building without") - set(${PROJECT_NAME}_USE_VTK_OSMESA FALSE CACHE BOOL "Build with VTK OSMesa rendering" FORCE) -endif() #----------------------------------------------------------------------------- # CTest/Dashboards @@ -301,18 +303,35 @@ endif() include(imstkAddExecutable) # Uncrustify find_program(Uncrustify_EXECUTABLE uncrustify) -include(SetupUncrustifyConfig) +# include(SetupUncrustifyConfig) if(Uncrustify_EXECUTABLE) include(imstkAddUncrustifyCustomTarget) else(Uncrustify_EXECUTABLE) message(WARNING "uncrustify not found! Cannot run code-style test.") endif(Uncrustify_EXECUTABLE) -# Google Test +#----------------------------------------------------------------------------- +# Testing +#---------------------------------------------------------------------- if(${PROJECT_NAME}_BUILD_TESTING) find_package( GTest REQUIRED NO_DEFAULT_PATH) endif() +#----------------------------------------------------------------------------- +# Code Coverage +#---------------------------------------------------------------------- +if(${PROJECT_NAME}_COVERAGE) + # Note HS Had to add ALL in setup_target_for_coverage to force the code coverage pass + set(CODE_COVERAGE_VERBOSE ON) + include(CodeCoverage) + append_coverage_compiler_flags() + setup_target_for_coverage_lcov( + NAME Coverage + EXECUTABLE ctest -E "(CodeFormatTest|RenderTest.*)" + EXCLUDE "${CMAKE_BINARY_DIR}/../install/include/*" "/usr/*" "*/Testing/*" + ) +endif() + #----------------------------------------------------------------------------- # Download the external data needed for both testing and examples #----------------------------------------------------------------------------- diff --git a/Examples/RCM/bandwidth.h b/Examples/RCM/bandwidth.h index 52a1a7d2e0a01a7e0ee88447bbfc8b8bcf95ae9c..c3e0265881e3a078b7c2fa75ed4cbac068398c2e 100644 --- a/Examples/RCM/bandwidth.h +++ b/Examples/RCM/bandwidth.h @@ -23,6 +23,7 @@ #include <vector> #include <unordered_set> +#include <algorithm> /// /// \brief Build the vertex-to-vertex connectivity of a map diff --git a/Source/CollisionDetection/CollisionDetection/imstkTetraToTetraCD.cpp b/Source/CollisionDetection/CollisionDetection/imstkTetraToTetraCD.cpp index 5b0436e593d643acf666f6c3b3e4679e567d02bd..533c75fbc7672a1a40a5b45eddca907804b4733c 100644 --- a/Source/CollisionDetection/CollisionDetection/imstkTetraToTetraCD.cpp +++ b/Source/CollisionDetection/CollisionDetection/imstkTetraToTetraCD.cpp @@ -62,7 +62,7 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra if (collP.size() > 4) { - for (size_t vId : collP) + for (int vId : collP) { //vertex does not belong to this tetrahedron if (vId != vInd[0] diff --git a/Source/CollisionDetection/Testing/imstkOctreeBasedCDTest.cpp b/Source/CollisionDetection/Testing/imstkOctreeBasedCDTest.cpp index 13ee203fada1a8f15f0f7e47cf5a60786616789b..bf6846dfc5a0c79d0c1964c007a3bacb18b898e3 100644 --- a/Source/CollisionDetection/Testing/imstkOctreeBasedCDTest.cpp +++ b/Source/CollisionDetection/Testing/imstkOctreeBasedCDTest.cpp @@ -68,11 +68,11 @@ generatePointSet(const Real sphereRadius) particles->reserve(N * N * N); const Vec3r corner = sphereCenter - Vec3r(1, 1, 1) * sphereRadius; - for (uint64_t i = 0; i < N; ++i) + for (int i = 0; i < N; ++i) { - for (uint64_t j = 0; j < N; ++j) + for (int j = 0; j < N; ++j) { - for (uint64_t k = 0; k < N; ++k) + for (int k = 0; k < N; ++k) { const Vec3r ppos = corner + Vec3r(spacing * Real(i), spacing * Real(j), spacing * Real(k)); const Vec3r d = ppos - sphereCenter; @@ -198,7 +198,7 @@ public: std::vector<int> pointPenetrations(pointset->getNumVertices()); std::vector<double> pointPenetrationDistances(pointset->getNumVertices()); size_t numPenetrations = 0; - for (size_t p = 0; p < pointset->getNumVertices(); ++p) + for (int p = 0; p < pointset->getNumVertices(); ++p) { const auto& point = pointset->getVertexPosition(p); bool bPenetration = true; diff --git a/Source/CollisionHandling/imstkBoneDrillingCH.cpp b/Source/CollisionHandling/imstkBoneDrillingCH.cpp index 4b87a33822db1102eabf71abe4d32fbdafcddd94..85a60608e3a9cf7e544a36ada60627885cdbed16 100644 --- a/Source/CollisionHandling/imstkBoneDrillingCH.cpp +++ b/Source/CollisionHandling/imstkBoneDrillingCH.cpp @@ -40,26 +40,26 @@ BoneDrillingCH::BoneDrillingCH(const Side& side, // Initialize bone density values m_nodalDensity.reserve(boneMesh->getNumVertices()); - for (size_t i = 0; i < boneMesh->getNumVertices(); ++i) + for (int i = 0; i < boneMesh->getNumVertices(); ++i) { m_nodalDensity.push_back(m_initialBoneDensity); } m_nodeRemovalStatus.reserve(boneMesh->getNumVertices()); - for (size_t i = 0; i < boneMesh->getNumVertices(); ++i) + for (int i = 0; i < boneMesh->getNumVertices(); ++i) { m_nodeRemovalStatus.push_back(false); } m_nodalCardinalSet.reserve(boneMesh->getNumVertices()); - for (size_t i = 0; i < boneMesh->getNumVertices(); ++i) + for (int i = 0; i < boneMesh->getNumVertices(); ++i) { std::vector<size_t> row; m_nodalCardinalSet.push_back(row); } // Pre-compute the nodal cardinality set - for (size_t tetId = 0; tetId < boneMesh->getNumTetrahedra(); ++tetId) + for (int tetId = 0; tetId < boneMesh->getNumTetrahedra(); ++tetId) { const Vec4i& indices = boneMesh->getTetrahedronIndices(tetId); for (int i = 0; i < 4; i++) diff --git a/Source/Constraint/PbdConstraints/imstkPbdPointNormalCollisionConstraint.cpp b/Source/Constraint/PbdConstraints/imstkPbdPointNormalCollisionConstraint.cpp index c88cb815a73a191062ba3fe6e3534284999ee9a6..6ea836e35bf03dc26bafd402180533d6ed4be80c 100644 --- a/Source/Constraint/PbdConstraints/imstkPbdPointNormalCollisionConstraint.cpp +++ b/Source/Constraint/PbdConstraints/imstkPbdPointNormalCollisionConstraint.cpp @@ -19,8 +19,6 @@ =========================================================================*/ -#pragma once - #include "imstkPbdPointNormalCollisionConstraint.h" namespace imstk diff --git a/Source/DataStructures/Testing/imstkLooseOctreeTest.cpp b/Source/DataStructures/Testing/imstkLooseOctreeTest.cpp index d63ab0424a840361c8d0976da924e93a384baff0..aaa6740153fafcd9c714310bf80ffc579f3c5c69 100644 --- a/Source/DataStructures/Testing/imstkLooseOctreeTest.cpp +++ b/Source/DataStructures/Testing/imstkLooseOctreeTest.cpp @@ -104,7 +104,7 @@ generateMesh() void randomizePositions(const std::shared_ptr<PointSet>& pointset) { - for (size_t i = 0; i < pointset->getNumVertices(); ++i) + for (int i = 0; i < pointset->getNumVertices(); ++i) { pointset->setVertexPosition(i, Vec3r( (static_cast<Real>(rand()) / static_cast<Real>(RAND_MAX) * 2.0 - 1.0) * BOUND, @@ -121,7 +121,7 @@ randomizePositions(const std::shared_ptr<PointSet>& pointset) void randomizePositions(const std::shared_ptr<SurfaceMesh>& mesh) { - for (size_t i = 0; i < mesh->getNumTriangles(); ++i) + for (int i = 0; i < mesh->getNumTriangles(); ++i) { const auto translation = Vec3r( (static_cast<Real>(rand()) / static_cast<Real>(RAND_MAX) * 2.0 - 1.0) * BOUND, diff --git a/Source/DataStructures/Testing/imstkNeighborSearchTest.cpp b/Source/DataStructures/Testing/imstkNeighborSearchTest.cpp index e1be437a1ccdb7961b2deeec0dc6d31b0d5ba410..90836310782ce46b9dd28fad86717823fd0af137 100644 --- a/Source/DataStructures/Testing/imstkNeighborSearchTest.cpp +++ b/Source/DataStructures/Testing/imstkNeighborSearchTest.cpp @@ -57,13 +57,13 @@ neighborSearchBruteForce(VecDataArray<double, 3>& particles, std::vector<std::ve const Real radius = Real(4.000000000000001) * PARTICLE_RADIUS; const Real radiusSqr = radius * radius; - for (size_t p = 0; p < particles.size(); ++p) + for (int p = 0; p < particles.size(); ++p) { const auto ppos = particles[p]; auto& pneighbors = neighbors[p]; pneighbors.resize(0); - for (size_t q = 0; q < particles.size(); ++q) + for (int q = 0; q < particles.size(); ++q) { if (p == q) { @@ -112,7 +112,7 @@ neighborSearchSpatialHashing(VecDataArray<double, 3>& particles, std::vector<std hashTable.setCellSize(radius, radius, radius); hashTable.insertPoints(particles); - for (size_t p = 0; p < particles.size(); ++p) + for (int p = 0; p < particles.size(); ++p) { auto& v = particles[p]; hashTable.getPointsInSphere(neighbors[p], v, radius); @@ -129,13 +129,13 @@ neighborSearchBruteForce(VecDataArray<double, 3>& setA, VecDataArray<double, 3>& const Real radius = Real(4.000000000000001) * PARTICLE_RADIUS; const Real radiusSqr = radius * radius; - for (size_t p = 0; p < setA.size(); ++p) + for (int p = 0; p < setA.size(); ++p) { const auto ppos = setA[p]; auto& pneighbors = neighbors[p]; pneighbors.resize(0); - for (size_t q = 0; q < setB.size(); ++q) + for (int q = 0; q < setB.size(); ++q) { const auto qpos = setB[q]; const auto d2 = (Vec3r(ppos - qpos)).squaredNorm(); diff --git a/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp b/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp index 73416f236036be39e99b9bf0faea5d575c817054..60e6e87f5fb0f2cd28c86d917aed66492c0c5d9c 100644 --- a/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp +++ b/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp @@ -33,7 +33,7 @@ SpatialHashTableSeparateChaining::SpatialHashTableSeparateChaining() : void SpatialHashTableSeparateChaining::insertPoints(const VecDataArray<double, 3>& points) { - for (size_t i = 0; i < points.size(); i++) + for (int i = 0; i < points.size(); i++) { this->insertPoint(points[i]); } diff --git a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp index 22ccb891a0bab1159cc657457b4d49a3e578dbf8..3441e38b6f927eae039a7064b58ccd3d4627ebea 100644 --- a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp @@ -219,13 +219,13 @@ RigidBodyModel::createMesh() PxVec3* vertices = new PxVec3[numVerts]; PxU32* indices = new PxU32[numTriangles * 3]; - for (size_t i = 0; i < numVerts; ++i) + for (int i = 0; i < numVerts; ++i) { const Vec3d& v = vertData[i]; vertices[i] = PxVec3(static_cast<float>(v[0]), static_cast<float>(v[1]), static_cast<float>(v[2])); } - for (size_t i = 0; i < numTriangles; ++i) + for (int i = 0; i < numTriangles; ++i) { auto t = triVerts[i]; indices[3 * i] = static_cast<PxU32>(t[0]); diff --git a/Source/Geometry/Analytic/imstkOrientedBox.cpp b/Source/Geometry/Analytic/imstkOrientedBox.cpp index 5f59c3dee5c00c7878f49bcb12d55bfc49097b44..7e4a0908df7a7efdb0a4b40e253d5e42a20f6f05 100644 --- a/Source/Geometry/Analytic/imstkOrientedBox.cpp +++ b/Source/Geometry/Analytic/imstkOrientedBox.cpp @@ -134,7 +134,6 @@ OrientedBox::getFunctionValue(const Vec3d& pos) const { // If outside we need to also consider diagonal distance to corners and edges // Compute nearest point - Vec3d closestPt = Vec3d::Zero(); Vec3d axialSignedDists = Vec3d::Zero(); for (int i = 0; i < 3; i++) { diff --git a/Source/Geometry/Mesh/imstkPointSet.cpp b/Source/Geometry/Mesh/imstkPointSet.cpp index a39f0c4c01ab491b95ba5f90339b50faf37bbfdf..803a64af47c52ad269fc9cb0d141c02b8bcf0e84 100644 --- a/Source/Geometry/Mesh/imstkPointSet.cpp +++ b/Source/Geometry/Mesh/imstkPointSet.cpp @@ -99,7 +99,7 @@ Vec3d& PointSet::getInitialVertexPosition(const size_t vertNum) { #if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG) - LOG_IF(FATAL, (vertNum >= m_initialVertexPositions->size())) << "Invalid index"; + LOG_IF(FATAL, (static_cast<int>(vertNum) >= m_initialVertexPositions->size())) << "Invalid index"; #endif return (*m_initialVertexPositions)[vertNum]; } @@ -128,7 +128,7 @@ void PointSet::setVertexPosition(const size_t vertNum, const Vec3d& pos) { #if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG) - LOG_IF(FATAL, (vertNum >= m_vertexPositions->size())) << "Invalid index"; + LOG_IF(FATAL, (static_cast<int>(vertNum) >= m_vertexPositions->size())) << "Invalid index"; #endif (*m_vertexPositions)[vertNum] = pos; m_transformApplied = false; @@ -139,7 +139,7 @@ const Vec3d& PointSet::getVertexPosition(const size_t vertNum, DataType type) const { #if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG) - LOG_IF(FATAL, (vertNum >= getVertexPositions()->size())) << "Invalid index"; + LOG_IF(FATAL, (static_cast<int>(vertNum) >= getVertexPositions()->size())) << "Invalid index"; #endif return (*this->getVertexPositions(type))[vertNum]; } @@ -148,7 +148,7 @@ Vec3d& PointSet::getVertexPosition(const size_t vertNum, DataType type) { #if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG) - LOG_IF(FATAL, (vertNum >= getVertexPositions()->size())) << "Invalid index"; + LOG_IF(FATAL, (static_cast<int>(vertNum) >= getVertexPositions()->size())) << "Invalid index"; #endif return (*this->getVertexPositions(type))[vertNum]; } diff --git a/Source/Geometry/Mesh/imstkSurfaceMesh.cpp b/Source/Geometry/Mesh/imstkSurfaceMesh.cpp index 0103061dbf384422efb319b313c1514a9239c980..bf6af4180ea37fc6cdc0234921f2981f9ce53202 100644 --- a/Source/Geometry/Mesh/imstkSurfaceMesh.cpp +++ b/Source/Geometry/Mesh/imstkSurfaceMesh.cpp @@ -138,7 +138,7 @@ SurfaceMesh::computeVertexNeighborVertices() m_vertexNeighborVertices.clear(); m_vertexNeighborVertices.resize(m_vertexPositions->size()); - if (m_vertexNeighborTriangles.size() != m_vertexPositions->size()) + if (static_cast<int>(m_vertexNeighborTriangles.size()) != m_vertexPositions->size()) { this->computeVertexNeighborTriangles(); } @@ -182,7 +182,7 @@ SurfaceMesh::computeTrianglesNormals() const VecDataArray<double, 3>& vertices = *m_vertexPositions; const VecDataArray<int, 3>& indices = *m_triangleIndices; - for (size_t triangleId = 0; triangleId < triangleNormals.size(); ++triangleId) + for (int triangleId = 0; triangleId < triangleNormals.size(); ++triangleId) { const auto& t = indices[triangleId]; const auto& p0 = vertices[t[0]]; @@ -226,7 +226,7 @@ SurfaceMesh::computeTriangleTangents() const VecDataArray<float, 2>& uvs = *uvsPtr; const VecDataArray<double, 3>& vertices = *m_vertexPositions; const VecDataArray<int, 3>& indices = *m_triangleIndices; - for (size_t triangleId = 0; triangleId < triangleNormals.size(); ++triangleId) + for (int triangleId = 0; triangleId < triangleNormals.size(); ++triangleId) { const Vec3i& t = indices[triangleId]; const Vec3d& p0 = vertices[t[0]]; @@ -275,7 +275,7 @@ SurfaceMesh::computeVertexNormals() VecDataArray<double, 3> temp_normals(vertexNormals.size()); std::shared_ptr<VecDataArray<double, 3>> triangleNormalsPtr = getCellNormals(); const VecDataArray<double, 3>& triangleNormals = *triangleNormalsPtr; - for (size_t vertexId = 0; vertexId < vertexNormals.size(); ++vertexId) + for (int vertexId = 0; vertexId < vertexNormals.size(); ++vertexId) { temp_normals[vertexId] = Vec3d(0.0, 0.0, 0.0); for (const size_t& triangleId : m_vertexNeighborTriangles.at(vertexId)) @@ -352,7 +352,7 @@ SurfaceMesh::computeVertexTangents() // Correct for UV seams Vec3d tangent; - for (size_t vertexId = 0; vertexId < vertexTangents.size(); ++vertexId) + for (int vertexId = 0; vertexId < vertexTangents.size(); ++vertexId) { tangent = temp_vertex_tangents[vertexId]; tangent.normalize(); @@ -604,7 +604,7 @@ SurfaceMesh::computeUVSeamVertexGroups() // Initial pass to bin vertices based on positions const VecDataArray<double, 3>& vertexNormals = *vertexNormalsPtr; const VecDataArray<double, 3>& vertices = *m_vertexPositions; - for (size_t i = 0; i < vertices.size(); i++) + for (int i = 0; i < vertices.size(); i++) { NormalGroup group = { vertices[i], vertexNormals[i] }; diff --git a/Source/Geometry/Testing/imstkSurfaceMeshTest.cpp b/Source/Geometry/Testing/imstkSurfaceMeshTest.cpp index 03443c619a15644129b532d6e92098234a6cb7fd..f5dbf97a01134356c25b07756104f81dcf2a9887 100644 --- a/Source/Geometry/Testing/imstkSurfaceMeshTest.cpp +++ b/Source/Geometry/Testing/imstkSurfaceMeshTest.cpp @@ -211,12 +211,13 @@ TEST(imstkSurfaceMeshTest, ComputeTriangleNormals) TEST(imstkSurfaceMeshTest, ComputeVertexNormals) { - // - // /|\ - // / | \ - // // \\ - // - // Tests two triangles that share an edge + /* + /|\ + / | \ + // \\ + + Tests two triangles that share an edge + */ auto verticesPtr = std::make_shared<VecDataArray<double, 3>>(4); (*verticesPtr)[0] = Vec3d(0.0, 0.0, -1.0); (*verticesPtr)[1] = Vec3d(0.0, 0.0, 1.0); diff --git a/Source/Geometry/imstkGeometry.cpp b/Source/Geometry/imstkGeometry.cpp index d0ec3cbaf1ed81b9be4ba9a4a55ea9cdae8a497d..65e7332cd62339d30dbefbdd36c685d8a17cb27b 100644 --- a/Source/Geometry/imstkGeometry.cpp +++ b/Source/Geometry/imstkGeometry.cpp @@ -149,7 +149,6 @@ Geometry::setRotation(const Mat3d& m) { // Decompose trs, getRotation assumes no shear const Vec3d s = getScaling(); - const Mat3d r = getRotation(); const Vec3d t = getTranslation(); m_transform = Mat4d::Identity(); m_transform.block<3, 3>(0, 0) = m; diff --git a/Source/Geometry/imstkGeometryUtilities.cpp b/Source/Geometry/imstkGeometryUtilities.cpp index ef39a13bb7d404baead5706e7f89a960bb8718cb..a5a3531f074a01c1753545f63648e9765f9d27c0 100644 --- a/Source/Geometry/imstkGeometryUtilities.cpp +++ b/Source/Geometry/imstkGeometryUtilities.cpp @@ -675,7 +675,7 @@ GeometryUtils::copyToVtkPoints(std::shared_ptr<VecDataArray<double, 3>> vertices vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New(); const VecDataArray<double, 3>& vertexData = *vertices; points->SetNumberOfPoints(vertexData.size()); - for (size_t i = 0; i < vertexData.size(); i++) + for (int i = 0; i < vertexData.size(); i++) { points->SetPoint(i, vertexData[i][0], vertexData[i][1], vertexData[i][2]); } @@ -689,7 +689,7 @@ GeometryUtils::copyToVtkCellArray(std::shared_ptr<VecDataArray<int, dim>> cellsP vtkSmartPointer<vtkCellArray> vtkCells = vtkSmartPointer<vtkCellArray>::New(); VecDataArray<int, dim>& cells = *cellsPtr; - for (size_t i = 0; i < cells.size(); i++) + for (int i = 0; i < cells.size(); i++) { vtkCells->InsertNextCell(dim); for (size_t k = 0; k < dim; k++) @@ -1100,7 +1100,7 @@ markPointsInsideAndOut(std::vector<bool>& isInside, Vec3d aabbMin, aabbMax; surfaceMesh.computeBoundingBox(aabbMin, aabbMax, 1.0); - + /* auto genRandomDirection = [](Vec3d& direction) { for (int i = 0; i < 3; ++i) @@ -1115,6 +1115,7 @@ markPointsInsideAndOut(std::vector<bool>& isInside, } return; }; + */ auto triangleRayIntersection = [](const Vec3d& xyz, const Vec3d& triVert0, @@ -1165,7 +1166,7 @@ markPointsInsideAndOut(std::vector<bool>& isInside, bBoxMax.resize(surfaceMesh.getNumTriangles()); const VecDataArray<int, 3>& indices = *surfaceMesh.getTriangleIndices(); - for (size_t idx = 0; idx < surfaceMesh.getNumTriangles(); ++idx) + for (int idx = 0; idx < surfaceMesh.getNumTriangles(); ++idx) { const auto& verts = indices[idx]; const auto& xyz0 = surfaceMesh.getVertexPosition(verts[0]); @@ -1215,7 +1216,7 @@ markPointsInsideAndOut(std::vector<bool>& isInside, int numIntersections = 0; const auto& xyz = *surfaceMesh.getVertexPositions(); - for (size_t j = 0; j < surfaceMesh.getNumTriangles(); ++j) + for (int j = 0; j < surfaceMesh.getNumTriangles(); ++j) { const Vec3i& verts = indices[j]; @@ -1401,7 +1402,7 @@ markPointsInsideAndOut(std::vector<bool>& isInside, double dist = 0.0; double distMin = h[0] * (nz + 1); - for (size_t j = 0; j < surfaceMesh.getNumTriangles(); ++j) + for (int j = 0; j < surfaceMesh.getNumTriangles(); ++j) { const Vec3i& verts = indices[j]; @@ -1579,7 +1580,7 @@ GeometryUtils::createTetrahedralMeshCover(std::shared_ptr<SurfaceMesh> surfMesh, static TetrahedralMesh::WeightsArray weights = { 0.0, 0.0, 0.0, 0.0 }; // loop over the tets to find the enclosing tets - for (size_t id = tetId0; id < tetId1; ++id) + for (int id = tetId0; id < tetId1; ++id) { if (validTet[id]) { @@ -1601,7 +1602,7 @@ GeometryUtils::createTetrahedralMeshCover(std::shared_ptr<SurfaceMesh> surfMesh, labelEnclosingTet(xyz); }; - for (int i = 0; i < validTet.size(); ++i) + for (size_t i = 0; i < validTet.size(); ++i) { const Vec4i& verts = uniformMesh->getTetrahedronIndices(i); if (insideSurfMesh[verts[0]] diff --git a/Source/GeometryMappers/imstkOneToOneMap.cpp b/Source/GeometryMappers/imstkOneToOneMap.cpp index 376991b0ebc671c23be8cd34dd700bdbd18840ba..71e82b900a0e1be083255889bcbb3eaaf9f872d9 100644 --- a/Source/GeometryMappers/imstkOneToOneMap.cpp +++ b/Source/GeometryMappers/imstkOneToOneMap.cpp @@ -68,7 +68,7 @@ bool OneToOneMap::findMatchingVertex(const VecDataArray<double, 3>& masterVertices, const Vec3d& p, size_t& nodeId) { const double eps2 = m_epsilon * m_epsilon; - for (size_t idx = 0; idx < masterVertices.size(); ++idx) + for (int idx = 0; idx < masterVertices.size(); ++idx) { if ((masterVertices[idx] - p).squaredNorm() < eps2) { diff --git a/Source/GeometryMappers/imstkTetraTriangleMap.cpp b/Source/GeometryMappers/imstkTetraTriangleMap.cpp index e0cb327e97cdfe97b418780263ee07e924b48c73..4cf8408b960b97493bba7f0a68592e3985d1ec0c 100644 --- a/Source/GeometryMappers/imstkTetraTriangleMap.cpp +++ b/Source/GeometryMappers/imstkTetraTriangleMap.cpp @@ -148,7 +148,7 @@ TetraTriangleMap::isValid() const CHECK(dynamic_cast<TetrahedralMesh*>(m_master.get()) != nullptr) << "Fail to cast from geometry to mesh"; #endif - auto totalElementsMaster = meshMaster->getNumTetrahedra(); + auto totalElementsMaster = static_cast<size_t>(meshMaster->getNumTetrahedra()); bool bOK = true; ParallelUtils::parallelFor(m_verticesEnclosingTetraId.size(), [&](const size_t tetId) { @@ -191,7 +191,7 @@ TetraTriangleMap::findClosestTetrahedron(const Vec3d& pos) const size_t closestTetrahedron = std::numeric_limits<size_t>::max(); Vec3d center(0, 0, 0); - for (size_t tetId = 0; tetId < tetMesh->getNumTetrahedra(); ++tetId) + for (int tetId = 0; tetId < tetMesh->getNumTetrahedra(); ++tetId) { center = Vec3d::Zero(); const Vec4i& vert = tetMesh->getTetrahedronIndices(tetId); @@ -219,7 +219,7 @@ TetraTriangleMap::findEnclosingTetrahedron(const Vec3d& pos) const TetrahedralMesh::WeightsArray weights = { 0.0, 0.0, 0.0, 0.0 }; size_t enclosingTetrahedron = std::numeric_limits<size_t>::max(); - for (size_t idx = 0; idx < tetMesh->getNumTetrahedra(); ++idx) + for (int idx = 0; idx < tetMesh->getNumTetrahedra(); ++idx) { bool inBox = (pos[0] >= m_bBoxMin[idx][0] && pos[0] <= m_bBoxMax[idx][0]) && (pos[1] >= m_bBoxMin[idx][1] && pos[1] <= m_bBoxMax[idx][1]) diff --git a/Source/MeshIO/imstkVegaMeshIO.cpp b/Source/MeshIO/imstkVegaMeshIO.cpp index 0b3c0d872c8723193992ee7c2f9346986a069fd6..1891302098fce4d8774c2c15b777a10cb94bdaed 100644 --- a/Source/MeshIO/imstkVegaMeshIO.cpp +++ b/Source/MeshIO/imstkVegaMeshIO.cpp @@ -142,7 +142,7 @@ VegaMeshIO::copyCells(std::shared_ptr<vega::VolumetricMesh> vegaMesh, VecDataArray<int, dim>& cells) { typename VecDataArray<int, dim>::VecType cell; - for (size_t cellId = 0; cellId < vegaMesh->getNumElements(); ++cellId) + for (int cellId = 0; cellId < vegaMesh->getNumElements(); ++cellId) { for (int i = 0; i < vegaMesh->getNumElementVertices(); ++i) { diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.cpp b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.cpp index af3a47fdf9d5a91d3dd9b16df226a3c243990c71..e26a82ca85a29a1edea6d2f424bc9b96f06ba978 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.cpp +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.cpp @@ -162,7 +162,6 @@ VTKSurfaceMeshRenderDelegate::processEvents() // Only use the most recent event from respective sender std::list<Command> cmds; bool contains[6] = { false, false, false, false, false, false }; - EventObject* sender[4] = { m_visualModel.get(), m_material.get(), geom.get(), vertices.get() }; rforeachEvent([&](Command cmd) { if (cmd.m_event->m_sender == m_visualModel.get() && !contains[0]) diff --git a/Source/Scene/imstkPbdObjectCuttingPair.cpp b/Source/Scene/imstkPbdObjectCuttingPair.cpp index 9ee9b4ab4ee5bd9209b2c9e752e49a94b6bc282b..c149f39878a882fce339980b71e88a06e6591851 100644 --- a/Source/Scene/imstkPbdObjectCuttingPair.cpp +++ b/Source/Scene/imstkPbdObjectCuttingPair.cpp @@ -126,7 +126,7 @@ PbdObjectCuttingPair::modifyVertices(std::shared_ptr<SurfaceMesh> pbdMesh, auto nModifiedVertices = modifiedVertices->size(); if (nModifiedVertices != modifiedInitialVertices->size() - || nModifiedVertices != modifiedVertexIndices->size()) + || static_cast<size_t>(nModifiedVertices) != modifiedVertexIndices->size()) { LOG(WARNING) << "Numbers of vertices do not match."; return; @@ -167,14 +167,14 @@ PbdObjectCuttingPair::modifyTriangles(std::shared_ptr<SurfaceMesh> pbdMesh, std::shared_ptr<VecDataArray<int, 3>> modifiedTriangles) { auto triangles = pbdMesh->getTriangleIndices(); - auto nModifiedTriangles = modifiedTriangles->size(); + auto nModifiedTriangles = static_cast<size_t>(modifiedTriangles->size()); if (nModifiedTriangles != modifiedTriangleIndices->size()) { LOG(WARNING) << "Numbers of vertices do not match."; return; } - for (int i = 0; i < nModifiedTriangles; ++i) + for (size_t i = 0; i < nModifiedTriangles; ++i) { auto triId = (*modifiedTriangleIndices)[i]; auto& oldTri = (*triangles)[triId]; diff --git a/Source/SimulationManager/imstkScreenCaptureUtility.cpp b/Source/SimulationManager/imstkScreenCaptureUtility.cpp index c72310eeeb7a05f173789b6f5f9fecbe2188c20c..ffb5ada805c9ec29dda04f4affa9c3c3350345df 100644 --- a/Source/SimulationManager/imstkScreenCaptureUtility.cpp +++ b/Source/SimulationManager/imstkScreenCaptureUtility.cpp @@ -23,7 +23,9 @@ namespace imstk { -ScreenCaptureUtility::ScreenCaptureUtility(std::string prefix) : m_screenShotPrefix(prefix), m_screenShotNumber(0) +ScreenCaptureUtility::ScreenCaptureUtility(std::string prefix) : + m_screenShotNumber(0), + m_screenShotPrefix(prefix) { } diff --git a/Source/Solvers/imstkNewtonSolver.cpp b/Source/Solvers/imstkNewtonSolver.cpp index 0c9eb246694be7591bb2288a3bf4b7a2ed673c9d..f440f493c1c0054f24e2af951bae955b3f5dcf38 100644 --- a/Source/Solvers/imstkNewtonSolver.cpp +++ b/Source/Solvers/imstkNewtonSolver.cpp @@ -74,7 +74,7 @@ NewtonSolver<SystemMatrix>::solveGivenState(Vectord& x) const int maxIters = this->m_isSemiImplicit ? 1 : static_cast<int>(m_maxIterations); - for (size_t i = 0; i < maxIters; ++i) + for (int i = 0; i < maxIters; ++i) { if (fnorm < stopTolerance) {