38#include <unordered_map>
40VTK_ABI_NAMESPACE_BEGIN
117 const std::unordered_map<int, vtkSmartPointer<vtkDataSetAttributes>>&
GetArrayGroups()
const
119 return this->ArrayGroups;
129 std::unordered_map<vtkAbstractArray*, vtkStringToken>& arrayLocations)
const;
179 template <
typename CellType>
182 CellType* result = this->GetCellsOfType<CellType>();
188 if (metadata->SetCellGrid(
this))
190 auto ok = this->
Cells.insert(
191 std::make_pair(
vtkStringToken(vtk::TypeName<CellType>()).GetId(), metadata));
194 result =
dynamic_cast<CellType*
>(ok.first->second.GetPointer());
222 template <
typename CellType>
225 CellType* meta = this->GetCellsOfType<CellType>();
230 return this->RemoveCellMetadata(meta);
250 template <
typename CellType>
254 if (it == this->
Cells.end())
258 return static_cast<const CellType*
>(it->second.GetPointer());
260 template <
typename CellType>
264 if (it == this->
Cells.end())
268 return static_cast<CellType*
>(it->second.GetPointer());
276 template <
typename Container>
279 for (
const auto& entry : this->
Cells)
281 cellTypes.insert(cellTypes.end(), entry.first);
284 template <
typename Container>
288 this->CellTypes(cellTypes);
293#if defined(_MSC_VER) && _MSC_VER >= 1930 && _MSC_VER < 1940
298 static std::vector<vtkStringToken> cellTypes;
300 static thread_local std::vector<vtkStringToken> cellTypes;
303 this->CellTypes(cellTypes);
308 auto cta = this->CellTypeArray();
309 std::vector<std::string> result;
310 result.reserve(cta.size());
311 for (
const auto& cellTypeToken : cta)
313 result.push_back(cellTypeToken.Data());
366 double range[2],
bool finiteRange =
false)
const;
447 vtkGetMacro(SchemaVersion, vtkTypeUInt32);
454 vtkSetMacro(ContentVersion, vtkTypeUInt32);
455 vtkGetMacro(ContentVersion, vtkTypeUInt32)
491 bool ComputeBoundsInternal();
492 bool ComputeRangeInternal(
vtkCellAttribute* attribute,
int component,
bool finiteRange) const;
497 int NextAttribute = 0;
499 bool HaveShape{
false };
506 vtkTypeUInt32 SchemaVersion{ 0 };
511 vtkTypeUInt32 ContentVersion{ 0 };
Abstract superclass for all arrays.
A function defined over the physical domain of a vtkCellGrid.
Copy the cell metadata and attribute(s) of one cell-grid into another.
Perform an operation on cells in a vtkCellMetadata instance.
std::map< vtkCellAttribute *, std::vector< ComponentRange > > CacheMap
Visualization data composed of cells of arbitrary type.
void Initialize() override
Restore data object to initial state,.
vtkDataSetAttributes * GetAttributes(vtkStringToken type)
Fetch a partition of DOF arrays.
vtkIdType GetNumberOfElements(int type) override
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
int GetAttributeTypeForArray(vtkAbstractArray *arr) override
Retrieves the attribute type that an array came from.
vtkCellMetadata * AddCellMetadata(vtkStringToken cellTypeName)
Insert a cell type, if possible.
vtkIdType GetNumberOfCells()
Return the number of cells (of all types).
void DeepCopy(vtkDataObject *baseSrc) override
Copy baseSrc by value (which must be a vtkCellGrid) into this object.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
void ClearRangeCache(const std::string &attributeName=std::string())
Clear the cache of cell-attribute range data.
CellType * GetCellsOfType()
Get a cell metadata object of the given type.
vtkDataSetAttributes * FindAttributes(int type) const
Fetch a partition of DOF arrays.
std::vector< vtkStringToken > CellTypeArray() const
Fill a container with all the cell types (as string tokens).
std::vector< std::string > GetCellTypes() const
Fill a container with all the cell types (as string tokens).
vtkCellGridRangeQuery::CacheMap & GetRangeCache() const
Return the cache of cell-attribute range data.
virtual void SetSchema(vtkStringToken name, vtkTypeUInt32 version)
Set the schema name and version number that generated this object.
vtkCellMetadata * GetCellType(vtkStringToken cellTypeName)
Return an object that can operate on this vtkCellGrid's cells of the given type.
bool SetShapeAttribute(vtkCellAttribute *shape)
Set/get the "shape attribute" (i.e., a vector-valued cell-attribute that maps from reference to world...
void ShallowCopy(vtkDataObject *baseSrc) override
Copy baseSrc by value (which must be a vtkCellGrid) into this object.
vtkCellAttribute * GetCellAttributeByName(const std::string &name)
Return an attribute given its name or identifier.
virtual bool AddCellAttribute(vtkCellAttribute *attribute)
Add a cell-attribute to the dataset.
vtkCellAttribute * GetCellAttribute(vtkStringToken::Hash hash)
Return an attribute given its hash.
virtual bool RemoveCellAttribute(vtkCellAttribute *attribute)
Remove a cell-attribute from the dataset.
vtkDataSetAttributes * FindAttributes(vtkStringToken type) const
Fetch a partition of DOF arrays.
CellType * AddCellMetadata()
Insert a cell type, if possible.
const CellType * GetCellsOfType() const
Get a cell metadata object of the given type.
int GetDataObjectType() override
Return class name of data type.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool CopyStructure(vtkCellGrid *other, bool byReference=true)
Copy the geometric and topological data from other, but not any attributes.
vtkGetStringTokenMacro(SchemaName)
bool Query(vtkCellGridQuery *query)
Perform a query on all the cells in this instance.
void CellTypes(Container &cellTypes) const
Fill a container with all the cell types (as string tokens).
std::vector< int > GetUnorderedCellAttributeIds() const
virtual bool GetCellAttributeRange(vtkCellAttribute *attribute, int componentIndex, double range[2], bool finiteRange=false) const
Return information on the range of values taken on by a component of an attribute.
void MapArrayLocations(std::unordered_map< vtkAbstractArray *, vtkStringToken > &arrayLocations) const
This method populates the map you pass with pointers to all arrays in this cell-grid's vtkDataSetAttr...
std::array< double, 6 > CachedBounds
const std::unordered_map< int, vtkSmartPointer< vtkDataSetAttributes > > & GetArrayGroups() const
Fetch a partition of DOF arrays.
bool RemoveCellMetadata()
vtkTimeStamp CachedBoundsTime
vtkCellMetadata * AddCellMetadata(vtkCellMetadata *cellType)
Insert a cell type, if possible.
int AddAllCellMetadata()
Add every registered cell type to this grid.
static vtkCellGrid * New()
vtkStringToken SchemaName
A string specifying the schema which generated this cell-grid.
std::vector< vtkSmartPointer< vtkCellAttribute > > GetCellAttributeList() const
Return a vector of all this grid's cell-attributes.
vtkCellAttribute * GetCellAttributeById(int attributeId)
Return an attribute given its name or identifier.
bool SupportsGhostArray(int type) override
Returns true if type is CELL, false otherwise.
vtkCellAttribute * GetShapeAttribute()
Set/get the "shape attribute" (i.e., a vector-valued cell-attribute that maps from reference to world...
int RemoveUnusedCellMetadata()
Remove every registered cell type in this grid which has no cells.
vtkCellGridRangeQuery::CacheMap RangeCache
Cache for cell attribute component ranges.
void GetBounds(double bounds[6])
Fill the provided bounding box with the bounds of all the cells present in the grid.
Container CellTypes() const
Fill a container with all the cell types (as string tokens).
std::set< int > GetCellAttributeIds() const
Return the set of cell attribute IDs.
vtkUnsignedCharArray * GetGhostArray(int type) override
Returns the ghost arrays of the data object of the specified attribute type.
const vtkCellMetadata * GetCellType(vtkStringToken cellTypeName) const
Return an object that can operate on this vtkCellGrid's cells of the given type.
bool RemoveCellMetadata(vtkCellMetadata *meta)
vtkDataSetAttributes * GetAttributes(int type) override
Fetch a partition of DOF arrays.
abstract superclass for arrays of numeric data
general representation of visualization data
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
Represent a string by its integer hash.
record modification and/or execution time
dynamic, self-adjusting array of unsigned char
@ Cells
A cell specified by degrees of freedom held in arrays.