![]() |
|
A class used for fast sparse traversals of VdfNetworks in the output-to-input direction in a vectorized manner. More...
#include <sparseVectorizedInputTraverser.h>
Public Types | |
| enum | CallbackMode { CallbackModeAllNodes , CallbackModeTerminalNodes } |
| Callback mode for the node callback. More... | |
Basic Traversal | |
| using | NodeCallback = std::function< bool(const VdfNode &, const TfBits &)> |
| Callback used when traversing a network. | |
| using | ConnectionCallback = std::function< bool(const VdfConnection &, const TfBits &)> |
| Callback used when traversing a network. | |
| VDF_API void | Traverse (const VdfMaskedOutputVector &sharedMaskedOutputs, const NodeCallback &nodeCallback, CallbackMode callbackMode) |
Traverses the network in the input direction, starting from the masked outputs in sharedMaskedOutputs. | |
| VDF_API void | TraverseWithConnectionCallback (const VdfMaskedOutputVector &sharedMaskedOutputs, const ConnectionCallback &connectionCallback) |
Traverses the network in the input direction, starting from the masked outputs in sharedMaskedOutputs. | |
A class used for fast sparse traversals of VdfNetworks in the output-to-input direction in a vectorized manner.
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 46 of file sparseVectorizedInputTraverser.h.
| using ConnectionCallback = std::function< bool (const VdfConnection &, const TfBits &)> |
Callback used when traversing a network.
Called for each connection that is visited that affects values of the initial requests. The TfBits parameter is used to identify which requests caused the callback to be called.
A return value of false halts traversal locally but allows prior branches of traversal to continue.
Definition at line 105 of file sparseVectorizedInputTraverser.h.
| using NodeCallback = std::function< bool (const VdfNode &, const TfBits &)> |
Callback used when traversing a network.
Called for each node that is visited that affects values of the initial requests. The TfBits parameter is used to identify which requests caused the callback to be called.
A return value of false halts traversal locally but allows prior branches of traversal to continue.
Definition at line 72 of file sparseVectorizedInputTraverser.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 51 of file sparseVectorizedInputTraverser.h.
| VDF_API void Traverse | ( | const VdfMaskedOutputVector & | sharedMaskedOutputs, |
| const NodeCallback & | nodeCallback, | ||
| CallbackMode | callbackMode | ||
| ) |
Traverses the network in the input direction, starting from the masked outputs in sharedMaskedOutputs.
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.
| VDF_API void TraverseWithConnectionCallback | ( | const VdfMaskedOutputVector & | sharedMaskedOutputs, |
| const ConnectionCallback & | connectionCallback | ||
| ) |
Traverses the network in the input direction, starting from the masked outputs in sharedMaskedOutputs.
Calls connectionCallback for each connection visited in the sparse traversal.
If the callback returns false, then traversal halts locally but prior branches of traversal continue.