diff --git a/Examples/DeformableBody/DeformableBodyExample.cpp b/Examples/DeformableBody/DeformableBodyExample.cpp index 0308baaed5fb22d2f653d047dbfa66047f19c360..65d07a39c95631e9ea0af90e32cf63e677e05697 100644 --- a/Examples/DeformableBody/DeformableBodyExample.cpp +++ b/Examples/DeformableBody/DeformableBodyExample.cpp @@ -52,13 +52,13 @@ main() // Load a tetrahedral mesh auto tetMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg"); - CHECK(tetMesh) << "Could not read mesh from file."; + CHECK(tetMesh != nullptr) << "Could not read mesh from file."; // Extract the surface mesh auto surfMesh = std::make_shared<SurfaceMesh>(); auto volTetMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh); - CHECK(volTetMesh) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!"; + CHECK(volTetMesh != nullptr) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!"; volTetMesh->extractSurfaceMesh(surfMesh, true); diff --git a/Examples/GeometryTransforms/GeometryTransformsExample.cpp b/Examples/GeometryTransforms/GeometryTransformsExample.cpp index 0734d692e0d52bbd70d31337732470666f8893fb..6bfd0ffd8c7410350c2c38d272c13292e738c26a 100644 --- a/Examples/GeometryTransforms/GeometryTransformsExample.cpp +++ b/Examples/GeometryTransforms/GeometryTransformsExample.cpp @@ -40,7 +40,7 @@ main() auto sceneObj = apiutils::createAndAddVisualSceneObject(scene, iMSTK_DATA_ROOT "/asianDragon/asianDragon.obj", "Dragon"); - CHECK(sceneObj) << "ERROR: Unable to create scene object"; + CHECK(sceneObj != nullptr) << "ERROR: Unable to create scene object"; auto surfaceMesh = sceneObj->getVisualGeometry(); surfaceMesh->scale(5., Geometry::TransformType::ConcatenateToTransform); diff --git a/Examples/RigidBodyDynamics/RigidBodyDynamicsExample.cpp b/Examples/RigidBodyDynamics/RigidBodyDynamicsExample.cpp index a92cd86b6cbe2411004758aa7c9bdd4aea854485..92b02e549d3358d07496f3b8a88f4729c266cd1d 100644 --- a/Examples/RigidBodyDynamics/RigidBodyDynamicsExample.cpp +++ b/Examples/RigidBodyDynamics/RigidBodyDynamicsExample.cpp @@ -41,13 +41,13 @@ addMeshRigidObject(const std::string& name, std::shared_ptr<Scene> scene, Vec3d // Load a tetrahedral mesh auto tetMesh = imstk::MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg"); - CHECK(tetMesh) << "Could not read mesh from file."; + CHECK(tetMesh != nullptr) << "Could not read mesh from file."; // Extract the surface mesh auto surfMesh = std::make_shared<SurfaceMesh>(); auto volTetMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh); - CHECK(volTetMesh) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!"; + CHECK(volTetMesh != nullptr) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!"; volTetMesh->scale(15., Geometry::TransformType::ApplyToData); volTetMesh->translate(pos, Geometry::TransformType::ApplyToData); diff --git a/Source/Collision/CollisionHandling/imstkBoneDrillingCH.cpp b/Source/Collision/CollisionHandling/imstkBoneDrillingCH.cpp index 29b12342d43d92681315c2952d57433eea3ce0be..d7fabcf036c221eef7759dfeb6530ac7da565d05 100644 --- a/Source/Collision/CollisionHandling/imstkBoneDrillingCH.cpp +++ b/Source/Collision/CollisionHandling/imstkBoneDrillingCH.cpp @@ -42,7 +42,7 @@ BoneDrillingCH::BoneDrillingCH(const Side& side, { auto boneMesh = std::dynamic_pointer_cast<TetrahedralMesh>(m_bone->getCollidingGeometry()); - CHECK(boneMesh) << "BoneDrillingCH::BoneDrillingCH Error:The bone colliding geometry is not a mesh!"; + CHECK(boneMesh != nullptr) << "BoneDrillingCH::BoneDrillingCH Error:The bone colliding geometry is not a mesh!"; // Initialize bone density values m_nodalDensity.reserve(boneMesh->getNumVertices()); diff --git a/Source/Collision/CollisionHandling/imstkPBDCollisionHandling.cpp b/Source/Collision/CollisionHandling/imstkPBDCollisionHandling.cpp index 20476d29780f4d23cce532c544d3ce350726fe48..c4dd6d420929a0b92ac4d83e0ca9bc4ef6e27c11 100644 --- a/Source/Collision/CollisionHandling/imstkPBDCollisionHandling.cpp +++ b/Source/Collision/CollisionHandling/imstkPBDCollisionHandling.cpp @@ -75,7 +75,7 @@ PBDCollisionHandling::processCollisionData() }*/ this->generatePBDConstraints(); - CHECK(m_PBDSolver) << "No PbdSolver found to handle the Collision constraints!"; + CHECK(m_PBDSolver != nullptr) << "No PbdSolver found to handle the Collision constraints!"; m_PBDSolver->addCollisionConstraints(&m_PBDConstraints); } diff --git a/Source/Collision/CollisionHandling/imstkPenaltyCH.cpp b/Source/Collision/CollisionHandling/imstkPenaltyCH.cpp index f36864259f0ecb1ff970c2d88ee8f47239dfd84e..c4f8c6343ab930eca4ea315cd75920795301f58b 100644 --- a/Source/Collision/CollisionHandling/imstkPenaltyCH.cpp +++ b/Source/Collision/CollisionHandling/imstkPenaltyCH.cpp @@ -65,7 +65,7 @@ PenaltyCH::computeContactForcesAnalyticRigid(const std::shared_ptr<CollidingObje return; } - CHECK(analyticObj) << m_object->getName() << " is not a colliding object"; + CHECK(analyticObj != nullptr) << m_object->getName() << " is not a colliding object"; // If collision data is valid, append forces Vec3d force(0., 0., 0.); @@ -94,8 +94,8 @@ PenaltyCH::computeContactForcesDiscreteDeformable(const std::shared_ptr<Deformab return; } - CHECK(deformableObj) << "PenaltyRigidCH::computeContactForcesDiscreteDeformable error: " - << m_object->getName() << " is not a deformable object."; + CHECK(deformableObj != nullptr) << "PenaltyRigidCH::computeContactForcesDiscreteDeformable error: " + << m_object->getName() << " is not a deformable object."; // Get current force vector auto& force = deformableObj->getContactForce(); diff --git a/Source/Collision/CollisionHandling/imstkPickingCH.cpp b/Source/Collision/CollisionHandling/imstkPickingCH.cpp index b8328b33d562391be71ab14d27c79969d2a394cd..5299a5641c33192f1cb61c45f46bc9465676b8a9 100644 --- a/Source/Collision/CollisionHandling/imstkPickingCH.cpp +++ b/Source/Collision/CollisionHandling/imstkPickingCH.cpp @@ -36,8 +36,8 @@ PickingCH::PickingCH(const CollisionHandling::Side& side, void PickingCH::processCollisionData() { - CHECK(m_object) << "PickingCH::handleCollision error: " - << "no picking collision handling available the object"; + CHECK(m_object != nullptr) << "PickingCH::handleCollision error: " + << "no picking collision handling available the object"; this->addPickConstraints(m_object); } @@ -52,8 +52,8 @@ PickingCH::addPickConstraints(std::shared_ptr<DeformableObject> deformableObj) return; } - CHECK(deformableObj) << "PenaltyRigidCH::addPickConstraints error: " - << " not a deformable object."; + CHECK(deformableObj != nullptr) << "PenaltyRigidCH::addPickConstraints error: " + << " not a deformable object."; const auto& Uprev = deformableObj->getDisplacements(); const auto& Vprev = deformableObj->getVelocities(); diff --git a/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp b/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp index e13ebc41aad22395da76b3a853f94aa72233c3a5..1c6dabc9d70335209239825b44f9669b6fb0f897 100644 --- a/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp +++ b/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp @@ -45,7 +45,7 @@ loadMesh(std::string externalDataSuffix) std::shared_ptr<TetrahedralMesh> volMesh = std::static_pointer_cast<TetrahedralMesh>(imstk::MeshIO::read(file)); - CHECK(volMesh) << "Failed to read a volumetric mesh file : " << file; + CHECK(volMesh != nullptr) << "Failed to read a volumetric mesh file : " << file; return volMesh; } diff --git a/Source/Collision/imstkInteractionPair.cpp b/Source/Collision/imstkInteractionPair.cpp index 5026e8fd16ea9036a545f44cc21209029bb38c4b..8ba68ecc4a5a79cc9f77a10bf49cc40ebca6c133 100644 --- a/Source/Collision/imstkInteractionPair.cpp +++ b/Source/Collision/imstkInteractionPair.cpp @@ -36,7 +36,7 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A, m_valid = false; // Check that objects exist - CHECK(A && B) << "InteractionPair error: invalid objects (nullptr)."; + CHECK(A != nullptr && B != nullptr) << "InteractionPair error: invalid objects (nullptr)."; // Check if objects are different /*if (A == B) @@ -48,7 +48,7 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A, // Collision Detection std::shared_ptr<CollisionDetection> CD = CollisionDetection::makeCollisionDetectionObject(CDType, A, B, m_colData); - CHECK(CD) << "InteractionPair error: can not instantiate collision detection algorithm."; + CHECK(CD != nullptr) << "InteractionPair error: can not instantiate collision detection algorithm."; // Collision Handling A std::shared_ptr<CollisionHandling> CHA; @@ -56,8 +56,8 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A, { CHA = CollisionHandling::make_collision_handling(CHAType, CollisionHandling::Side::A, m_colData, A, B); - CHECK(CHA) << "InteractionPair error: can not instantiate collision handling for '" - << A->getName() << "' object."; + CHECK(CHA != nullptr) << "InteractionPair error: can not instantiate collision handling for '" + << A->getName() << "' object."; } // Collision Handling B @@ -66,8 +66,8 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A, { CHB = CollisionHandling::make_collision_handling(CHBType, CollisionHandling::Side::B, m_colData, B, A); - CHECK(CHB) << "InteractionPair error: can not instantiate collision handling for '" - << B->getName() << "' object."; + CHECK(CHB != nullptr) << "InteractionPair error: can not instantiate collision handling for '" + << B->getName() << "' object."; } // Init interactionPair @@ -87,7 +87,7 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A, m_valid = false; // Check that objects exist - CHECK(A && B) << "InteractionPair error: invalid objects (nullptr)."; + CHECK(A != nullptr && B != nullptr) << "InteractionPair error: invalid objects (nullptr)."; // Check if objects are different /*if (A == B) diff --git a/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp b/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp index e4c5e963999558ce3c1d20bbae7eb542d6cd18fd..3b1552570a61bcafa78cefa018f01041824ea6fa 100644 --- a/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp @@ -181,7 +181,7 @@ bool FEMDeformableBodyModel::initialize() { // prerequisite of for successfully initializing - CHECK(m_geometry && m_FEModelConfig) << "DeformableBodyModel::initialize: Physics mesh or force model configuration not set yet!"; + CHECK(m_geometry != nullptr && m_FEModelConfig != nullptr) << "DeformableBodyModel::initialize: Physics mesh or force model configuration not set yet!"; auto physicsMesh = std::dynamic_pointer_cast<imstk::VolumetricMesh>(this->getModelGeometry()); m_vegaPhysicsMesh = VegaMeshIO::convertVolumetricMeshToVegaMesh(physicsMesh); @@ -323,7 +323,7 @@ FEMDeformableBodyModel::initializeForceModel() bool FEMDeformableBodyModel::initializeMassMatrix() { - CHECK(m_geometry) << "DeformableBodyModel::initializeMassMatrix Force model geometry not set!"; + CHECK(m_geometry != nullptr) << "DeformableBodyModel::initializeMassMatrix Force model geometry not set!"; vega::SparseMatrix* vegaMatrix; vega::GenerateMassMatrix::computeMassMatrix(m_vegaPhysicsMesh.get(), &vegaMatrix, true);//caveat @@ -390,14 +390,14 @@ FEMDeformableBodyModel::initializeDampingMatrix() bool FEMDeformableBodyModel::initializeTangentStiffness() { - CHECK(m_internalForceModel) + CHECK(m_internalForceModel != nullptr) << "DeformableBodyModel::initializeTangentStiffness: Tangent stiffness cannot be initialized without force model"; vega::SparseMatrix* matrix = nullptr; m_internalForceModel->getTangentStiffnessMatrixTopology(&matrix); - CHECK(matrix) << "DeformableBodyModel::initializeTangentStiffness - Tangent stiffness matrix topology not avaliable!"; - CHECK(m_vegaMassMatrix) << "DeformableBodyModel::initializeTangentStiffness - Vega mass matrix doesn't exist!"; + CHECK(matrix != nullptr) << "DeformableBodyModel::initializeTangentStiffness - Tangent stiffness matrix topology not avaliable!"; + CHECK(m_vegaMassMatrix != nullptr) << "DeformableBodyModel::initializeTangentStiffness - Vega mass matrix doesn't exist!"; matrix->BuildSubMatrixIndices(*m_vegaMassMatrix.get()); @@ -775,4 +775,4 @@ FEMDeformableBodyModel::setFixedSizeTimeStepping() m_timeStepSizeType = TimeSteppingType::fixed; m_timeIntegrator->setTimestepSizeToDefault(); } -} // imstk \ No newline at end of file +} // imstk diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp b/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp index 31e2efc2794b3d8dc1c9b83bb564550210de5673..e50fb407e997cc2f848a36a74688c892c5b968a5 100644 --- a/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp @@ -254,8 +254,8 @@ SPHModel::normalizeDensity() if (m_modelParameters->m_bDensityWithBoundary) { - //const auto& BDNeighborList = getState().getBoundaryNeighborLists()[p]; #if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG) + const auto& BDNeighborList = getState().getBoundaryNeighborLists()[p]; LOG_IF(FATAL, (fluidNeighborList.size() + BDNeighborList.size() != neighborInfo.size())) << "Invalid neighborInfo computation"; #endif diff --git a/Source/DynamicalModels/ObjectStates/imstkSPHState.cpp b/Source/DynamicalModels/ObjectStates/imstkSPHState.cpp index 4acf9de19853cf0d1f81934cf105258e7d7ec857..47f9630960127c23aede1189e388ffd4a41121d6 100644 --- a/Source/DynamicalModels/ObjectStates/imstkSPHState.cpp +++ b/Source/DynamicalModels/ObjectStates/imstkSPHState.cpp @@ -55,7 +55,7 @@ SPHKinematicState::setState(const std::shared_ptr<SPHKinematicState>& rhs) void SPHSimulationState::initializeData() { - CHECK(m_KinematicState) << "SPH basic state has not been initialized"; + CHECK(m_KinematicState != nullptr) << "SPH basic state has not been initialized"; size_t numParticles = m_KinematicState->getNumParticles(); diff --git a/Source/Geometry/Map/imstkIdentityMap.cpp b/Source/Geometry/Map/imstkIdentityMap.cpp index 6ff7f5bd35279285a8e8a6da8a8e2f6925852979..402f974877a1d52c1278853ae1b070c0f6949207 100644 --- a/Source/Geometry/Map/imstkIdentityMap.cpp +++ b/Source/Geometry/Map/imstkIdentityMap.cpp @@ -34,7 +34,7 @@ IdentityMap::apply() } // Check geometries - CHECK(m_master && m_slave) << "Identity map is being applied without valid geometries"; + CHECK(m_master != nullptr && m_slave != nullptr) << "Identity map is being applied without valid geometries"; // Set the follower mesh configuration to be same as that of master m_slave->setTranslation(m_master->getTranslation()); diff --git a/Source/Geometry/Map/imstkOneToOneMap.cpp b/Source/Geometry/Map/imstkOneToOneMap.cpp index a98554d4dbbc2726a5143a24d8af6baf7bd162e2..f2630e4f4b6cbee99e753f843be5f5e6ed7e45f5 100644 --- a/Source/Geometry/Map/imstkOneToOneMap.cpp +++ b/Source/Geometry/Map/imstkOneToOneMap.cpp @@ -31,12 +31,12 @@ namespace imstk void OneToOneMap::compute() { - CHECK(m_master && m_slave) << "OneToOneMap map is being applied without valid geometries"; + CHECK(m_master != nullptr && m_slave != nullptr) << "OneToOneMap map is being applied without valid geometries"; auto meshMaster = std::dynamic_pointer_cast<PointSet>(m_master); auto meshSlave = std::dynamic_pointer_cast<PointSet>(m_slave); - CHECK(meshMaster && meshSlave) << "Fail to cast from geometry to pointset"; + CHECK(meshMaster != nullptr && meshSlave != nullptr) << "Fail to cast from geometry to pointset"; m_oneToOneMap.clear(); ParallelUtils::SpinLock lock; @@ -176,7 +176,7 @@ OneToOneMap::apply() } // Check geometries - CHECK(m_master && m_slave) << "OneToOneMap map is being applied without valid geometries"; + CHECK(m_master != nullptr && m_slave != nullptr) << "OneToOneMap map is being applied without valid geometries"; // Check data CHECK(m_oneToOneMap.size() == m_oneToOneMapVector.size()) << "Internal data is corrupted"; diff --git a/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp b/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp index c05812d25a412bff6c6311f9ca098733a5b7ee9b..815099c9abe03c0c7f8942535365fb4ee65c8317 100644 --- a/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp +++ b/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp @@ -103,7 +103,7 @@ bool TetrahedralMesh::extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh, const bool enforceWindingConsistency /* = false*/) { - CHECK(surfaceMesh) + CHECK(surfaceMesh != nullptr) << "TetrahedralMesh::extractSurfaceMesh error: the surface mesh provided is not instantiated."; using triArray = SurfaceMesh::TriangleArray; diff --git a/Source/Geometry/Reader/imstkAssimpMeshIO.cpp b/Source/Geometry/Reader/imstkAssimpMeshIO.cpp index bf0879c9bb53486674986ba282dad63d15435c4c..a83735c9e8c22ba1ce9aad6c195deeaf1d72a4a0 100644 --- a/Source/Geometry/Reader/imstkAssimpMeshIO.cpp +++ b/Source/Geometry/Reader/imstkAssimpMeshIO.cpp @@ -53,7 +53,7 @@ AssimpMeshIO::readMeshData(const std::string& filePath) auto scene = importer.ReadFile(filePath, AssimpMeshIO::getDefaultPostProcessSteps()); // Check if there is actually a mesh or if the file can be read - CHECK(scene && scene->HasMeshes()) << "AssimpMeshIO::readMeshData error: could not read with reader."; + CHECK(scene != nullptr && scene->HasMeshes()) << "AssimpMeshIO::readMeshData error: could not read with reader."; // Get first mesh auto importedMesh = scene->mMeshes[0]; diff --git a/Source/Geometry/Reader/imstkVTKMeshIO.h b/Source/Geometry/Reader/imstkVTKMeshIO.h index bdaab1f6fbb651d3457d23f44c036300fa87e6a5..82a4f5100fa010806c3c46df1e5280c63e755ef4 100644 --- a/Source/Geometry/Reader/imstkVTKMeshIO.h +++ b/Source/Geometry/Reader/imstkVTKMeshIO.h @@ -96,8 +96,8 @@ protected: /// /// \brief Writes the given volumetric mesh to given file path /// - static bool VTKMeshIO::writeVtkUnstructuredGrid(const TetrahedralMesh& tetMesh, const std::string& filePath); - static bool VTKMeshIO::writeVtkUnstructuredGrid(const HexahedralMesh& hMesh, const std::string& filePath); + static bool writeVtkUnstructuredGrid(const TetrahedralMesh& tetMesh, const std::string& filePath); + static bool writeVtkUnstructuredGrid(const HexahedralMesh& hMesh, const std::string& filePath); /// /// \brief diff --git a/Source/Geometry/Reader/imstkVegaMeshIO.cpp b/Source/Geometry/Reader/imstkVegaMeshIO.cpp index f604d9977109737c03c7c77abf6e17ce752a27ed..c5e1d92f7d735ce943489793913ade2c329bc424 100644 --- a/Source/Geometry/Reader/imstkVegaMeshIO.cpp +++ b/Source/Geometry/Reader/imstkVegaMeshIO.cpp @@ -50,7 +50,7 @@ VegaMeshIO::write(const std::shared_ptr<imstk::PointSet> imstkMesh, const std::s // extract volumetric mesh const auto imstkVolMesh = std::dynamic_pointer_cast<imstk::VolumetricMesh>(imstkMesh); - CHECK(imstkVolMesh) << "VegaMeshIO::write error: imstk::Mesh is not a volumetric mesh"; + CHECK(imstkVolMesh != nullptr) << "VegaMeshIO::write error: imstk::Mesh is not a volumetric mesh"; switch (imstkVolMesh->getType()) { @@ -58,7 +58,7 @@ VegaMeshIO::write(const std::shared_ptr<imstk::PointSet> imstkMesh, const std::s case Geometry::Type::HexahedralMesh: auto vegaMesh = convertVolumetricMeshToVegaMesh(imstkVolMesh); - CHECK(vegaMesh) << "VegaMeshIO::write error: failed to convert volumetric mesh to vega mesh"; + CHECK(vegaMesh != nullptr) << "VegaMeshIO::write error: failed to convert volumetric mesh to vega mesh"; const auto fileName = const_cast<char*>(filePath.c_str()); const int write_status = vegaMesh->save(fileName); @@ -180,7 +180,7 @@ VegaMeshIO::convertVolumetricMeshToVegaMesh(const std::shared_ptr<imstk::Volumet std::shared_ptr<vega::TetMesh> vegaMesh = std::make_shared<vega::TetMesh>(int(imstkVolTetMesh->getNumVertices()), &vertices[0], int(imstkVolTetMesh->getNumTetrahedra()), &elements[0], E, nu, density); - CHECK(vegaMesh) << "VegaMeshIO::convertVolumetricMeshToVegaMesh error: Failed to create vega mesh"; + CHECK(vegaMesh != nullptr) << "VegaMeshIO::convertVolumetricMeshToVegaMesh error: Failed to create vega mesh"; return vegaMesh; } diff --git a/Source/Geometry/imstkGeometryUtilities.cpp b/Source/Geometry/imstkGeometryUtilities.cpp index af245070bf21869efd2eed26eccc031ed9bd12f9..0000f7dc6063760a3ebdc106e862146ff49f0f14 100644 --- a/Source/Geometry/imstkGeometryUtilities.cpp +++ b/Source/Geometry/imstkGeometryUtilities.cpp @@ -32,6 +32,18 @@ #include <vtkTriangleFilter.h> #include <vtkUnstructuredGrid.h> +#ifndef _MSC_VER +namespace std +{ +template<typename T, typename ... Args> +std::unique_ptr<T> +make_unique(Args&&... args) +{ + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); +} +} +#endif + namespace imstk { std::unique_ptr<SurfaceMesh> @@ -346,4 +358,4 @@ GeometryUtils::loopSubdivideSurfaceMesh(const SurfaceMesh& surfaceMesh, const in return convertVtkPolyDataToSurfaceMesh(filter->GetOutput()); } -} \ No newline at end of file +} diff --git a/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp b/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp index 2a50b53b4886194b604426bd62571f29fb4b3b76..b28ebc945dc13c70fe890bf0c3499323a572134c 100644 --- a/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp +++ b/Source/Rendering/VTKRenderer/imstkVTKTextureDelegate.cpp @@ -65,8 +65,8 @@ VTKTextureDelegate::loadTexture(std::shared_ptr<Texture> texture) imgReader = readerFactory->CreateImageReader2(sideName.c_str()); - CHECK(imgReader) << "VTKTextureDelegate::loadTexture error: could not find reader for " - << sideName; + CHECK(imgReader != nullptr) << "VTKTextureDelegate::loadTexture error: could not find reader for " + << sideName; auto imageFlip = vtkSmartPointer<vtkImageFlip>::New(); imageFlip->SetFilteredAxis(1); @@ -81,8 +81,8 @@ VTKTextureDelegate::loadTexture(std::shared_ptr<Texture> texture) vtkImageReader2* imgReader; imgReader = readerFactory->CreateImageReader2(tFileName.c_str()); - CHECK(imgReader) << "VTKTextureDelegate::loadTexture error: could not find reader for " - << tFileName; + CHECK(imgReader != nullptr) << "VTKTextureDelegate::loadTexture error: could not find reader for " + << tFileName; imgReader->SetFileName(tFileName.c_str()); imgReader->Update(); diff --git a/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp b/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp index 97117a2f7da21f63bff0042f4a5faf64385d3762..25578dd4d4689b91e2358943b70f7094f5f8d535 100644 --- a/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp +++ b/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp @@ -53,7 +53,7 @@ VisualObjectImporter::importVisualObject( auto scene = importer.ReadFile(modelFilePath, AssimpMeshIO::getDefaultPostProcessSteps()); // Check if there is actually a mesh or if the file can be read - CHECK(scene && scene->HasMeshes()) << "AssimpMeshIO::readMeshData error: could not read with reader."; + CHECK(scene != nullptr && scene->HasMeshes()) << "AssimpMeshIO::readMeshData error: could not read with reader."; std::vector<std::string> materialTextureCoreFileNames; std::vector<std::string> materialTextureFileExtensions; diff --git a/Source/Scene/SceneElements/Objects/imstkDeformableObject.cpp b/Source/Scene/SceneElements/Objects/imstkDeformableObject.cpp index 6c56759b85265c01a2a409a22c1b801886604803..d4f4c72db82ada36c2e08152cd6be98e9d3ca553 100644 --- a/Source/Scene/SceneElements/Objects/imstkDeformableObject.cpp +++ b/Source/Scene/SceneElements/Objects/imstkDeformableObject.cpp @@ -26,7 +26,7 @@ namespace imstk Vectord& DeformableObject::getContactForce() { - CHECK(m_defModel) << "deformation model pointer not valid DeformableObject::getContactForce()"; + CHECK(m_defModel != nullptr) << "deformation model pointer not valid DeformableObject::getContactForce()"; return m_defModel->getContactForce(); } diff --git a/Source/Scene/SceneElements/Objects/imstkPbdObject.cpp b/Source/Scene/SceneElements/Objects/imstkPbdObject.cpp index 33f7b76aea628ed195f5ee43d8004aea311250d6..763374be61640f55a76efd7191bee801a5bff1d8 100644 --- a/Source/Scene/SceneElements/Objects/imstkPbdObject.cpp +++ b/Source/Scene/SceneElements/Objects/imstkPbdObject.cpp @@ -32,7 +32,7 @@ PbdObject::initialize() { m_pbdModel = std::dynamic_pointer_cast<PbdModel>(m_dynamicalModel); - CHECK(m_pbdModel) << "Dynamics pointer cast failure in PbdObject::initialize()"; + CHECK(m_pbdModel != nullptr) << "Dynamics pointer cast failure in PbdObject::initialize()"; return DynamicObject::initialize(); } @@ -70,4 +70,4 @@ PbdObject::reset() DynamicObject::reset(); this->updateVelocity(); } -} //imstk \ No newline at end of file +} //imstk diff --git a/Source/SimulationManager/imstkViewer.cpp b/Source/SimulationManager/imstkViewer.cpp index 690953f737748cd900606db28ae0e9c6a3379ee0..6547c717570c6a2edd681a7c753384b23c068687 100644 --- a/Source/SimulationManager/imstkViewer.cpp +++ b/Source/SimulationManager/imstkViewer.cpp @@ -32,7 +32,7 @@ Viewer::getActiveScene() const const std::shared_ptr<Renderer>& Viewer::getActiveRenderer() const { - CHECK(m_activeScene) << "no active scene!"; + CHECK(m_activeScene != nullptr) << "no active scene!"; return m_rendererMap.at(m_activeScene); } diff --git a/Source/apiUtilities/imstkAPIUtilities.h b/Source/apiUtilities/imstkAPIUtilities.h index 4ff78fc8ffe8208454f9d4539ab31174dcd38c87..4f7d072c9ef68f58049b85e8a383ab6769c622be 100644 --- a/Source/apiUtilities/imstkAPIUtilities.h +++ b/Source/apiUtilities/imstkAPIUtilities.h @@ -60,7 +60,7 @@ createVisualAnalyticalSceneObject(Geometry::Type type, const double scale = 1., const Vec3d t = Vec3d(0., 0., 0.)) { - CHECK(scene) << "createVisualAnalyticalSceneObject: Scene is not valid!"; + CHECK(scene != nullptr) << "createVisualAnalyticalSceneObject: Scene is not valid!"; CHECK(!objName.empty()) << "createVisualAnalyticalSceneObject: Name is empty!"; std::shared_ptr<Geometry> geom; @@ -111,7 +111,7 @@ createCollidingAnalyticalSceneObject(Geometry::Type type, const double scale = 1., const Vec3d t = Vec3d(0., 0., 0.)) { - CHECK(scene) << "createCollidingSphereSceneObject: Scene is not valid!"; + CHECK(scene != nullptr) << "createCollidingSphereSceneObject: Scene is not valid!"; CHECK(!objName.empty()) << "createCollidingAnalyticalSceneObject: Name is empty!"; std::shared_ptr<Geometry> geom; @@ -153,7 +153,7 @@ createAndAddVisualSceneObject(std::shared_ptr<Scene> scene, const std::string fileName, const std::string objectName) { - CHECK(scene) << "createAndAddVisualSceneObject: Scene is not valid!"; + CHECK(scene != nullptr) << "createAndAddVisualSceneObject: Scene is not valid!"; CHECK(!fileName.empty()) << "createAndAddVisualSceneObject: Name is empty!"; auto mesh = MeshIO::read(fileName); @@ -174,7 +174,7 @@ createAndAddVisualSceneObject(std::shared_ptr<Scene> scene, std::shared_ptr<NonLinearSystem> createNonLinearSystem(std::shared_ptr<FEMDeformableBodyModel> dynaModel) { - CHECK(dynaModel) << "createNonLinearSystem: Dynamic model is not valid!"; + CHECK(dynaModel != nullptr) << "createNonLinearSystem: Dynamic model is not valid!"; auto nlSystem = std::make_shared<NonLinearSystem>( dynaModel->getFunction(),