iMSTK
Interactive Medical Simulation Toolkit
imstkTaskGraphController.cpp
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #include "imstkTaskGraphController.h"
8 #include "imstkTaskGraph.h"
9 #include "imstkLogger.h"
10 
11 namespace imstk
12 {
13 bool
15 {
16  // Ensure the source is reachable from the sink and the graph is not cyclic
17  // Still doesn't garuntee all nodes reach sink
18  if (!m_graph->isReachable(m_graph->getSource(), m_graph->getSink()))
19  {
20  LOG(WARNING) << "TaskGraph Sink not reachable from source. Graph initialization failed.";
21  return false;
22  }
23 
24  if (TaskGraph::isCyclic(m_graph))
25  {
26  LOG(WARNING) << "TaskGraph is cyclic. Graph initialization failed.";
27  return false;
28  }
29 
30  init();
31  return true;
32 }
33 } // namespace imstk
static bool isCyclic(std::shared_ptr< TaskGraph > graph)
Returns if Graph is cyclic or not.
Compound Geometry.
bool initialize()
Initialization of the TaskGraphController, good for anything the controller may need to do after it r...
virtual void init()
Subclass initialization call.