Commit b0a4f875 authored by Nghia Truong's avatar Nghia Truong
Browse files

BUG: Fix error in examples due to changing in PBD system

parent c0632bed
......@@ -28,8 +28,23 @@ using namespace imstk;
///
/// \brief This example demonstrates the imstk graph usage
///
int main()
int main(int argc, char** argv)
{
Graph::ColoringMethod method = Graph::ColoringMethod::WelshPowell;
if (argc > 1)
{
auto param = std::string(argv[1]);
if (param.find("method") == 0 &&
param.find_first_of("=") != std::string::npos)
{
if (param.substr(param.find_first_of("=") + 1) == "greedy")
{
method = Graph::ColoringMethod::Greedy;
}
// else: no need to set
}
}
Graph g1(5);
g1.addEdge(0, 1);
g1.addEdge(0, 2);
......@@ -39,7 +54,7 @@ int main()
g1.addEdge(3, 4);
g1.print();
auto colorsG1 = g1.doGreedyColoring(0);
auto colorsG1 = g1.doColoring(method, true);
Graph g2(5);
g2.addEdge(0, 1);
......@@ -50,7 +65,7 @@ int main()
g2.addEdge(4, 3);
g2.print();
auto colorsG2 = g2.doGreedyColoring(1);
auto colorsG2 = g2.doColoring(method, true);
auto tetMesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.veg");
if (!tetMesh)
......@@ -66,11 +81,11 @@ int main()
LOG(WARNING) << "Dynamic pointer cast from PointSet to TetrahedralMesh failed!";
return 1;
}
auto colorsGVMesh = volMesh->getMeshGraph().doGreedyColoring(true);
auto colorsGVMesh = volMesh->getMeshGraph()->doColoring(method, true);
auto surfMesh = std::make_shared<SurfaceMesh>();
volMesh->extractSurfaceMesh(surfMesh, true);
auto colorsGSMesh = surfMesh->getMeshGraph().doGreedyColoring(true);
auto colorsGSMesh = surfMesh->getMeshGraph()->doColoring(method, true);
}
std::cout << "Press any key to exit!" << std::endl;
......
......@@ -20,6 +20,7 @@
=========================================================================*/
#include "imstkSimulationManager.h"
#include "imstkPbdModel.h"
#include "imstkPbdObject.h"
#include "imstkPbdSolver.h"
#include "imstkAPIUtilities.h"
......
......@@ -20,6 +20,7 @@
=========================================================================*/
#include "imstkSimulationManager.h"
#include "imstkPbdModel.h"
#include "imstkPbdObject.h"
#include "imstkPbdSolver.h"
#include "imstkAPIUtilities.h"
......
......@@ -20,6 +20,7 @@
=========================================================================*/
#include "imstkSimulationManager.h"
#include "imstkPbdModel.h"
#include "imstkPbdObject.h"
#include "imstkPbdSolver.h"
#include "imstkTetrahedralMesh.h"
......
......@@ -21,6 +21,7 @@
#include "imstkSimulationManager.h"
#include "imstkMeshIO.h"
#include "imstkPbdModel.h"
#include "imstkPbdObject.h"
#include "imstkPbdSolver.h"
#include "imstkOneToOneMap.h"
......
......@@ -21,6 +21,7 @@
#include "imstkSimulationManager.h"
#include "imstkMeshIO.h"
#include "imstkPbdModel.h"
#include "imstkPbdObject.h"
#include "imstkPbdSolver.h"
#include "imstkOneToOneMap.h"
......
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