HDK
|
#include <PDG_Partitioner.h>
Public Member Functions | |
PDG_Partitioner (PDG_GraphContext *context, const UT_StringHolder &name, const PDG_NodeCallbackType *type_object, int custom_id=-1) | |
~PDG_Partitioner () override | |
void | memoryInfo (PDG_MemoryInfo &memory_info, bool inclusive) const override |
bool | deserializeWorkItem (PDG_WorkItem *work_item) override |
void | commitWorkItem (PDG_WorkItem *work_item) override |
Called after deserializing a work item and adding its dependencies. More... | |
void | queueWorkItemDeps (PDGE_Evaluator &evaluator, PDG_NodeSet &visited_nodes, PDG_WorkItemIDSet &visited_items, PDG_Filter &filter) override |
Public Member Functions inherited from PDG_Node | |
PDG_Node (PDG_GraphContext *context, const UT_StringHolder &name, const PDG_NodeCallbackType *type_object, PDG_NodeID id=-1) | |
~PDG_Node () override | |
const PDG_EventFilter & | supportedEventTypes () const override |
Returns the list of supported event types. More... | |
int64 | getMemoryUsage (bool inclusive) const override |
int64 | workItemMemory (bool attribs_only=false) const |
PDG_NodeID | getId () const |
Returns this node's id, it matches the TOP node id. More... | |
const UT_StringHolder & | name () const |
Returns the node's unique name. More... | |
void | rename (const UT_StringHolder &new_name) |
bool | performancePath (UT_WorkBuffer &buffer, const UT_StringHolder &event_name, const PDG_WorkItem *work_item) const |
const PDG_NodeCallbackType * | typeObject () const |
Returns the node's type object. More... | |
PDG_NodeType | nodeType () const |
Returns the node type, e.g. processor, mapper, etc. More... | |
PDG_NodeSubtype | nodeSubtype () const |
Returns the sub type, e.g. normal, foreach begin, foreach end, etd. More... | |
PDG_NodeState | nodeState () const |
Returns the current state of the node. More... | |
fpreal | nodeProgress () const |
Returns the current cook progress of the node. More... | |
const PDG_NodeOptions & | nodeOptions (bool do_update) |
const PDG_SortOptions & | sortOptions () const |
Returns the node's sort options struct. More... | |
const PDG_NodeStats & | stats () const |
Returns the node's stat object. More... | |
PDG_NodeStats & | stats () |
PDG_NodeCallback * | callback () const |
void | setCallback (PDG_NodeCallbackPtr callback) |
PDG_Scheduler * | scheduler () const |
Gets/sets the per-node scheduler override. More... | |
void | setScheduler (PDG_Scheduler *scheduler) |
const PDG_SchedulerSet & | schedulerReferences () const |
void | addSchedulerReference (PDG_Scheduler *scheduler) |
void | clearSchedulerReferences () |
PDG_GraphContext * | context () const |
Returns the graph context that owns the node. More... | |
int | loopDepth () const |
Returns the loop dpeth of the node. More... | |
PDG_ServiceResetWhen | loopResetWhen () const |
Returns the loop block's service reset conditoon. More... | |
PDG_ServiceResetType | loopResetType () const |
Returns the loop block's service reset type. More... | |
bool | isErrorHandler () const |
Returns true if the node is an error handler. More... | |
bool | isErrorHandlerBranch () const |
Returns true if the node is in an error handler branch. More... | |
void | setIsErrorHandler (bool error_handler) |
Sets the error handler flag on this node. More... | |
void | setIsErrorHandlerBranch (bool error_handler) |
Sets the error handler branch flag on this node. More... | |
bool | hasErrors () const |
Clears and checks the error flag. More... | |
bool | isGenerating () const |
bool | isDynamicEval () const |
bool | isDynamicGeneration () const |
bool | isDynamicProp () const |
bool | canHaveWorkItems () const |
const UT_StringHolder & | serviceName () const |
bool | useServiceBlock () const |
RegenerateReason | regenerateReason () const |
void | setRegenerateReason (RegenerateReason reason) |
void | updateRegenerateReason (RegenerateReason reason) |
void | setBypassState (BypassState state) |
Sets the bypassed flag on this node. More... | |
bool | updateBypassState (BypassState state) |
Updates the bypass flag of this node, if the new state is higher. More... | |
BypassState | bypassState () const |
bool | isBypassed () const |
Returns true if the node is bypassed. More... | |
bool | isLeaf () const |
Returns true if the node is a leaf, i.e it has no descendant nodes. More... | |
bool | isCooked () const |
void | dirty (bool remove_outputs) |
PDG_WorkItemDirty | prepareDirty () |
Prepares a dirty operation that can be applied later. More... | |
void | appendDirty (PDG_WorkItemDirty *dirty_state) |
Appends to an existing dirty operation. More... | |
void | freeze () |
void | freezeFrom (const PDG_WorkItemArray &work_items) |
Sets the work items in the node from the input list and freezes them. More... | |
bool | cook (bool blocking, UT_WorkBuffer &errors) |
void | cancel () |
Cancels any work items scheduled by this node. More... | |
virtual PDG_WorkItemCacheState | outputCacheState (const PDG_WorkItem *work_item) const |
Returns the cache state of a work item in this node. More... | |
void | startWorkItem (PDG_WorkItem *work_item) |
Notifies the node that the specified work item has started cooking. More... | |
int | reserveIndexBlock (int number) |
const PDG_NodeInterface * | templateInterface () const override |
PDG_Port * | addCustomParameter (PDGT_Value::DataType type, const UT_StringHolder &name, const UT_StringHolder &label, const UT_StringArray &tags, int size) |
int | connectionCount (PDG_PortType type, bool filter_bypassed=true, bool filter_reference=true) const |
Returns node connectivity information. More... | |
void | connectedNodes (PDG_NodeArray &nodes, PDG_PortType type, bool filter_bypassed=true, bool filter_reference=true) const |
PDG_Node * | firstConnectedNode (PDG_PortType type, bool filter_bypassed=true, bool filter_reference=true) const |
void | connectedAncestors (PDG_NodeSet &nodes, PDG_PortType type, bool filter_bypassed=true, bool filter_reference=true) |
void | addError (const UT_StringHolder &message) const override |
Emits a node level error from the node as PDG_Event. More... | |
void | addWarning (const UT_StringHolder &message) const override |
Emits a node level warning from the node as PDG_Event. More... | |
const UT_Array< PDG_Dependency * > & | dependencies () const |
void | addDependency (PDG_Dependency *dependency) |
void | removeDependency (PDG_Dependency *dependency) |
void | resolveDependencies () |
const PDG_WorkItemArray & | workItems () const |
void | workItemIDs (PDG_WorkItemIDArray &array, bool include_batches) const |
Returns the IDs of the work items in the node. More... | |
void | workItemsCopy (PDG_WorkItemArray &array, bool include_batches) const |
Returns a safe copy of the work item array. More... | |
template<typename Filter > | |
void | workItemsCopy (PDG_WorkItemArray &array, const Filter &filter) const |
void | batchItemsCopy (PDG_BatchWorkItemSet &set) const |
Returns a safe copy of the batch work item set. More... | |
void | removeWorkItems (const PDG_WorkItemConstArray &work_items) |
Removes a list of work item from the node. More... | |
bool | outputFiles (PDG_File::Array &files, bool localize) const |
bool | preCook (PDG_NodeSet &dirty, PDG_NodeSet &visited, bool &save_scene, bool has_filter) |
Runs precook logic for this node and recurses into input nodes. More... | |
int | preCookLoop () |
Sets the loop depth and loop block reference on the node. More... | |
void | postCook (PDG_NodeSet &visited) |
Runs postcook logic for this node and recurses into input nodes. More... | |
PDG_CacheID | addOutputCacheEntry (const UT_StringHolder &file, PDG_CacheID cache_id) |
PDG_CacheID | addModTimeCacheEntry (const PDG_File &file, const PDG_WorkItem *work_item) |
bool | saveJSON (std::ostream &os, bool binary) |
Serializes the work items in the node to the specified stream. More... | |
bool | saveJSON (const UT_StringHolder &file_path) |
Serializes the work items in the node to the specified file. More... | |
bool | asJSON (UT_JSONWriter &writer, bool skip_defaults) const |
Public Member Functions inherited from PDG_NodeInterface | |
PDG_NodeInterface (UT_StringHolder name="", UT_StringHolder data_type="") | |
virtual | ~PDG_NodeInterface () |
int64 | getMemoryUsage (bool inclusive) const |
void | cloneFrom (const PDG_NodeInterface &interface) |
void | addBuiltinPorts (PDG_NodeType type, PDG_NodeSubtype sub_type) |
Adds builtin ports for the specified node type and subtype. More... | |
PDG_WorkItemDataType * | workItemDataType () |
Queries the work item data type associated with this node. More... | |
const PDG_WorkItemDataType * | workItemDataType () const |
bool | resolveWorkItemDataType (UT_WorkBuffer &errors) |
Resolves and caches the work item data type. More... | |
const PDG_PortArray & | ports (PDG_PortType type) const |
Returns the list of all ports of the specified type. More... | |
const PDG_PortArray & | inputPorts () const |
const PDG_PortArray & | outputPorts () const |
const PDG_PortArray & | parameters () const |
const ParameterGroupArray & | parameterGroups () const |
Returns the list of parameter groups for the node. More... | |
bool | parametersForTag (const UT_StringHolder &tag, PDG_PortArray ¶meters) const |
Returns the list of parameters with the specified tag. More... | |
const PDG_PortArray & | customParameters () const |
Returns the list of custom parameter ports. More... | |
PDG_Port * | port (PDG_PortType type, int index) const |
PDG_Port * | port (PDG_PortType type, const UT_StringHolder &name) const |
PDG_Port * | port (const UT_StringHolder &name) const |
PDG_Port * | inputPort (int index) const |
Specialized functions for finding input ports by name or index. More... | |
PDG_Port * | inputPort (const UT_StringHolder &name) const |
bool | inputPortsForNode (PDG_Node *node, PDG_PortArray &ports) const |
bool | inputPortsForWorkItem (const PDG_WorkItem *work_item, PDG_PortArray &ports) const |
bool | isWorkItemFromInputPort (const PDG_WorkItem *work_item, const UT_StringHolder &name) const |
PDG_Port * | outputPort (int index) const |
Sepcialized functions for finding output ports by name or index. More... | |
PDG_Port * | outputPort (const UT_StringHolder &name) const |
PDG_Port * | parameter (const UT_StringHolder &name, int multi=-1) const |
PDGT_Value * | paramValue (const UT_StringHolder &name, int index=0) const |
PDGT_Value * | defaultParamValue (const UT_StringHolder &name, int index=0) const |
int | portCount (PDG_PortType type) const |
int | inputCount () const |
int | outputCount () const |
int | parameterCount () const |
bool | hasUnorderedPorts () const |
int | numOrderedPorts () const |
PDG_Port * | addPort (PDG_PortType type, const PDG_WorkItemDataType *data_type, const UT_StringHolder &name, const UT_StringHolder &label, const UT_StringArray &tags=UT_StringArray(), int size=0, bool ordered=true, bool custom=false) |
PDG_Port * | addParameter (PDGT_Value::DataType data_type, const UT_StringHolder &name, const UT_StringHolder &label, const UT_StringArray &tags, int size=1, bool custom=false) |
PDG_Port * | addParameter (PDGT_Value::DataType data_type, const UT_StringHolder &name, const UT_StringHolder &label, int size=1, bool custom=false) |
Adds a parameter with a data type, name, label and optional size. More... | |
bool | removeParameter (const UT_StringHolder &name) |
void | addFileDependency (const UT_StringHolder &file_path) |
Adds a new file dependency to the node interface. More... | |
void | addParameterGroup (const UT_StringHolder &name, bool root=true, bool multiparm=false) |
Adds a new parameter group to the node interface. More... | |
void | endParameterGroup () |
Ends the current parameter group. More... | |
const UT_StringHolder & | templateName () const |
bool | isValid () const |
Returns true if the node interface is valid. More... | |
const DependencyArray & | autoDependencies () const |
Returns the list of external files that this node depends on. More... | |
const PDG_Port::ExpressionVars & | commonVars () const |
PDG_ApplicationShim::Node * | appNode () const |
template<typename T , typename... Args> | |
void | setAppNode (Args &&...args) |
Sets the underlying app node. More... | |
const PDG_AttributeInfo & | attributeInfo () const |
void | setAttributeInfo (const PDG_AttributeInfo &info) |
Clears and sets the attribute info for this interface. More... | |
const PDG_JobScriptInfo & | scriptInfo () const |
Returns the script info for this node interface. More... | |
void | setScriptInfo (const PDG_JobScriptInfo &info) |
Sets the script info for the interface. More... | |
void | setServiceCompatibility (const UT_StringHolder &service_type_name, bool compatible) |
template<typename... Args> | |
void | addErrorFmt (const char *fmt, Args &&...args) const |
Adds an error using a format string, instead of plain string. More... | |
template<typename... Args> | |
void | addWarningFmt (const char *fmt, Args &&...args) const |
Adds a warning using a format string, instead of plain string. More... | |
template<typename T > | |
bool | evaluate (T &result, const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const |
Evaluates a parameter and reports errors if desired. More... | |
bool | evaluateRaw (UT_StringHolder &result, const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int index=0, int multi=-1) const |
template<typename T > | |
bool | evaluateArray (T &result, const UT_StringHolder &name, const PDG_WorkItem *work_item=nullptr, int multi=-1) const |
Evaluates a parameter as an array and reports errors if desired. More... | |
Public Member Functions inherited from PDG_EventEmitter | |
PDG_EventEmitter (PDG_EventQueue *event_queue, bool block_destruction) | |
virtual | ~PDG_EventEmitter () |
int64 | getMemoryUsage (bool inclusive) const |
Returns memory usage for this event emitter instance. More... | |
bool | addEventHandler (PDG_EventHandler *handler) |
Adds an event handlers that listens for all types of events. More... | |
bool | addEventHandler (PDG_EventHandler *handler, PDG_EventType event) |
Adds an event handlers that listens for a specific event. More... | |
bool | addEventHandler (PDG_EventHandler *handler, const PDG_EventFilter &filter) |
void | removeEventHandler (PDG_EventHandler *handler) |
Removes an event handler from this emitter. More... | |
void | removeAllEventHandlers (bool user_handler_only=false) |
void | emitEvent (const PDG_Event &event, bool immediate=false) const |
Emit an event to all handlers. More... | |
void | eventHandlers (PDG_EventHandlerArray &handlers) const |
void | setEventQueue (PDG_EventQueue *event_queue) |
void | clearEventQueue () |
bool | shouldEmit (const PDG_Event &event) const |
Public Member Functions inherited from PDGE_DependencyOwner | |
PDGE_DependencyOwner () | |
Constructs a new dependency owner, which must have a string name. More... | |
virtual | ~PDGE_DependencyOwner () |
virtual UT_StringHolder | debugGroup () const |
Protected Member Functions | |
bool | isTargetedPartitioner () const |
int | preCookLoop (const UT_Array< LoopInfo > &begin_info) override |
Sets the loop depth and loop block reference on the node. More... | |
void | clearAllWorkItems () override |
void | clearWorkItem (const PDG_WorkItem *work_item) override |
bool | queueWorkItem (PDG_WorkItem *work_item) override |
Called when a work item in this node is building depenendcies. More... | |
bool | cookWorkItem (PDGE_Resolutions &resolutions, PDG_WorkItem *work_item, bool did_cook) override |
void | resetOwner () override |
Resets any dependencies owned by this node. More... | |
PDGE_Dependency::State | evalResolve (PDGE_Resolutions &resolutions, const PDGE_Evaluator &evaluator, PDGE_Dependency *dependency) override |
Called when a dependency on this node is resolved. More... | |
PDGE_Dependency::State | evalPartial (PDGE_Resolutions &resolutions, const PDGE_Evaluator &evaluator, PDGE_Dependency *dependency, const PDGE_DependencyOwner::Array &owners) override |
Called when a dependency on this node is partially resolved. More... | |
bool | cacheBuiltinParms (PDG_NodeSet &dirty, bool dynamic_inputs) override |
Caches any built in parm state for the current cook. More... | |
void | addInputDeps (PDG_Node *input_node) override |
Adds node dependencies based on the current partitioner settings. More... | |
void | addCommonDeps () override |
Adds depenencies are that not input specific. More... | |
bool | requiresCookedInputs (bool cook) const override |
Returns true if this node needs to cook its inputs. More... | |
Protected Member Functions inherited from PDG_Node | |
UT_RWLock & | attributeLock () const |
PDGE_Dependency * | canGenerateDep () |
PDGE_Dependency * | isGeneratedDep () |
PDGE_Dependency * | isCookedDep () |
PDGE_PropagateGroup * | propagateGroup () |
UT_StringHolder | debugName () const override |
virtual bool | preCook (bool is_dirty, bool has_filter) |
virtual void | postCook () |
virtual void | addWorkItem (PDG_WorkItem *work_item) |
virtual bool | syncWorkItem (PDG_WorkItem *work_item, const PDG_WorkItem *clone_target) |
virtual PDG_WorkItemState | updateOutputCache (PDG_WorkItem *work_item) const |
virtual bool | shouldSchedule (const PDG_WorkItem *work_item) const |
void | injectDynamicWorkItem (PDG_WorkItem *work_item) |
void | addPropagateDependencies (const PDG_WorkItemArray &work_items) |
void | addWorkItems (const PDG_WorkItemArray &work_items, const PDG_BatchWorkItemSet &batches, PDG_EvaluationContext::State state, bool sort_items) |
void | queueWorkItemResolutions (PDGE_Resolutions &resolutions, PDG_WorkItem *work_item, PDGE_Dependency *can_cook_dep) |
void | queueBatchWorkItemResolutions (PDGE_Resolutions &resolutions, PDG_BatchWorkItem *batch_item, PDGE_Dependency *can_cook_dep) |
void | needsNodeCook (UT_ArrayMap< PDG_Node *, bool > &needs_cook, bool generate_only, bool cook) |
void | queueNodeDeps (PDGE_Evaluator &evaluator, const UT_ArrayMap< PDG_Node *, bool > &needs_cook, const PDG_NodeSet &error_handlers, PDG_NodeSet &visited, bool generate_only, bool cook) |
void | updateInputRegeneration () |
void | applyDirty (bool remove_outputs) |
void | prepareDirtyAll (PDG_WorkItemDirty &dirty_state, bool remove_outputs) |
bool | compactItems (bool reset_index=false) |
bool | upstreamItems (PDG_WorkItemArray &work_items, bool skip_failed=false) const |
bool | downstreamItems (PDG_WorkItemArray &work_items) const |
void | clearOutputCache () |
void | updateModTimeCache () |
template<typename FieldType , typename EvalType = FieldType> | |
void | updateBuiltinField (PDG_NodeSet &dirty, const UT_StringHolder &parm_name, FieldType &field, const FieldType &default_value, bool set_dirty=true) |
Protected Member Functions inherited from PDGE_DependencyOwner | |
virtual int | evalUnresolve (PDGE_Dependency::Array &, PDGE_Dependency *) |
const PDGE_Dependency::Set & | propagateSet () |
Returns the propagate set for this owner. More... | |
void | addPropagate (PDGE_Dependency *dependency) |
Adds an entry to the propagate set. More... | |
PDG_Node subclass that partitions incoming work items, e.g. it groups items together into a single unit that can be used for mapping or further work item generation.
Definition at line 31 of file PDG_Partitioner.h.
PDG_Partitioner::PDG_Partitioner | ( | PDG_GraphContext * | context, |
const UT_StringHolder & | name, | ||
const PDG_NodeCallbackType * | type_object, | ||
int | custom_id = -1 |
||
) |
|
inlineoverride |
Definition at line 40 of file PDG_Partitioner.h.
|
overrideprotectedvirtual |
Adds depenencies are that not input specific.
Reimplemented from PDG_Node.
Adds node dependencies based on the current partitioner settings.
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Caches any built in parm state for the current cook.
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Called when this node should clear all work items. Management of the main work item array is handled by the parent class, but partitioners need to clear their myPartitionMap contents.
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Called when this node should clear a specific work item. Partitioner nodes need to update the myPartitionMap accordingly.
Reimplemented from PDG_Node.
|
overridevirtual |
Called after deserializing a work item and adding its dependencies.
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Called when a work in this node cook. The partitioner uses this to control the data merging process
Reimplemented from PDG_Node.
|
overridevirtual |
Deserialized the specified work item into this node. Most of the work is handled by the parent class, but partitioner nodes need to update the myPartitionMap
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Called when a dependency on this node is partially resolved.
Reimplemented from PDGE_DependencyOwner.
|
overrideprotectedvirtual |
Called when a dependency on this node is resolved.
Reimplemented from PDGE_DependencyOwner.
|
inlineprotected |
Returns true if this partitioner generates when the target node is generated rather than the input nodes
Definition at line 70 of file PDG_Partitioner.h.
|
overridevirtual |
Returns the total memory usage of the node, including any work items owned by it.
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Sets the loop depth and loop block reference on the node.
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Called when a work item in this node is building depenendcies.
Reimplemented from PDG_Node.
|
overridevirtual |
Adds special handling for feedback blocks, when a specific work item in a node is cooked with upstraem dependencies on an end block work item
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Returns true if this node needs to cook its inputs.
Reimplemented from PDG_Node.
|
overrideprotectedvirtual |
Resets any dependencies owned by this node.
Reimplemented from PDG_Node.