17#ifndef vtkCellAttribute_h
18#define vtkCellAttribute_h
20#include "vtkCommonDataModelModule.h"
26#include <unordered_map>
28VTK_ABI_NAMESPACE_BEGIN
38 using ArraysForCellType = std::unordered_map<vtkStringToken, vtkSmartPointer<vtkAbstractArray>>;
73 template <
typename ArrayType>
76 auto it = this->ArraysByRole.find(role);
77 if (it == this->ArraysByRole.end())
81 return ArrayType::SafeDownCast(it->second);
93 using Arrays = std::unordered_map<vtkStringToken, CellTypeInfo>;
108 vtkGetMacro(Id,
int);
109 vtkSetMacro(Id,
int);
209 const std::map<vtkAbstractArray*, vtkAbstractArray*>& arrayRewrites = {});
222 const std::string& space, std::string& base,
double& exp,
int& halfspace,
bool quiet =
false);
225 static std::string
EncodeSpace(
const std::string& base,
unsigned int,
int halfspace = 0);
233 int NumberOfComponents = 1;
Abstract superclass for all arrays.
A function defined over the physical domain of a vtkCellGrid.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void DeepCopy(vtkCellAttribute *other, const std::map< vtkAbstractArray *, vtkAbstractArray * > &arrayRewrites={})
virtual CellTypeInfo GetCellTypeInfo(vtkStringToken cellType) const
Return the arrays required to evaluate this attribute on cells of the given type.
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.
~vtkCellAttribute() override=default
vtkCellAttribute()=default
static vtkCellAttribute * New()
virtual vtkStringToken GetSpace() const
Return a token identifying the space containing all field values.
virtual vtkStringToken::Hash GetHash() const
Hash this attribute so it can be inserted into unordered containers.
virtual bool SetCellTypeInfo(vtkStringToken cellType, const CellTypeInfo &cellTypeInfo)
Set the arrays required to evaluate this attribute on cells of the given type.
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.
virtual vtkStringToken GetName() const
Return the (user-presentable) name of this attribute.
bool SetColormap(vtkScalarsToColors *colormap)
vtkScalarsToColors * GetColormap() const
Return a default colormap associated with the attribute.
vtkSmartPointer< vtkScalarsToColors > Colormap
vtkAbstractArray * GetArrayForCellTypeAndRole(vtkStringToken cellType, vtkStringToken arrayRole) const
Return an array for the given cell type and role.
std::unordered_map< vtkStringToken, vtkSmartPointer< vtkAbstractArray > > ArraysForCellType
A dictionary of arrays indexed by their roles in interpolation.
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.
virtual void ShallowCopy(vtkCellAttribute *other, bool copyArrays=true)
Copy data from an other attribute instance into this instance.
std::unordered_map< vtkStringToken, CellTypeInfo > Arrays
Visualization data composed of cells of arbitrary type.
represent and manipulate attribute data in a dataset
a simple class to control print indentation
abstract base class for most VTK objects
Superclass for mapping scalar values to colors.
Hold a reference to a vtkObjectBase instance.
Represent a string by its integer hash.
ArraysForCellType ArraysByRole
A dictionary of arrays indexed by their roles in interpolation.
int Order
The interpolation order of the attribute on cells of the matching type.
vtkStringToken Basis
The interpolation scheme of the attribute on cells of the matching type.
bool operator!=(const CellTypeInfo &other) const
Comparator used to test inequality.
CellTypeInfo()=default
Explicitly include assignment and copy-construction.
ArrayType * GetArrayForRoleAs(vtkStringToken role) const
Return an array (or nullptr) given a role, cast to ArrayType.
vtkStringToken FunctionSpace
The function space used to interpolate values of the attribute on cells of the matching type.
CellTypeInfo(const CellTypeInfo &other)=default
vtkStringToken DOFSharing
CellTypeInfo & operator=(const CellTypeInfo &other)=default