VTK  9.4.20250130
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkCellAttribute Class Reference

A function defined over the physical domain of a vtkCellGrid. More...

#include <vtkCellAttribute.h>

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

Classes

struct  CellTypeInfo
 

Public Types

using ArraysForCellType = std::unordered_map< vtkStringToken, vtkSmartPointer< vtkAbstractArray > >
 A dictionary of arrays indexed by their roles in interpolation.
 
using Arrays = std::unordered_map< vtkStringToken, CellTypeInfo >
 
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.
 
vtkCellAttributeNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
virtual vtkStringToken GetName () const
 Return the (user-presentable) name of this attribute.
 
virtual int GetId ()
 Return a (cell-grid-assigned) integer identifier for this attribute.
 
virtual void SetId (int)
 
virtual vtkStringToken GetSpace () const
 Return a token identifying the space containing all field values.
 
virtual int GetNumberOfComponents () const
 Return the number of components this function provides at each point in space.
 
virtual bool Initialize (vtkStringToken name, vtkStringToken space, int numberOfComponents)
 Initialize an attribute.
 
virtual vtkStringToken::Hash GetHash () const
 Hash this attribute so it can be inserted into unordered containers.
 
virtual CellTypeInfo GetCellTypeInfo (vtkStringToken cellType) const
 Return the arrays required to evaluate this attribute on cells of the given type.
 
vtkAbstractArrayGetArrayForCellTypeAndRole (vtkStringToken cellType, vtkStringToken arrayRole) const
 Return an array for the given cell type and role.
 
virtual bool SetCellTypeInfo (vtkStringToken cellType, const CellTypeInfo &cellTypeInfo)
 Set the arrays required to evaluate this attribute on cells of the given type.
 
vtkScalarsToColorsGetColormap () const
 Return a default colormap associated with the attribute.
 
bool SetColormap (vtkScalarsToColors *colormap)
 
virtual void ShallowCopy (vtkCellAttribute *other, bool copyArrays=true)
 Copy data from an other attribute instance into this instance.
 
virtual void DeepCopy (vtkCellAttribute *other, const std::map< vtkAbstractArray *, vtkAbstractArray * > &arrayRewrites={})
 
- 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 vtkTypeBool IsTypeOf (const char *type)
 
static vtkCellAttributeSafeDownCast (vtkObjectBase *o)
 
static vtkCellAttributeNew ()
 
static bool DecodeSpace (const std::string &space, std::string &base, double &exp, int &halfspace, bool quiet=false)
 Given a space string (e.g., ℝ³⁻ or ℚ¹), decode the base (e.g., ℝ resp.
 
static std::string EncodeSpace (const std::string &base, unsigned int, int halfspace=0)
 Return a space string given a description of it via base, exp, and halfspace.
 
- 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
 
 vtkCellAttribute ()=default
 
 ~vtkCellAttribute () override=default
 
- 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 &)
 

Protected Attributes

vtkStringToken Name
 
vtkStringToken Space
 
int NumberOfComponents = 1
 
Arrays AllArrays
 
int Id = -1
 
vtkSmartPointer< vtkScalarsToColorsColormap
 
- 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
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 

Detailed Description

A function defined over the physical domain of a vtkCellGrid.

This is a base class for attributes (functions) defined on the space discretized by a vtkCellGrid. A vtkCellAttribute class must handle cells of all types present in the grid.

See also
vtkCellGrid
Tests:
vtkCellAttribute (Tests)

Definition at line 34 of file vtkCellAttribute.h.

Member Typedef Documentation

◆ ArraysForCellType

A dictionary of arrays indexed by their roles in interpolation.

Definition at line 38 of file vtkCellAttribute.h.

◆ Arrays

Definition at line 93 of file vtkCellAttribute.h.

◆ Superclass

Definition at line 95 of file vtkCellAttribute.h.

Constructor & Destructor Documentation

◆ vtkCellAttribute()

vtkCellAttribute::vtkCellAttribute ( )
protecteddefault

◆ ~vtkCellAttribute()

vtkCellAttribute::~vtkCellAttribute ( )
overrideprotecteddefault

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkCellAttribute::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkCellAttribute * vtkCellAttribute::NewInstance ( ) const

◆ New()

static vtkCellAttribute * vtkCellAttribute::New ( )
static

◆ PrintSelf()

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

◆ GetName()

virtual vtkStringToken vtkCellAttribute::GetName ( ) const
inlinevirtual

Return the (user-presentable) name of this attribute.

Definition at line 100 of file vtkCellAttribute.h.

◆ GetId()

virtual int vtkCellAttribute::GetId ( )
virtual

Return a (cell-grid-assigned) integer identifier for this attribute.

Do not call SetId() unless you represent a vtkCellGrid taking ownership of this attribute instance.

◆ SetId()

virtual void vtkCellAttribute::SetId ( int  )
virtual

◆ GetSpace()

virtual vtkStringToken vtkCellAttribute::GetSpace ( ) const
inlinevirtual

Return a token identifying the space containing all field values.

Currently, this is just a free-form string but in the future we may adopt a more rigorous standard.

Some suggested values

  • "ℝ¹" – single (scalar) values over the real numbers.
  • "ℝ¹+" – single (scalar) values over the non-negative real numbers.
  • "ℝ²" – 2-d vector values over the real numbers.
  • "ℝ³" – 3-d vector values over the real numbers.
  • "𝕊³" – points inside a unit 3-dimensional ball.
  • "S²" – points on the surface of a unit 3-dimensional sphere.
  • "SO(3)" – rotation matrices.
  • "SU(2)" – special unitary group (homeomorphic to SO(3)).

Note that the space might imply the number of components but it also specifies how users should interpret operations such as addition and/or multipliciation, especially in the case of transforms applied to the domain.

If you wish to encode/decode the exponents for a space like ℝ³, see vtkCellAttribute::EncodeExponent/DecodeExponent().

Definition at line 135 of file vtkCellAttribute.h.

◆ GetNumberOfComponents()

virtual int vtkCellAttribute::GetNumberOfComponents ( ) const
inlinevirtual

Return the number of components this function provides at each point in space.

This should be consistent with the value returned by GetSpace().

Definition at line 143 of file vtkCellAttribute.h.

◆ Initialize()

virtual bool vtkCellAttribute::Initialize ( vtkStringToken  name,
vtkStringToken  space,
int  numberOfComponents 
)
virtual

Initialize an attribute.

Never call this method after a cell-attribute has been inserted into an unordered container as it will change the reported hash, which can cause crashes later.

◆ GetHash()

virtual vtkStringToken::Hash vtkCellAttribute::GetHash ( ) const
virtual

Hash this attribute so it can be inserted into unordered containers.

The hash includes the name, type, space, and number of components.

◆ GetCellTypeInfo()

virtual CellTypeInfo vtkCellAttribute::GetCellTypeInfo ( vtkStringToken  cellType) const
virtual

Return the arrays required to evaluate this attribute on cells of the given type.

◆ GetArrayForCellTypeAndRole()

vtkAbstractArray * vtkCellAttribute::GetArrayForCellTypeAndRole ( vtkStringToken  cellType,
vtkStringToken  arrayRole 
) const

Return an array for the given cell type and role.

This is a convenience for use in language bindings like Python.

◆ SetCellTypeInfo()

virtual bool vtkCellAttribute::SetCellTypeInfo ( vtkStringToken  cellType,
const CellTypeInfo cellTypeInfo 
)
virtual

Set the arrays required to evaluate this attribute on cells of the given type.

TODO: Instead of accepting a fixed type (CellTypeInfo), this method should be templated to accept any object so that cell types can put whatever state is needed here in order to assist in evaluating the attribute.

◆ GetColormap()

vtkScalarsToColors * vtkCellAttribute::GetColormap ( ) const
inline

Return a default colormap associated with the attribute.

Definition at line 187 of file vtkCellAttribute.h.

◆ SetColormap()

bool vtkCellAttribute::SetColormap ( vtkScalarsToColors colormap)

◆ ShallowCopy()

virtual void vtkCellAttribute::ShallowCopy ( vtkCellAttribute other,
bool  copyArrays = true 
)
virtual

Copy data from an other attribute instance into this instance.

The colormap is copied by reference when shallow-copying and a cloned instance is created when deep-copying. The shallow-copy method provides an option to omit copying any arrays related to the attribute, while the deep-copy method provides a map to look up replacements for arrays.

Note that the list of array pointers is copied by reference (even when deep-copying a vtkCellAttribute) unless you provide DeepCopy() with a map of arrayRewrites pointers. The vtkCellGrid owns the arrays, not the vtkCellAttribute, so the when deep-copying a vtkCellGrid, it will have a map of array copies it has created. If any array is mentioned in AllArrays and is not present in arrayRewrites, it is copied by reference.

◆ DeepCopy()

virtual void vtkCellAttribute::DeepCopy ( vtkCellAttribute other,
const std::map< vtkAbstractArray *, vtkAbstractArray * > &  arrayRewrites = {} 
)
virtual

◆ DecodeSpace()

static bool vtkCellAttribute::DecodeSpace ( const std::string &  space,
std::string &  base,
double &  exp,
int &  halfspace,
bool  quiet = false 
)
static

Given a space string (e.g., ℝ³⁻ or ℚ¹), decode the base (e.g., ℝ resp.

ℚ), exponent (e.g., 3 resp. 1), and halfspace indicator (-1 resp. 0).

If parsing fails, return false.

The halfspace indicator is either -1 (indicating only the negative halfspace), +1 (indicating only the positive halfspace), or 0 (indicating no restriction).

If quiet is true, no parse errors will be printed. This is used to ensure tests with expected errors do not fail; you should generally pass false.

◆ EncodeSpace()

static std::string vtkCellAttribute::EncodeSpace ( const std::string &  base,
unsigned int  ,
int  halfspace = 0 
)
static

Return a space string given a description of it via base, exp, and halfspace.

Member Data Documentation

◆ Name

vtkStringToken vtkCellAttribute::Name
protected

Definition at line 231 of file vtkCellAttribute.h.

◆ Space

vtkStringToken vtkCellAttribute::Space
protected

Definition at line 232 of file vtkCellAttribute.h.

◆ NumberOfComponents

int vtkCellAttribute::NumberOfComponents = 1
protected

Definition at line 233 of file vtkCellAttribute.h.

◆ AllArrays

Arrays vtkCellAttribute::AllArrays
protected

Definition at line 234 of file vtkCellAttribute.h.

◆ Id

int vtkCellAttribute::Id = -1
protected

Definition at line 235 of file vtkCellAttribute.h.

◆ Colormap

vtkSmartPointer<vtkScalarsToColors> vtkCellAttribute::Colormap
protected

Definition at line 236 of file vtkCellAttribute.h.


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