VTK  9.4.20241013
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
vtkDataAssembly Class Reference

hierarchical representation to use with vtkPartitionedDataSetCollection More...

#include <vtkDataAssembly.h>

Inheritance diagram for vtkDataAssembly:
[legend]
Collaboration diagram for vtkDataAssembly:
[legend]

Public Types

enum  TraversalOrder { DepthFirst = 0 , BreadthFirst }
 
typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
vtkDataAssemblyNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
void Initialize ()
 Initializes the data-assembly.
 
int AddNode (const char *name, int parent=0)
 Adds a node to the assembly with the given name and returns its id.
 
std::vector< int > AddNodes (const std::vector< std::string > &names, int parent=0)
 Same as AddNode except allows adding multiple nodes in one go.
 
int AddSubtree (int parent, vtkDataAssembly *other, int otherParent=0)
 Add a subtree by copy the nodes from another tree starting with the specified parent index.
 
bool RemoveNode (int id)
 Removes a node from the assembly.
 
std::string GetNodePath (int id) const
 Returns the path for a node.
 
int GetFirstNodeByPath (const char *path) const
 Return a node id given the path.
 
bool AddDataSetIndex (int id, unsigned int dataset_index)
 Add a dataset index to a node.
 
bool AddDataSetIndices (int id, const std::vector< unsigned int > &dataset_indices)
 Same as AddDataSetIndex except supports adding multiple dataset indices in one go.
 
bool AddDataSetIndexRange (int id, unsigned int index_start, int count)
 Same as AddDataSetIndices except this supports adding a contiguous range of dataset indices in one go.
 
bool RemoveDataSetIndex (int id, unsigned int dataset_index)
 Removes a dataset index from a node.
 
bool RemoveAllDataSetIndices (int id, bool traverse_subtree=true)
 Clears all dataset indices from the node.
 
int FindFirstNodeWithName (const char *name, int traversal_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Finds first node that is encountered in a breadth first traversal of the assembly with the given name.
 
std::vector< int > FindNodesWithName (const char *name, int sort_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Finds all nodes with the given name.
 
std::vector< int > GetChildNodes (int parent, bool traverse_subtree=true, int traversal_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Returns ids for all child nodes.
 
int GetNumberOfChildren (int parent) const
 Returns the number of child nodes.
 
int GetChild (int parent, int index) const
 Returns the id for a child not at the given index, if valid, otherwise -1.
 
int GetChildIndex (int parent, int child) const
 Returns the index for a child under a given.
 
int GetParent (int id) const
 Returns the id for the parent node, if any.
 
bool HasAttribute (int id, const char *name) const
 Returns true if attribute with the given name is present on the chosen node.
 
std::vector< int > SelectNodes (const std::vector< std::string > &path_queries, int traversal_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Returns ids for nodes matching the path_queries.
 
bool RemapDataSetIndices (const std::map< unsigned int, unsigned int > &mapping, bool remove_unmapped)
 Remap dataset indices.
 
void SubsetCopy (vtkDataAssembly *other, const std::vector< int > &selected_branches)
 Create a deep-copy of other by only passing the chosen branches.
 
void DeepCopy (vtkDataAssembly *other)
 Deep copy the other.
 
bool InitializeFromXML (const char *xmlcontents)
 Initializes a data-assembly using an XML representation of the assembly.
 
std::string SerializeToXML (vtkIndent indent) const
 Saves the data-assembly as a XML.
 
void SetRootNodeName (const char *name)
 Get/Set root node name.
 
const char * GetRootNodeName () const
 Get/Set root node name.
 
void SetNodeName (int id, const char *name)
 Get/Set a node's name.
 
const char * GetNodeName (int id) const
 Get/Set a node's name.
 
void SetAttribute (int id, const char *name, const char *value)
 Set an attribute.
 
void SetAttribute (int id, const char *name, int value)
 Set an attribute.
 
void SetAttribute (int id, const char *name, unsigned int value)
 Set an attribute.
 
bool GetAttribute (int id, const char *name, const char *&value) const
 Get an attribute value.
 
bool GetAttribute (int id, const char *name, int &value) const
 Get an attribute value.
 
bool GetAttribute (int id, const char *name, unsigned int &value) const
 Get an attribute value.
 
const char * GetAttributeOrDefault (int id, const char *name, const char *default_value) const
 Get an attribute value.
 
int GetAttributeOrDefault (int id, const char *name, int default_value) const
 Get an attribute value.
 
unsigned int GetAttributeOrDefault (int id, const char *name, unsigned int default_value) const
 Get an attribute value.
 
void Visit (vtkDataAssemblyVisitor *visitor, int traversal_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Visit each node in the assembly for processing.
 
void Visit (int id, vtkDataAssemblyVisitor *visitor, int traversal_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Visit each node in the assembly for processing.
 
std::vector< unsigned int > GetDataSetIndices (int id, bool traverse_subtree=true, int traversal_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Returns the dataset indices associated with the node.
 
std::vector< unsigned int > GetDataSetIndices (const std::vector< int > &ids, bool traverse_subtree=true, int traversal_order=vtkDataAssembly::TraversalOrder::DepthFirst) const
 Returns the dataset indices associated with the node.
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on.
 
virtual void DebugOff ()
 Turn debugging output off.
 
bool GetDebug ()
 Get the value of the debug flag.
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag.
 
virtual void Modified ()
 Update the modification time for this object.
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
vtkTypeBool InvokeEvent (unsigned long event)
 
vtkTypeBool InvokeEvent (const char *event)
 
std::string GetObjectDescription () const override
 The object description printed in messages and PrintSelf output.
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method.
 
vtkTypeBool InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
vtkTypeBool InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
virtual void SetObjectName (const std::string &objectName)
 Set/get the name of this object for reporting purposes.
 
virtual std::string GetObjectName () const
 Set/get the name of this object for reporting purposes.
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
 
virtual std::string GetObjectDescription () const
 The object description printed in messages and PrintSelf output.
 
virtual vtkTypeBool IsA (const char *name)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
virtual void Delete ()
 Delete a VTK object.
 
virtual void FastDelete ()
 Delete a reference to this object.
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream.
 
void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object).
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object).
 
int GetReferenceCount ()
 Return the current reference count of this object.
 
void SetReferenceCount (int)
 Sets the reference count.
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space.
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not.
 

Static Public Member Functions

static vtkDataAssemblyNew ()
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkDataAssemblySafeDownCast (vtkObjectBase *o)
 
static int GetRootNode ()
 Returns the ID for the root node.
 
static bool IsNodeNameValid (const char *name)
 Validates a node name.
 
static std::string MakeValidNodeName (const char *name)
 Converts any string to a string that is a valid node name.
 
static bool IsNodeNameReserved (const char *name)
 Returns true for node names that are reserved.
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes.
 
static void SetGlobalWarningDisplay (vtkTypeBool val)
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static vtkTypeBool GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class.
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space.
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkDataAssembly ()
 
 ~vtkDataAssembly () override
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events.
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events.
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void RegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
virtual void ObjectFinalize ()
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
std::string ObjectName
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

hierarchical representation to use with vtkPartitionedDataSetCollection

vtkDataAssembly is a mechanism to represent hierarchical organization of items (or vtkPartitionedDataSet instances) in a vtkPartitionedDataSetCollection. vtkPartitionedDataSetCollection is similar to a vtkMultiBlockDataSet since it provides a means for putting together multiple non-composite datasets. However, vtkPartitionedDataSetCollection itself doesn't provide any mechanism to define relationships between items in the collections. That is done using vtkDataAssembly.

Overview

At its core, vtkDataAssembly is simply a tree of nodes starting with the root node. Each node has a unique id and a string name (names need not be unique). On initialization with vtkDataAssembly::Initialize, an empty tree with a root node is created. The root node's id and name can be obtained using vtkDataAssembly::GetRootNode and vtkDataAssembly::GetRootNodeName. The root node's id is fixed (vtkDataAssembly::GetRootNode), however the name can be changed using vtkDataAssembly::SetRootNodeName.

Child nodes can be added using vtkDataAssembly::AddNode or vtkDataAssembly::AddNodes, each of which returns the ids for every child node added. A non-root node can be removed using vtkDataAssembly::RemoveNode.

Each node in the tree (including the root node) can have associated dataset indices. For a vtkDataAssembly associated with a vtkPartitionedDataSetCollection, these indices refer to the item index, or partitioned-dataset-index for items in the collection. Dataset indices can be specified using vtkDataAssembly::AddDataSetIndex, vtkDataAssembly::AddDataSetIndices and removed using vtkDataAssembly::RemoveDataSetIndex, vtkDataAssembly::RemoveAllDataSetIndices. vtkDataAssembly::GetDataSetIndices provides a mechanism to get the database indices associated with a node, and optionally, the entire subtree rooted at the chosen node.

Searching

Each node in the vtkDataAssembly is assigned a unique id. vtkDataAssembly::FindFirstNodeWithName and vtkDataAssembly::FindNodesWithName can be used to get the id(s) for node(s) with given name.

vtkDataAssembly::SelectNodes provides a more flexible mechanism to find nodes using name-based queries. Section Supported Path Queries covers supported queries.

Traversal

vtkDataAssemblyVisitor defines a visitor API. An instance of a concretized vtkDataAssemblyVisitor subclass can be passed to vtkDataAssembly::Visit to traverse the data-assembly hierarchy either in depth-first or breadth-first order.

Supported Path Queries

vtkDataAssembly::SelectNodes can be used find nodes that match the specified query (or queries) using XPath 1.0 syntax.

For example:

Applications

The separation of dataset storage (vtkPartitionedDataSetCollection) and organization (vtkDataAssembly) enables development of algorithms that can expose APIs that are not tightly coupled to dataset storage. Together, vtkPartitionedDataSetCollection and vtkDataAssembly can be thought of as a different way of organizing data that was previously organized as a vtkMultiBlockDataSet. The advantage of the this newer approach is that filters can support specifying parameters using paths or path queries rather than composite indices. The composite indices suffered from the fact that they made no sense except for the specific vtkMultiBlockDataSet they were applied too. Thus, if the filters input was changed, the composite ids rarely made any sense and needed to be updated. Paths and path queries, however, do not suffer from this issue.

Tests:
vtkDataAssembly (Tests)

Definition at line 122 of file vtkDataAssembly.h.

Member Typedef Documentation

◆ Superclass

Definition at line 126 of file vtkDataAssembly.h.

Member Enumeration Documentation

◆ TraversalOrder

Enumerator
DepthFirst 
BreadthFirst 

Definition at line 272 of file vtkDataAssembly.h.

Constructor & Destructor Documentation

◆ vtkDataAssembly()

vtkDataAssembly::vtkDataAssembly ( )
protected

◆ ~vtkDataAssembly()

vtkDataAssembly::~vtkDataAssembly ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkDataAssembly * vtkDataAssembly::New ( )
static

◆ IsTypeOf()

static vtkTypeBool vtkDataAssembly::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkDataAssembly::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkDataAssembly * vtkDataAssembly::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkDataAssembly::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkDataAssembly * vtkDataAssembly::NewInstance ( ) const

◆ PrintSelf()

void vtkDataAssembly::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObjectBase.

◆ Initialize()

void vtkDataAssembly::Initialize ( )

Initializes the data-assembly.

When a new vtkDataAssembly instance is created, it is in initialized form and it is not required to call this method to initialize it.

◆ InitializeFromXML()

bool vtkDataAssembly::InitializeFromXML ( const char *  xmlcontents)

Initializes a data-assembly using an XML representation of the assembly.

Returns true if the initialization was successful, otherwise the assembly is set a clean state and returns false.

◆ SerializeToXML()

std::string vtkDataAssembly::SerializeToXML ( vtkIndent  indent) const

Saves the data-assembly as a XML.

◆ GetRootNode()

static int vtkDataAssembly::GetRootNode ( )
inlinestatic

Returns the ID for the root node.

This always returns 0.

Definition at line 156 of file vtkDataAssembly.h.

◆ SetRootNodeName()

void vtkDataAssembly::SetRootNodeName ( const char *  name)
inline

Get/Set root node name.

Defaults to DataAssembly.

Definition at line 162 of file vtkDataAssembly.h.

◆ GetRootNodeName()

const char * vtkDataAssembly::GetRootNodeName ( ) const
inline

Get/Set root node name.

Defaults to DataAssembly.

Definition at line 166 of file vtkDataAssembly.h.

◆ AddNode()

int vtkDataAssembly::AddNode ( const char *  name,
int  parent = 0 
)

Adds a node to the assembly with the given name and returns its id.

parent is the id for the parent node which defaults to the root node id (i.e. GetRootNode).

If parent is invalid, the add will fail.

Returns
id of the newly added node on success, else -1.

◆ AddNodes()

std::vector< int > vtkDataAssembly::AddNodes ( const std::vector< std::string > &  names,
int  parent = 0 
)

Same as AddNode except allows adding multiple nodes in one go.

If parent is invalid, the add will fail.

Returns
vectors of corresponding indices for each of the names added.

◆ AddSubtree()

int vtkDataAssembly::AddSubtree ( int  parent,
vtkDataAssembly other,
int  otherParent = 0 
)

Add a subtree by copy the nodes from another tree starting with the specified parent index.

◆ RemoveNode()

bool vtkDataAssembly::RemoveNode ( int  id)

Removes a node from the assembly.

The node identified by the id and all its children are removed.

Root node cannot be removed.

Returns
true if removal was successful, false if the id is invalid or root node id.

◆ SetNodeName()

void vtkDataAssembly::SetNodeName ( int  id,
const char *  name 
)

Get/Set a node's name.

If node id is invalid, SetNodeName will raise an error; GetNodeName will also raise an error and return nullptr.

SetNodeName will raise an error if the name is not valid. Name cannot be empty or nullptr.

◆ GetNodeName()

const char * vtkDataAssembly::GetNodeName ( int  id) const

Get/Set a node's name.

If node id is invalid, SetNodeName will raise an error; GetNodeName will also raise an error and return nullptr.

SetNodeName will raise an error if the name is not valid. Name cannot be empty or nullptr.

◆ GetNodePath()

std::string vtkDataAssembly::GetNodePath ( int  id) const

Returns the path for a node.

◆ GetFirstNodeByPath()

int vtkDataAssembly::GetFirstNodeByPath ( const char *  path) const

Return a node id given the path.

Returns -1 if path is not valid.

◆ AddDataSetIndex()

bool vtkDataAssembly::AddDataSetIndex ( int  id,
unsigned int  dataset_index 
)

Add a dataset index to a node.

The node id can refer to any valid node in the assembly, including the root.

While the same dataset can be added multiple times in the assembly, it cannot be added multiple times to the same node. Additional adds will fail.

Returns
true if addition succeeded else false.

◆ AddDataSetIndices()

bool vtkDataAssembly::AddDataSetIndices ( int  id,
const std::vector< unsigned int > &  dataset_indices 
)

Same as AddDataSetIndex except supports adding multiple dataset indices in one go.

Note, a dataset index only gets added once.

Returns
true if any dataset index was successfully added.

◆ AddDataSetIndexRange()

bool vtkDataAssembly::AddDataSetIndexRange ( int  id,
unsigned int  index_start,
int  count 
)

Same as AddDataSetIndices except this supports adding a contiguous range of dataset indices in one go.

@ returns true if any dataset index was successfully added.

◆ RemoveDataSetIndex()

bool vtkDataAssembly::RemoveDataSetIndex ( int  id,
unsigned int  dataset_index 
)

Removes a dataset index from a node.

Returns
true if the removal was successful, else returns false.

◆ RemoveAllDataSetIndices()

bool vtkDataAssembly::RemoveAllDataSetIndices ( int  id,
bool  traverse_subtree = true 
)

Clears all dataset indices from the node.

If traverse_subtree is true (default), recursively removes all dataset indices from all the child nodes.

Returns
true on success, else returns false.

◆ FindFirstNodeWithName()

int vtkDataAssembly::FindFirstNodeWithName ( const char *  name,
int  traversal_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const

Finds first node that is encountered in a breadth first traversal of the assembly with the given name.

Returns
the if of the node if found, else -1.

◆ FindNodesWithName()

std::vector< int > vtkDataAssembly::FindNodesWithName ( const char *  name,
int  sort_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const

Finds all nodes with the given name.

The nodes can be ordered depth first or breadth first, based on the sort_order flag.

◆ GetChildNodes()

std::vector< int > vtkDataAssembly::GetChildNodes ( int  parent,
bool  traverse_subtree = true,
int  traversal_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const

Returns ids for all child nodes.

If traverse_subtree is true (default), recursively builds the child node list. The traversal order can be specified using traversal_order flag; defaults to depth-first.

See also
vtkDataAssembly::Visit, vtkDataAssemblyVisitor

◆ GetNumberOfChildren()

int vtkDataAssembly::GetNumberOfChildren ( int  parent) const

Returns the number of child nodes.

Returns
the number of child nodes for the parent node or 0 if the parent is invalid.

◆ GetChild()

int vtkDataAssembly::GetChild ( int  parent,
int  index 
) const

Returns the id for a child not at the given index, if valid, otherwise -1.

◆ GetChildIndex()

int vtkDataAssembly::GetChildIndex ( int  parent,
int  child 
) const

Returns the index for a child under a given.

-1 if invalid.

◆ GetParent()

int vtkDataAssembly::GetParent ( int  id) const

Returns the id for the parent node, if any.

Returns -1 if the node is invalid or has no parent (i.e. is the root node).

◆ HasAttribute()

bool vtkDataAssembly::HasAttribute ( int  id,
const char *  name 
) const

Returns true if attribute with the given name is present on the chosen node.

◆ SetAttribute() [1/3]

void vtkDataAssembly::SetAttribute ( int  id,
const char *  name,
const char *  value 
)

Set an attribute.

Will replace an existing attribute with the same name if present.

◆ SetAttribute() [2/3]

void vtkDataAssembly::SetAttribute ( int  id,
const char *  name,
int  value 
)

Set an attribute.

Will replace an existing attribute with the same name if present.

◆ SetAttribute() [3/3]

void vtkDataAssembly::SetAttribute ( int  id,
const char *  name,
unsigned int  value 
)

Set an attribute.

Will replace an existing attribute with the same name if present.

◆ GetAttribute() [1/3]

bool vtkDataAssembly::GetAttribute ( int  id,
const char *  name,
const char *&  value 
) const

Get an attribute value.

Returns true if a value was provided else false.

◆ GetAttribute() [2/3]

bool vtkDataAssembly::GetAttribute ( int  id,
const char *  name,
int &  value 
) const

Get an attribute value.

Returns true if a value was provided else false.

◆ GetAttribute() [3/3]

bool vtkDataAssembly::GetAttribute ( int  id,
const char *  name,
unsigned int &  value 
) const

Get an attribute value.

Returns true if a value was provided else false.

◆ GetAttributeOrDefault() [1/3]

const char * vtkDataAssembly::GetAttributeOrDefault ( int  id,
const char *  name,
const char *  default_value 
) const

Get an attribute value.

Returns the value associated with the node or the provided default value.

◆ GetAttributeOrDefault() [2/3]

int vtkDataAssembly::GetAttributeOrDefault ( int  id,
const char *  name,
int  default_value 
) const

Get an attribute value.

Returns the value associated with the node or the provided default value.

◆ GetAttributeOrDefault() [3/3]

unsigned int vtkDataAssembly::GetAttributeOrDefault ( int  id,
const char *  name,
unsigned int  default_value 
) const

Get an attribute value.

Returns the value associated with the node or the provided default value.

◆ Visit() [1/2]

void vtkDataAssembly::Visit ( vtkDataAssemblyVisitor visitor,
int  traversal_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const
inline

Visit each node in the assembly for processing.

The traversal order can be specified using traversal_order which defaults to depth-first.

Definition at line 380 of file vtkDataAssembly.h.

◆ Visit() [2/2]

void vtkDataAssembly::Visit ( int  id,
vtkDataAssemblyVisitor visitor,
int  traversal_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const

Visit each node in the assembly for processing.

The traversal order can be specified using traversal_order which defaults to depth-first.

◆ GetDataSetIndices() [1/2]

std::vector< unsigned int > vtkDataAssembly::GetDataSetIndices ( int  id,
bool  traverse_subtree = true,
int  traversal_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const

Returns the dataset indices associated with the node.

If traverse_subtree is true (default), recursively builds the dataset indices list for the node and all its child nodes. Note, a dataset index will only appear once in the output even if it is encountered on multiple nodes in the subtree.

When traverse_subtree is true, the traversal order can be specified using traversal_order. Defaults to depth-first.

◆ GetDataSetIndices() [2/2]

std::vector< unsigned int > vtkDataAssembly::GetDataSetIndices ( const std::vector< int > &  ids,
bool  traverse_subtree = true,
int  traversal_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const

Returns the dataset indices associated with the node.

If traverse_subtree is true (default), recursively builds the dataset indices list for the node and all its child nodes. Note, a dataset index will only appear once in the output even if it is encountered on multiple nodes in the subtree.

When traverse_subtree is true, the traversal order can be specified using traversal_order. Defaults to depth-first.

◆ SelectNodes()

std::vector< int > vtkDataAssembly::SelectNodes ( const std::vector< std::string > &  path_queries,
int  traversal_order = vtkDataAssembly::TraversalOrder::DepthFirst 
) const

Returns ids for nodes matching the path_queries.

See Section Supported Path Queries for supported query expressions.

Will return an empty vector is no nodes match the requested query.

Returns
node ids matching the query in traversal order chosen using traversal_order.

◆ RemapDataSetIndices()

bool vtkDataAssembly::RemapDataSetIndices ( const std::map< unsigned int, unsigned int > &  mapping,
bool  remove_unmapped 
)

Remap dataset indices.

mapping is map where the key is the old index and value is the new index. If remove_unmapped is true, then any dataset not in the map will be removed.

◆ SubsetCopy()

void vtkDataAssembly::SubsetCopy ( vtkDataAssembly other,
const std::vector< int > &  selected_branches 
)

Create a deep-copy of other by only passing the chosen branches.

All other branches of the tree will be pruned. Note this method never affects the depth of the selected branches or dataset indices attached to any of the nodes in pruned output.

◆ DeepCopy()

void vtkDataAssembly::DeepCopy ( vtkDataAssembly other)

Deep copy the other.

◆ IsNodeNameValid()

static bool vtkDataAssembly::IsNodeNameValid ( const char *  name)
static

Validates a node name.

◆ MakeValidNodeName()

static std::string vtkDataAssembly::MakeValidNodeName ( const char *  name)
static

Converts any string to a string that is a valid node name.

This is done by simply discarding any non-supported character. Additionally, if the first character is not a "_" or an alphabet, then the "_" is prepended.

◆ IsNodeNameReserved()

static bool vtkDataAssembly::IsNodeNameReserved ( const char *  name)
static

Returns true for node names that are reserved.


The documentation for this class was generated from the following file: