![]() |
|
A class used for fast sparse traversals of VdfNetworks in the output-to-input direction. More...
#include <sparseInputTraverser.h>
Public Types | |
| enum | CallbackMode { CallbackModeAllNodes , CallbackModeTerminalNodes } |
| Callback mode for the node callback. More... | |
Basic Traversal | |
| using | NodeCallback = std::function< bool(const VdfNode &)> |
| Callback used when traversing a network. | |
| using | ConnectionCallback = std::function< bool(const VdfConnection &, const VdfMask &)> |
| Callback used when traversing a network. | |
| static VDF_API void | Traverse (const VdfMaskedOutputVector &outputs, const NodeCallback &nodeCallback, CallbackMode callbackMode=CallbackModeAllNodes) |
Traverses the network in the input direction, starting from the masked outputs in outputs. | |
| static VDF_API void | TraverseWithConnectionCallback (const VdfMaskedOutputVector &outputs, const ConnectionCallback &connectionCallback) |
Traverses the network in the input direction, starting from the masked outputs in outputs. | |
Traversal with Path Reporting | |
| using | NodePathCallback = std::function< bool(const VdfNode &node, const VdfObjectPtrVector &path)> |
| Callback used when traversing a network with path information. | |
| using | ConnectionPathCallback = std::function< bool(const VdfConnection &, const VdfMask &, const VdfObjectPtrVector &)> |
| Callback used when traversing a network. | |
| static VDF_API void | TraverseWithPath (const VdfMaskedOutputVector &outputs, const NodePathCallback &nodePathCallback, const ConnectionPathCallback &connectionPathCallback, CallbackMode callbackMode=CallbackModeAllNodes) |
Traverses the network in the input direction, starting from the masked outputs in outputs, providing the traversal path to each invocation of nodePathCallback. | |
A class used for fast sparse traversals of VdfNetworks in the output-to-input direction.
A sparse traversal takes affects masks into account and avoids traversing nodes that don't have an affect on the outputs requested for the traversal. This is most often useful for dependency traversals.
In contrast, VdfIsTopologicalSourceNode() does a full topological traversal.
Definition at line 42 of file sparseInputTraverser.h.
| using ConnectionCallback = std::function< bool (const VdfConnection &, const VdfMask &)> |
Callback used when traversing a network.
Called for each connection and dependency mask that is visited while traversing nodes that affect values of the initial masked outputs.
Definition at line 96 of file sparseInputTraverser.h.
| using ConnectionPathCallback = std::function< bool (const VdfConnection &, const VdfMask &, const VdfObjectPtrVector &)> |
Callback used when traversing a network.
Called for each connection and dependency mask that is visited that affects values of the initial masked outputs. Note that the currently visited connection isn't appended to the path yet.
Definition at line 137 of file sparseInputTraverser.h.
| using NodeCallback = std::function<bool (const VdfNode &)> |
Callback used when traversing a network.
Called for each node that is visited that affects values of the initial masked outputs.
A return value of false halts traversal locally but allows prior branches of traversal to continue.
Definition at line 68 of file sparseInputTraverser.h.
| using NodePathCallback = std::function< bool (const VdfNode &node, const VdfObjectPtrVector &path)> |
Callback used when traversing a network with path information.
Called for each node that is visited in the sparse traversal.
The path to the visited node from the start is given by path and it only contains nodes that have an affect on the requested outputs.
Definition at line 128 of file sparseInputTraverser.h.
| enum CallbackMode |
Callback mode for the node callback.
| Enumerator | |
|---|---|
| CallbackModeAllNodes | Invoke the node callback on all inputs. This is the default. |
| CallbackModeTerminalNodes | Invoke the node callback only on terminal nodes. |
Definition at line 47 of file sparseInputTraverser.h.
|
static |
Traverses the network in the input direction, starting from the masked outputs in outputs.
Calls nodeCallback for each node visited in the sparse traversal.
If callbackMode is set to CallbackModeTerminalNodes, then the nodeCallback is only invoked on terminal nodes (i.e. nodes without input connections). If it is set to CallbackModeAllNodes (which is the default), then the callback is invoked on all nodes that are visited by the traverser.
If the callback returns false, then traversal halts locally but prior branches of traversal continue.
|
static |
Traverses the network in the input direction, starting from the masked outputs in outputs.
The traversal is identical to the one provided by Traverse(), except this method calls a connection callback instad of a node callback.
Calls connectionCallback for each connection visited in the sparse traversal.
If the callback returns false, then traversal along the supplied connection stops, and traversal along sibling connections continues.
|
static |
Traverses the network in the input direction, starting from the masked outputs in outputs, providing the traversal path to each invocation of nodePathCallback.
Calls nodePathCallback (if specified) for each node visited in the sparse traversal. A sparse traversal only visits nodes that have an affect on the requested outputs.
Calls connectionCallback (if specified) for each node visited in the sparse traversal. A sparse traversal only visits nodes that have an affect on the requested outputs.
If callbackMode is set to CallbackModeTerminalNodes, then the nodeCallback is only invoked on terminal nodes (i.e. nodes without input connections). If it is set to CallbackModeAllNodes (which is the default), then the callback is invoked on all nodes that are visited by the traverser.