Commit 96f118f5 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

Merge branch 'cleanUp2' into 'master'

Upgrade some warnings to fatal errors

See merge request iMSTK/iMSTK!359
parents 02269740 847d4fbd
......@@ -39,7 +39,7 @@ playSound(const std::string& filename)
sf::SoundBuffer buffer;
if (!buffer.loadFromFile(filename))
{
LOG(WARNING) << "testSound: Could not open the input sound file: " << filename;
LOG(FATAL) << "testSound: Could not open the input sound file: " << filename;
return;
}
......@@ -86,7 +86,7 @@ playMusic(const std::string& filename)
sf::Music music;
if (!music.openFromFile(filename))
{
LOG(WARNING) << "playMusic: Could not open the input music file: " << filename;
LOG(FATAL) << "playMusic: Could not open the input music file: " << filename;
return;
}
......
......@@ -80,7 +80,7 @@ main()
auto tetMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg");
if (!tetMesh)
{
LOG(WARNING) << "Could not read mesh from file.";
LOG(FATAL) << "Could not read mesh from file.";
return 1;
}
auto bone = std::make_shared<CollidingObject>("Bone");
......
......@@ -52,7 +52,7 @@ main()
auto tetMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg");
if (!tetMesh)
{
LOG(WARNING) << "Could not read mesh from file.";
LOG(FATAL) << "Could not read mesh from file.";
return 1;
}
......@@ -61,7 +61,7 @@ main()
auto volTetMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh);
if (!volTetMesh)
{
LOG(WARNING) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!";
LOG(FATAL) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!";
return 1;
}
volTetMesh->extractSurfaceMesh(surfMesh, true);
......
......@@ -42,7 +42,7 @@ main()
if (!sceneObj)
{
LOG(WARNING) << "ERROR: Unable to create scene object";
LOG(FATAL) << "ERROR: Unable to create scene object";
return 1;
}
......
......@@ -89,12 +89,7 @@ main(int argc, char** argv)
}
else
{
auto volMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh);
if (!volMesh)
{
LOG(WARNING) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!";
return 1;
}
auto volMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh);
auto colorsGVMesh = volMesh->getMeshGraph()->doColoring(method, true);
auto surfMesh = std::make_shared<SurfaceMesh>();
......
......@@ -46,12 +46,6 @@ main()
//auto vtkMesh2 = MeshIO::read(iMSTK_DATA_ROOT"/nidus/nidus.vtk");
auto vegaMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg");
if (!vegaMesh)
{
LOG(WARNING) << "Unable to load mesh!";
return 1;
}
// Extract surface mesh
auto volumeMesh = std::dynamic_pointer_cast<VolumetricMesh>(vegaMesh); // change to any volumetric mesh above
volumeMesh->computeAttachedSurfaceMesh();
......
......@@ -38,11 +38,6 @@ main()
// Load a volumetric mesh (from .msh file)
std::string ifile = iMSTK_DATA_ROOT "/liver/liver.msh";
auto volMeshA = MeshIO::read(ifile);
if (!volMeshA)
{
LOG(WARNING) << "Failed to read msh file : " << ifile;
return 1;
}
// Extract surface mesh
auto volumeMeshA = std::dynamic_pointer_cast<VolumetricMesh>(volMeshA); // change to any volumetric mesh above
......@@ -65,11 +60,6 @@ main()
// Read the above written veg file
auto volMeshB = MeshIO::read(ofile);
if (!volMeshB)
{
LOG(WARNING) << "Failed to extract topology/geometry from the veg file : " << ofile;
return 1;
}
// Extract surface mesh
auto volumeMeshB = std::dynamic_pointer_cast<VolumetricMesh>(volMeshB); // change to any volumetric mesh above
......
......@@ -156,7 +156,7 @@ main()
// This is significantly slower than incremental update!
// octree.setAlwaysRebuild(true);
// Create debug geometry for the octree (render up to 8 levels, and render all non-emtpy nodes)
// Create debug geometry for the octree (render up to 8 levels, and render all non-empty nodes)
const auto debugOctree = octree.getDebugGeometry(8, true);
scene->addDebugGeometry(debugOctree);
......
......@@ -45,20 +45,10 @@ main()
// Load a sample mesh
auto tetMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg");
if (!tetMesh)
{
LOG(WARNING) << "Could not read mesh from file.";
return 1;
}
auto surfMesh = std::make_shared<SurfaceMesh>();
auto surfMeshVisual = std::make_shared<SurfaceMesh>();
auto volTetMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh);
if (!volTetMesh)
{
LOG(WARNING) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!";
return 1;
}
volTetMesh->extractSurfaceMesh(surfMesh, true);
auto material = std::make_shared<RenderMaterial>();
......
......@@ -44,11 +44,6 @@ main()
// Load a sample mesh
auto tetMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg");
if (!tetMesh)
{
LOG(WARNING) << "Could not read mesh from file.";
return 1;
}
auto fluidMesh = std::make_shared<PointSet>();
fluidMesh->initialize(tetMesh->getInitialVertexPositions());
......
......@@ -42,20 +42,10 @@ main()
// Load a sample mesh
auto tetMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg");
if (!tetMesh)
{
LOG(WARNING) << "Could not read mesh from file.";
return 1;
}
// Extract the surface mesh
auto surfMesh = std::make_shared<SurfaceMesh>();
auto volTetMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh);
if (!volTetMesh)
{
LOG(WARNING) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!";
return 1;
}
volTetMesh->extractSurfaceMesh(surfMesh, true);
auto material = std::make_shared<RenderMaterial>();
......
......@@ -59,7 +59,6 @@ RenderParticleEmitter::setGeometry(
if (geometry->getType() != Geometry::Type::RenderParticles)
{
LOG(FATAL) << "Geometry must be RenderParticles";
return;
}
m_animationGeometry = geometry;
......
......@@ -356,7 +356,7 @@ OctreeBasedCD::checkPointWithPrimitive(OctreePrimitive* const pPrimitive1, Octre
break;
default:
LOG(FATAL) << "Unsupported collision type";
LOG(FATAL) << "Unsupported collision type!";
}
}
......@@ -391,7 +391,7 @@ OctreeBasedCD::checkNonPointWithPrimitive(OctreePrimitive* const pPrimitive1, Oc
break;
default:
LOG(FATAL) << "Unsupported collision type";
LOG(FATAL) << "Unsupported collision type!";
}
}
......
......@@ -44,7 +44,7 @@ BoneDrillingCH::BoneDrillingCH(const Side& side,
if (!boneMesh)
{
LOG(WARNING) << "BoneDrillingCH::BoneDrillingCH Error:The bone colliding geometry is not a mesh!";
LOG(FATAL) << "BoneDrillingCH::BoneDrillingCH Error:The bone colliding geometry is not a mesh!";
}
// Initialize bone density values
......
......@@ -42,8 +42,8 @@ CollisionHandling::make_collision_handling(const Type&
if (type != Type::None
&& objA->getType() == SceneObject::Type::Visual)
{
LOG(WARNING) << "CollisionHandling::make_collision_handling error: "
<< "penalty collision handling only implemented for colliding objects.";
LOG(FATAL) << "CollisionHandling::make_collision_handling error: "
<< "collision handling only implemented for colliding objects.";
return nullptr;
}
......@@ -53,12 +53,6 @@ CollisionHandling::make_collision_handling(const Type&
return nullptr;
case Type::Penalty:
if (objA->getType() == SceneObject::Type::Visual)
{
LOG(WARNING) << "CollisionHandling::make_collision_handling error: "
<< "penalty collision handling only implemented for colliding objects.";
return nullptr;
}
return std::make_shared<PenaltyCH>(side, colData, objA);
......@@ -67,13 +61,6 @@ CollisionHandling::make_collision_handling(const Type&
return std::make_shared<VirtualCouplingCH>(side, colData, objA);
case Type::NodalPicking:
if (objA->getType() == SceneObject::Type::Visual)
{
LOG(WARNING) << "CollisionHandling::make_collision_handling error: "
<< "penalty collision handling only implemented for colliding objects.";
return nullptr;
}
if (auto defObj = std::dynamic_pointer_cast<DeformableObject>(objA))
{
return std::make_shared<PickingCH>(side, colData, defObj);
......@@ -86,7 +73,7 @@ CollisionHandling::make_collision_handling(const Type&
return std::make_shared<SPHCollisionHandling>(side, colData, objA);
default:
LOG(WARNING) << "CollisionHandling::make_collision_handling error: type not implemented.";
LOG(FATAL) << "CollisionHandling::make_collision_handling error: type not implemented.";
return nullptr;
}
}
......
......@@ -70,7 +70,7 @@ PBDCollisionHandling::processCollisionData()
}
else
{
LOG(WARNING) << "Error: PBDCollisionHandling: no PbdSolver found to handle the Collision constraints...";
LOG(FATAL) << "No PbdSolver found to handle the Collision constraints!";
}
}
......
......@@ -52,9 +52,8 @@ PenaltyCH::processCollisionData()
}
else
{
LOG(WARNING) << "PenaltyRigidCH::computeContactForces error: "
<< "no penalty collision handling available for " << m_object->getName()
<< " (rigid mesh not yet supported).";
LOG(FATAL) << "no penalty collision handling available for " << m_object->getName()
<< " (rigid mesh not yet supported).";
}
}
......@@ -68,10 +67,7 @@ PenaltyCH::computeContactForcesAnalyticRigid(const std::shared_ptr<CollidingObje
if (analyticObj == nullptr)
{
LOG(WARNING) << "PenaltyRigidCH::computeContactForcesAnalyticRigid error: "
<< m_object->getName() << " is not a colliding object";
return;
LOG(FATAL) << m_object->getName() << " is not a colliding object";
}
// If collision data is valid, append forces
......@@ -103,8 +99,8 @@ PenaltyCH::computeContactForcesDiscreteDeformable(const std::shared_ptr<Deformab
if (deformableObj == nullptr)
{
LOG(WARNING) << "PenaltyRigidCH::computeContactForcesDiscreteDeformable error: "
<< m_object->getName() << " is not a deformable object.";
LOG(FATAL) << "PenaltyRigidCH::computeContactForcesDiscreteDeformable error: "
<< m_object->getName() << " is not a deformable object.";
return;
}
......
......@@ -42,8 +42,8 @@ PickingCH::processCollisionData()
}
else
{
LOG(WARNING) << "PickingCH::handleCollision error: "
<< "no picking collision handling available the object";
LOG(FATAL) << "PickingCH::handleCollision error: "
<< "no picking collision handling available the object";
}
}
......@@ -59,8 +59,8 @@ PickingCH::addPickConstraints(std::shared_ptr<DeformableObject> deformableObj)
if (deformableObj == nullptr)
{
LOG(WARNING) << "PenaltyRigidCH::addPickConstraints error: "
<< " not a deformable object.";
LOG(FATAL) << "PenaltyRigidCH::addPickConstraints error: "
<< " not a deformable object.";
return;
}
......
......@@ -38,7 +38,7 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A,
// Check that objects exist
if (A == nullptr || B == nullptr)
{
LOG(WARNING) << "InteractionPair error: invalid objects (nullptr).";
LOG(FATAL) << "InteractionPair error: invalid objects (nullptr).";
return;
}
......@@ -53,7 +53,7 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A,
std::shared_ptr<CollisionDetection> CD = CollisionDetection::makeCollisionDetectionObject(CDType, A, B, m_colData);
if (CD == nullptr)
{
LOG(WARNING) << "InteractionPair error: can not instantiate collision detection algorithm.";
LOG(FATAL) << "InteractionPair error: can not instantiate collision detection algorithm.";
return;
}
......@@ -64,8 +64,8 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A,
CHA = CollisionHandling::make_collision_handling(CHAType, CollisionHandling::Side::A, m_colData, A, B);
if (CHA == nullptr)
{
LOG(WARNING) << "InteractionPair error: can not instantiate collision handling for '"
<< A->getName() << "' object.";
LOG(FATAL) << "InteractionPair error: can not instantiate collision handling for '"
<< A->getName() << "' object.";
return;
}
}
......@@ -77,8 +77,8 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A,
CHB = CollisionHandling::make_collision_handling(CHBType, CollisionHandling::Side::B, m_colData, B, A);
if (CHB == nullptr)
{
LOG(WARNING) << "InteractionPair error: can not instantiate collision handling for '"
<< B->getName() << "' object.";
LOG(FATAL) << "InteractionPair error: can not instantiate collision handling for '"
<< B->getName() << "' object.";
return;
}
}
......@@ -102,7 +102,7 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A,
// Check that objects exist
if (A == nullptr || B == nullptr)
{
LOG(WARNING) << "InteractionPair error: invalid objects (nullptr).";
LOG(FATAL) << "InteractionPair error: invalid objects (nullptr).";
return;
}
......@@ -126,7 +126,7 @@ InteractionPair::computeCollisionData()
{
if (!m_valid)
{
LOG(WARNING) << "InteractionPair::computeCollisionData error: interaction not valid.";
LOG(FATAL) << "InteractionPair::computeCollisionData error: interaction not valid.";
return;
}
m_colDetect->computeCollisionData();
......@@ -137,7 +137,7 @@ InteractionPair::processCollisionData()
{
if (!m_valid)
{
LOG(WARNING) << "InteractionPair::computeContactForces error: interaction not valid.";
LOG(FATAL) << "InteractionPair::computeContactForces error: interaction not valid.";
return;
}
......
......@@ -56,13 +56,13 @@ createVisualAnalyticalSceneObject(imstk::Geometry::Type type,
{
if (!scene)
{
LOG(WARNING) << "createVisualAnalyticalSceneObject: Scene is not valid!";
LOG(FATAL) << "createVisualAnalyticalSceneObject: Scene is not valid!";
return nullptr;
}
if (objName.empty())
{
LOG(WARNING) << "createVisualAnalyticalSceneObject: Name is empty!";
LOG(FATAL) << "createVisualAnalyticalSceneObject: Name is empty!";
return nullptr;
}
......@@ -112,13 +112,13 @@ createCollidingAnalyticalSceneObject(imstk::Geometry::Type type,
{
if (!scene)
{
LOG(WARNING) << "createCollidingSphereSceneObject: Scene is not valid!";
LOG(FATAL) << "createCollidingSphereSceneObject: Scene is not valid!";
return nullptr;
}
if (objName.empty())
{
LOG(WARNING) << "createCollidingAnalyticalSceneObject: Name is empty!";
LOG(FATAL) << "createCollidingAnalyticalSceneObject: Name is empty!";
return nullptr;
}
......@@ -163,13 +163,13 @@ createAndAddVisualSceneObject(std::shared_ptr<imstk::Scene> scene,
{
if (!scene)
{
LOG(WARNING) << "createAndAddVisualSceneObject: Scene is not valid!";
LOG(FATAL) << "createAndAddVisualSceneObject: Scene is not valid!";
return nullptr;
}
if (fileName.empty())
{
LOG(WARNING) << "createAndAddVisualSceneObject: File name is empty!";
LOG(FATAL) << "createAndAddVisualSceneObject: File name is empty!";
return nullptr;
}
......@@ -193,7 +193,7 @@ createNonLinearSystem(std::shared_ptr<imstk::FEMDeformableBodyModel> dynaModel)
{
if (!dynaModel)
{
LOG(WARNING) << "createNonLinearSystem: Dynamic model is not valid!";
LOG(FATAL) << "createNonLinearSystem: Dynamic model is not valid!";
return nullptr;
}
......@@ -221,7 +221,7 @@ printUPS(std::shared_ptr<SceneManager> sceneManager, std::shared_ptr<UPSCounter>
{
sceneManager->setPreInitCallback([](Module* module)
{
LOG(INFO) << "-- Pre initialization of " << module->getName() << " module";
LOG(INFO) << "Pre initialization of " << module->getName() << " module";
});
sceneManager->setPreUpdateCallback([&ups](Module* module)
......@@ -232,13 +232,13 @@ printUPS(std::shared_ptr<SceneManager> sceneManager, std::shared_ptr<UPSCounter>
sceneManager->setPostUpdateCallback([&ups](Module* module)
{
ups->setEndPointOfUpdate();
std::cout << "\r-- " << module->getName() << " running at "
std::cout << "\r" << module->getName() << " running at "
<< ups->getUPS() << " ups " << std::flush;
});
sceneManager->setPostCleanUpCallback([](Module* module)
{
LOG(INFO) << "\n-- Post cleanup of " << module->getName() << " module";
LOG(INFO) << "\nPost cleanup of " << module->getName() << " module";
});
}
} //apiutils
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment