VTK  9.4.20241203
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
vtkDataObjectMeshCache Class Reference

vtkDataObjectMeshCache is a class to store and reuse the mesh of a vtkDataSet, while forwarding data arrays from another dataset. More...

#include <vtkDataObjectMeshCache.h>

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

Classes

struct  Status
 Structure to handle the current cache status. More...
 

Public Types

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.
 
vtkDataObjectMeshCacheNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
Status GetStatus () const
 Compute and returns the current cache status.
 
void CopyCacheToDataObject (vtkDataObject *output)
 Fill given dataset with cached data.
 
void UpdateCache (vtkDataObject *newObject)
 Set given dataset as the new Cache.
 
void InvalidateCache ()
 Invalidate cache.
 
bool IsSupportedData (vtkDataObject *dataobject) const
 Return true if dataobject is of a supported type.
 
Cache Configuration
 vtkSetSmartPointerMacro (Consumer, vtkAlgorithm)
 Set the consumer of this cache.
 
void SetOriginalDataObject (vtkDataObject *original)
 Set the original dataobject.
 
void AddOriginalIds (int attribute, const std::string &name)
 Original Ids.
 
void RemoveOriginalIds (int attribute)
 Remove ids array name for attribute type.
 
void ClearOriginalIds ()
 Clear all original ids.
 
- 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 vtkDataObjectMeshCacheNew ()
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkDataObjectMeshCacheSafeDownCast (vtkObjectBase *o)
 
- 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
 
 vtkDataObjectMeshCache ()=default
 
 ~vtkDataObjectMeshCache () override=default
 
void ForwardAttributes (vtkDataSet *input, vtkDataSet *cache, vtkDataSet *output, int attribute, const std::string &name)
 Forward dataset attributes from OriginalDataObject to output.
 
void ForwardAttributesToDataSet (vtkDataSet *input, vtkDataSet *cache, vtkDataSet *output)
 Forward dataset attributes from OriginalDataObject to output.
 
void ForwardAttributesToComposite (vtkCompositeDataSet *input, vtkCompositeDataSet *output)
 Forward dataset attributes from OriginalDataObject to output.
 
- 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

vtkDataObjectMeshCache is a class to store and reuse the mesh of a vtkDataSet, while forwarding data arrays from another dataset.

Composite structure of vtkDataSet are also supported. This is specially useful when working with static meshes and transient data.

Example of use case

Think about the vtkGeometryFilter. On first execution, it extracts boudaries of an input mesh alongside with the associated data. On the second execution, if the input mesh didn't change and neither did the vtkGeometryFitlers own properties, then there is no need for boundary extraction: previous output mesh can be reused. Only the associated data should be forwarded.

Instead of implementing such logic itself, filtre like the vtkGeometryFilter can instead rely on the vtkDataObjectMeshCache in order to easily reuse the previously computed mesh, and forward the new data arrays.

Details

This helper relies on different elements:

The Status structure reflects the state of those different elements. It is the user responsibility to check for the status before calling CopyCacheToDataObject.

Attributes data are forwarded with CopyAllocate method. So output should be a subset of the input. Support for InterpolateAllocate is doable and may be added in the future.

 Requirements

The data arrays forwarding rely on GlobalIds arrays.

When using vtkCompositeDataSet, every leaves should be of a supported data set type.

Definition at line 63 of file vtkDataObjectMeshCache.h.

Member Typedef Documentation

◆ Superclass

Definition at line 67 of file vtkDataObjectMeshCache.h.

Constructor & Destructor Documentation

◆ vtkDataObjectMeshCache()

vtkDataObjectMeshCache::vtkDataObjectMeshCache ( )
protecteddefault

◆ ~vtkDataObjectMeshCache()

vtkDataObjectMeshCache::~vtkDataObjectMeshCache ( )
overrideprotecteddefault

Member Function Documentation

◆ New()

static vtkDataObjectMeshCache * vtkDataObjectMeshCache::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

virtual vtkTypeBool vtkDataObjectMeshCache::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 vtkDataObjectMeshCache * vtkDataObjectMeshCache::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkDataObjectMeshCache::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkDataObjectMeshCache * vtkDataObjectMeshCache::NewInstance ( ) const

◆ PrintSelf()

void vtkDataObjectMeshCache::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.

◆ vtkSetSmartPointerMacro()

vtkDataObjectMeshCache::vtkSetSmartPointerMacro ( Consumer  ,
vtkAlgorithm   
)

Set the consumer of this cache.

The status is invalid if the Consumer is modified after the last CopyCacheToDataObject call. Required before any call to CopyCacheToDataObject.

◆ SetOriginalDataObject()

void vtkDataObjectMeshCache::SetOriginalDataObject ( vtkDataObject original)

Set the original dataobject.

The status becomes invalid if the original dataobject mesh is modified. Original dataobject is also used to copy data arrays to output, if OriginalIds are configured. Required before any call to CopyCacheToDataObject.

See also
AddOriginalIds, RemoveOriginalIds, ClearOriginalIds

◆ AddOriginalIds()

void vtkDataObjectMeshCache::AddOriginalIds ( int  attribute,
const std::string &  name 
)

Original Ids.

When original ids are present for an attribute types, all arrays of this attribute are forwarded to the output.

See also
CopyCacheToOutput Add original ids array name for attribute type.
RemoveOriginalIds, ClearOriginalIds, CopyCacheToOutput

◆ RemoveOriginalIds()

void vtkDataObjectMeshCache::RemoveOriginalIds ( int  attribute)

Remove ids array name for attribute type.

See also
AddOriginalIds, ClearOriginalIds, CopyCacheToOutput

◆ ClearOriginalIds()

void vtkDataObjectMeshCache::ClearOriginalIds ( )

Clear all original ids.

See also
RemoveOriginalIds, AddOriginalIds

◆ GetStatus()

Status vtkDataObjectMeshCache::GetStatus ( ) const

Compute and returns the current cache status.

The cache status details whenever the cache is usable, with detailed informations.

◆ CopyCacheToDataObject()

void vtkDataObjectMeshCache::CopyCacheToDataObject ( vtkDataObject output)

Fill given dataset with cached data.

If original ids are present, copy corresponding attributes. It is the user responsiblity to check the status before calling this.

◆ UpdateCache()

void vtkDataObjectMeshCache::UpdateCache ( vtkDataObject newObject)

Set given dataset as the new Cache.

Also update stored MTime from OriginalDataSet mesh and Consumer.

◆ InvalidateCache()

void vtkDataObjectMeshCache::InvalidateCache ( )

Invalidate cache.

Remove cached dataset and reset cached MTimes.

◆ IsSupportedData()

bool vtkDataObjectMeshCache::IsSupportedData ( vtkDataObject dataobject) const

Return true if dataobject is of a supported type.

◆ ForwardAttributes()

void vtkDataObjectMeshCache::ForwardAttributes ( vtkDataSet input,
vtkDataSet cache,
vtkDataSet output,
int  attribute,
const std::string &  name 
)
protected

Forward dataset attributes from OriginalDataObject to output.

Uses original ids attribute arrays to copy data. FieldData are always forwarded.

◆ ForwardAttributesToDataSet()

void vtkDataObjectMeshCache::ForwardAttributesToDataSet ( vtkDataSet input,
vtkDataSet cache,
vtkDataSet output 
)
protected

Forward dataset attributes from OriginalDataObject to output.

Uses original ids attribute arrays to copy data. FieldData are always forwarded.

◆ ForwardAttributesToComposite()

void vtkDataObjectMeshCache::ForwardAttributesToComposite ( vtkCompositeDataSet input,
vtkCompositeDataSet output 
)
protected

Forward dataset attributes from OriginalDataObject to output.

Uses original ids attribute arrays to copy data. FieldData are always forwarded.


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