VTK-m  2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
vtkm::cont::DataSet Class Reference

Contains and manages the geometric data structures that VTK-m operates on. More...

#include <DataSet.h>

Public Member Functions

 DataSet ()=default
 
 DataSet (vtkm::cont::DataSet &&)=default
 
 DataSet (const vtkm::cont::DataSet &)=default
 
vtkm::cont::DataSetoperator= (vtkm::cont::DataSet &&)=default
 
vtkm::cont::DataSetoperator= (const vtkm::cont::DataSet &)=default
 
void Clear ()
 
vtkm::Id GetNumberOfCells () const
 Get the number of cells contained in this DataSet. More...
 
vtkm::Id GetNumberOfPoints () const
 Get the number of points contained in this DataSet. More...
 
void AddField (const Field &field)
 Adds a field to the DataSet. More...
 
void AddField (const std::string &name, vtkm::cont::Field::Association association, const vtkm::cont::UnknownArrayHandle &data)
 Adds a field to the DataSet. More...
 
bool HasField (const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
 
bool HasCellField (const std::string &name) const
 
bool HasGhostCellField () const
 
const std::string & GetGhostCellFieldName () const
 
bool HasPointField (const std::string &name) const
 
vtkm::Id GetFieldIndex (const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
 Returns the field that matches the provided name and association. More...
 
void SetGhostCellFieldName (const std::string &name)
 Sets the name of the field to use for cell ghost levels. More...
 
void SetGhostCellField (const std::string &name)
 Sets the cell field of the given name as the cell ghost levels. More...
 
void SetGhostCellField (const vtkm::cont::UnknownArrayHandle &field)
 Sets the ghost cell levels to the given array. More...
 
void AddGhostCellField (const std::string &fieldName, const vtkm::cont::UnknownArrayHandle &field)
 
void AddGhostCellField (const vtkm::cont::UnknownArrayHandle &field)
 
void AddGhostCellField (const vtkm::cont::Field &field)
 
vtkm::IdComponent AddCoordinateSystem (const vtkm::cont::CoordinateSystem &cs)
 Adds the given CoordinateSystem to the DataSet. More...
 
vtkm::IdComponent AddCoordinateSystem (const std::string &name, const vtkm::cont::UnknownArrayHandle &data)
 Adds a CoordinateSystem with the given name and data. More...
 
vtkm::IdComponent AddCoordinateSystem (const std::string &pointFieldName)
 Marks the point field with the given name as a coordinate system. More...
 
bool HasCoordinateSystem (const std::string &name) const
 
vtkm::cont::CoordinateSystem GetCoordinateSystem (vtkm::Id index=0) const
 
vtkm::IdComponent GetCoordinateSystemIndex (const std::string &name) const
 Returns the index for the CoordinateSystem whose name matches the provided string. More...
 
const std::string & GetCoordinateSystemName (vtkm::Id index=0) const
 
vtkm::cont::CoordinateSystem GetCoordinateSystem (const std::string &name) const
 Returns the CoordinateSystem that matches the provided name. More...
 
template<typename CellSetType >
void SetCellSet (const CellSetType &cellSet)
 
const vtkm::cont::UnknownCellSetGetCellSet () const
 
vtkm::cont::UnknownCellSetGetCellSet ()
 
vtkm::IdComponent GetNumberOfFields () const
 
vtkm::IdComponent GetNumberOfCoordinateSystems () const
 
void CopyStructure (const vtkm::cont::DataSet &source)
 Copies the structure from the source dataset. More...
 
void ConvertToExpected ()
 Convert the structures in this data set to expected types. More...
 
void PrintSummary (std::ostream &out) const
 
const vtkm::cont::FieldGetField (vtkm::Id index) const
 Retrieves a field by index. More...
 
vtkm::cont::FieldGetField (vtkm::Id index)
 Retrieves a field by index. More...
 
const vtkm::cont::FieldGetField (const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
 Returns the field that matches the provided name and association. More...
 
vtkm::cont::FieldGetField (const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any)
 Returns the field that matches the provided name and association. More...
 
const vtkm::cont::FieldGetCellField (const std::string &name) const
 Returns the first cell field that matches the provided name. More...
 
vtkm::cont::FieldGetCellField (const std::string &name)
 Returns the first cell field that matches the provided name. More...
 
vtkm::cont::Field GetGhostCellField () const
 Returns the cell field that matches the ghost cell field name. More...
 
const vtkm::cont::FieldGetPointField (const std::string &name) const
 Returns the first point field that matches the provided name. More...
 
vtkm::cont::FieldGetPointField (const std::string &name)
 Returns the first point field that matches the provided name. More...
 
void AddPointField (const std::string &fieldName, const vtkm::cont::UnknownArrayHandle &field)
 Adds a point field of a given name to the DataSet. More...
 
template<typename T , typename Storage >
void AddPointField (const std::string &fieldName, const vtkm::cont::ArrayHandle< T, Storage > &field)
 Adds a point field of a given name to the DataSet. More...
 
template<typename T >
void AddPointField (const std::string &fieldName, const std::vector< T > &field)
 Adds a point field of a given name to the DataSet. More...
 
template<typename T >
void AddPointField (const std::string &fieldName, const T *field, const vtkm::Id &n)
 Adds a point field of a given name to the DataSet. More...
 
void AddCellField (const std::string &fieldName, const vtkm::cont::UnknownArrayHandle &field)
 Adds a cell field of a given name to the DataSet. More...
 
template<typename T , typename Storage >
void AddCellField (const std::string &fieldName, const vtkm::cont::ArrayHandle< T, Storage > &field)
 Adds a cell field of a given name to the DataSet. More...
 
template<typename T >
void AddCellField (const std::string &fieldName, const std::vector< T > &field)
 Adds a cell field of a given name to the DataSet. More...
 
template<typename T >
void AddCellField (const std::string &fieldName, const T *field, const vtkm::Id &n)
 Adds a cell field of a given name to the DataSet. More...
 
void SetGhostCellField (const vtkm::cont::Field &field)
 Sets the ghost cell levels. More...
 
void SetGhostCellField (const std::string &fieldName, const vtkm::cont::UnknownArrayHandle &field)
 Sets the ghost cell levels. More...
 

Private Member Functions

void SetCellSetImpl (const vtkm::cont::UnknownCellSet &cellSet)
 

Private Attributes

std::vector< std::string > CoordSystemNames
 
vtkm::cont::internal::FieldCollection Fields
 
vtkm::cont::UnknownCellSet CellSet
 
std::shared_ptr< std::string > GhostCellName
 

Detailed Description

Contains and manages the geometric data structures that VTK-m operates on.

A DataSet is the main data structure used by VTK-m to pass data in and out of filters, rendering, and other components. A data set comprises the following 3 data structures.

Constructor & Destructor Documentation

◆ DataSet() [1/3]

vtkm::cont::DataSet::DataSet ( )
default

◆ DataSet() [2/3]

vtkm::cont::DataSet::DataSet ( vtkm::cont::DataSet &&  )
default

◆ DataSet() [3/3]

vtkm::cont::DataSet::DataSet ( const vtkm::cont::DataSet )
default

Member Function Documentation

◆ AddCellField() [1/4]

template<typename T >
void vtkm::cont::DataSet::AddCellField ( const std::string &  fieldName,
const std::vector< T > &  field 
)
inline

Adds a cell field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddCellField() [2/4]

template<typename T >
void vtkm::cont::DataSet::AddCellField ( const std::string &  fieldName,
const T *  field,
const vtkm::Id n 
)
inline

Adds a cell field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddCellField() [3/4]

template<typename T , typename Storage >
void vtkm::cont::DataSet::AddCellField ( const std::string &  fieldName,
const vtkm::cont::ArrayHandle< T, Storage > &  field 
)
inline

Adds a cell field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddCellField() [4/4]

void vtkm::cont::DataSet::AddCellField ( const std::string &  fieldName,
const vtkm::cont::UnknownArrayHandle field 
)
inline

Adds a cell field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddCoordinateSystem() [1/3]

vtkm::IdComponent vtkm::cont::DataSet::AddCoordinateSystem ( const std::string &  name,
const vtkm::cont::UnknownArrayHandle data 
)

Adds a CoordinateSystem with the given name and data.

The coordinate system will also be added as a point field of the same name.

Returns
the field index assigned to the added coordinate system.

◆ AddCoordinateSystem() [2/3]

vtkm::IdComponent vtkm::cont::DataSet::AddCoordinateSystem ( const std::string &  pointFieldName)

Marks the point field with the given name as a coordinate system.

If no such point field exists or the point field is of the wrong format, an exception will be throw.

Returns
the field index assigned to the added coordinate system.

◆ AddCoordinateSystem() [3/3]

vtkm::IdComponent vtkm::cont::DataSet::AddCoordinateSystem ( const vtkm::cont::CoordinateSystem cs)

Adds the given CoordinateSystem to the DataSet.

The coordinate system will also be added as a point field of the same name.

Returns
the field index assigned to the added coordinate system.

◆ AddField() [1/2]

void vtkm::cont::DataSet::AddField ( const Field field)

Adds a field to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddField() [2/2]

void vtkm::cont::DataSet::AddField ( const std::string &  name,
vtkm::cont::Field::Association  association,
const vtkm::cont::UnknownArrayHandle data 
)

Adds a field to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddGhostCellField() [1/3]

void vtkm::cont::DataSet::AddGhostCellField ( const std::string &  fieldName,
const vtkm::cont::UnknownArrayHandle field 
)
inline

◆ AddGhostCellField() [2/3]

void vtkm::cont::DataSet::AddGhostCellField ( const vtkm::cont::Field field)
inline

◆ AddGhostCellField() [3/3]

void vtkm::cont::DataSet::AddGhostCellField ( const vtkm::cont::UnknownArrayHandle field)
inline

◆ AddPointField() [1/4]

template<typename T >
void vtkm::cont::DataSet::AddPointField ( const std::string &  fieldName,
const std::vector< T > &  field 
)
inline

Adds a point field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddPointField() [2/4]

template<typename T >
void vtkm::cont::DataSet::AddPointField ( const std::string &  fieldName,
const T *  field,
const vtkm::Id n 
)
inline

Adds a point field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddPointField() [3/4]

template<typename T , typename Storage >
void vtkm::cont::DataSet::AddPointField ( const std::string &  fieldName,
const vtkm::cont::ArrayHandle< T, Storage > &  field 
)
inline

Adds a point field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ AddPointField() [4/4]

void vtkm::cont::DataSet::AddPointField ( const std::string &  fieldName,
const vtkm::cont::UnknownArrayHandle field 
)
inline

Adds a point field of a given name to the DataSet.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ Clear()

void vtkm::cont::DataSet::Clear ( )

◆ ConvertToExpected()

void vtkm::cont::DataSet::ConvertToExpected ( )

Convert the structures in this data set to expected types.

A DataSet object can contain data structures of unknown types. Using the data requires casting these data structures to concrete types. It is only possible to check a finite number of data structures.

The types checked by default are listed in vtkm/cont/DefaultTypes.h, which can be configured at compile time. If a DataSet contains data not listed there, then it is likely going to cause problems pulling the data back out. To get around this problem, you can call this method to convert the data to a form that is likely to be recognized. This conversion is likely but not guaranteed because not all types are convertable to something recognizable.

◆ CopyStructure()

void vtkm::cont::DataSet::CopyStructure ( const vtkm::cont::DataSet source)

Copies the structure from the source dataset.

The structure includes the cellset, the coordinate systems, and any ghost layer information. The fields that are not part of a coordinate system or ghost layers are left unchanged.

◆ GetCellField() [1/2]

vtkm::cont::Field& vtkm::cont::DataSet::GetCellField ( const std::string &  name)
inline

Returns the first cell field that matches the provided name.

This method will throw an exception if no match is found. Use HasCellField() to query whether a particular field exists.

◆ GetCellField() [2/2]

const vtkm::cont::Field& vtkm::cont::DataSet::GetCellField ( const std::string &  name) const
inline

Returns the first cell field that matches the provided name.

This method will throw an exception if no match is found. Use HasCellField() to query whether a particular field exists.

◆ GetCellSet() [1/2]

vtkm::cont::UnknownCellSet& vtkm::cont::DataSet::GetCellSet ( )
inline

◆ GetCellSet() [2/2]

const vtkm::cont::UnknownCellSet& vtkm::cont::DataSet::GetCellSet ( ) const
inline

◆ GetCoordinateSystem() [1/2]

vtkm::cont::CoordinateSystem vtkm::cont::DataSet::GetCoordinateSystem ( const std::string &  name) const

Returns the CoordinateSystem that matches the provided name.

Will throw an exception if no match is found

◆ GetCoordinateSystem() [2/2]

vtkm::cont::CoordinateSystem vtkm::cont::DataSet::GetCoordinateSystem ( vtkm::Id  index = 0) const

◆ GetCoordinateSystemIndex()

vtkm::IdComponent vtkm::cont::DataSet::GetCoordinateSystemIndex ( const std::string &  name) const

Returns the index for the CoordinateSystem whose name matches the provided string.

Will return -1 if no match is found

◆ GetCoordinateSystemName()

const std::string& vtkm::cont::DataSet::GetCoordinateSystemName ( vtkm::Id  index = 0) const

◆ GetField() [1/4]

vtkm::cont::Field& vtkm::cont::DataSet::GetField ( const std::string &  name,
vtkm::cont::Field::Association  assoc = vtkm::cont::Field::Association::Any 
)
inline

Returns the field that matches the provided name and association.

This method will throw an exception if no match is found. Use HasField() to query whether a particular field exists.

◆ GetField() [2/4]

const vtkm::cont::Field& vtkm::cont::DataSet::GetField ( const std::string &  name,
vtkm::cont::Field::Association  assoc = vtkm::cont::Field::Association::Any 
) const
inline

Returns the field that matches the provided name and association.

This method will throw an exception if no match is found. Use HasField() to query whether a particular field exists.

◆ GetField() [3/4]

vtkm::cont::Field& vtkm::cont::DataSet::GetField ( vtkm::Id  index)
inline

Retrieves a field by index.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index. This method is most useful for iterating over all the fields of a DataSet (indexed from 0 to NumberOfFields() - 1).

◆ GetField() [4/4]

const vtkm::cont::Field& vtkm::cont::DataSet::GetField ( vtkm::Id  index) const
inline

Retrieves a field by index.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index. This method is most useful for iterating over all the fields of a DataSet (indexed from 0 to NumberOfFields() - 1).

◆ GetFieldIndex()

vtkm::Id vtkm::cont::DataSet::GetFieldIndex ( const std::string &  name,
vtkm::cont::Field::Association  assoc = vtkm::cont::Field::Association::Any 
) const
inline

Returns the field that matches the provided name and association.

This method will return -1 if no match for the field is found.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ GetGhostCellField()

vtkm::cont::Field vtkm::cont::DataSet::GetGhostCellField ( ) const

Returns the cell field that matches the ghost cell field name.

This method will return a constant array of zeros if no match is found. Use HasGhostCellField() to query whether a particular field exists.

◆ GetGhostCellFieldName()

const std::string& vtkm::cont::DataSet::GetGhostCellFieldName ( ) const

◆ GetNumberOfCells()

vtkm::Id vtkm::cont::DataSet::GetNumberOfCells ( ) const

Get the number of cells contained in this DataSet.

◆ GetNumberOfCoordinateSystems()

vtkm::IdComponent vtkm::cont::DataSet::GetNumberOfCoordinateSystems ( ) const
inline

◆ GetNumberOfFields()

vtkm::IdComponent vtkm::cont::DataSet::GetNumberOfFields ( ) const
inline

◆ GetNumberOfPoints()

vtkm::Id vtkm::cont::DataSet::GetNumberOfPoints ( ) const

Get the number of points contained in this DataSet.

Note: All coordinate systems for a DataSet are expected to have the same number of points.

◆ GetPointField() [1/2]

vtkm::cont::Field& vtkm::cont::DataSet::GetPointField ( const std::string &  name)
inline

Returns the first point field that matches the provided name.

This method will throw an exception if no match is found. Use HasPointField() to query whether a particular field exists.

◆ GetPointField() [2/2]

const vtkm::cont::Field& vtkm::cont::DataSet::GetPointField ( const std::string &  name) const
inline

Returns the first point field that matches the provided name.

This method will throw an exception if no match is found. Use HasPointField() to query whether a particular field exists.

◆ HasCellField()

bool vtkm::cont::DataSet::HasCellField ( const std::string &  name) const
inline

◆ HasCoordinateSystem()

bool vtkm::cont::DataSet::HasCoordinateSystem ( const std::string &  name) const
inline

◆ HasField()

bool vtkm::cont::DataSet::HasField ( const std::string &  name,
vtkm::cont::Field::Association  assoc = vtkm::cont::Field::Association::Any 
) const
inline

◆ HasGhostCellField()

bool vtkm::cont::DataSet::HasGhostCellField ( ) const

◆ HasPointField()

bool vtkm::cont::DataSet::HasPointField ( const std::string &  name) const
inline

◆ operator=() [1/2]

vtkm::cont::DataSet& vtkm::cont::DataSet::operator= ( const vtkm::cont::DataSet )
default

◆ operator=() [2/2]

vtkm::cont::DataSet& vtkm::cont::DataSet::operator= ( vtkm::cont::DataSet &&  )
default

◆ PrintSummary()

void vtkm::cont::DataSet::PrintSummary ( std::ostream &  out) const

◆ SetCellSet()

template<typename CellSetType >
void vtkm::cont::DataSet::SetCellSet ( const CellSetType &  cellSet)
inline

◆ SetCellSetImpl()

void vtkm::cont::DataSet::SetCellSetImpl ( const vtkm::cont::UnknownCellSet cellSet)
private

◆ SetGhostCellField() [1/4]

void vtkm::cont::DataSet::SetGhostCellField ( const std::string &  fieldName,
const vtkm::cont::UnknownArrayHandle field 
)

Sets the ghost cell levels.

A field of the given name is added to the DataSet, and that field is set as the cell ghost levels.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ SetGhostCellField() [2/4]

void vtkm::cont::DataSet::SetGhostCellField ( const std::string &  name)

Sets the cell field of the given name as the cell ghost levels.

If a cell field of the given name does not exist, an exception is thrown.

◆ SetGhostCellField() [3/4]

void vtkm::cont::DataSet::SetGhostCellField ( const vtkm::cont::Field field)

Sets the ghost cell levels.

A field of the given name is added to the DataSet, and that field is set as the cell ghost levels.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ SetGhostCellField() [4/4]

void vtkm::cont::DataSet::SetGhostCellField ( const vtkm::cont::UnknownArrayHandle field)

Sets the ghost cell levels to the given array.

A field with the global ghost cell field name (see GlobalGhostCellFieldName) is added to the DataSet and made to be the cell ghost levels.

Note that the indexing of fields is not the same as the order in which they are added, and that adding a field can arbitrarily reorder the integer indexing of all the fields. To retrieve a specific field, retrieve the field by name, not by integer index.

◆ SetGhostCellFieldName()

void vtkm::cont::DataSet::SetGhostCellFieldName ( const std::string &  name)

Sets the name of the field to use for cell ghost levels.

This value can be set regardless of whether such a cell field actually exists.

Member Data Documentation

◆ CellSet

vtkm::cont::UnknownCellSet vtkm::cont::DataSet::CellSet
private

◆ CoordSystemNames

std::vector<std::string> vtkm::cont::DataSet::CoordSystemNames
private

◆ Fields

vtkm::cont::internal::FieldCollection vtkm::cont::DataSet::Fields
private

◆ GhostCellName

std::shared_ptr<std::string> vtkm::cont::DataSet::GhostCellName
private

The documentation for this class was generated from the following file:
vtkm::cont::Field::Association::WholeDataSet
@ WholeDataSet
A "global" field that applies to the entirety of a vtkm::cont::DataSet.
vtkm::cont::Field::Association::Points
@ Points
A field that applies to points.
vtkm::cont::Field::Association::Cells
@ Cells
A field that applies to cells.