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

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

Private Member Functions

VTKM_CONT 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
 

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 >
VTKM_CONT 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 >
VTKM_CONT 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 >
VTKM_CONT 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]

VTKM_CONT 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/2]

VTKM_CONT 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 index assigned to the added coordinate system.

◆ AddCoordinateSystem() [2/2]

VTKM_CONT 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 index assigned to the added coordinate system.

◆ AddField()

VTKM_CONT 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.

◆ AddGhostCellField() [1/3]

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

◆ AddGhostCellField() [2/3]

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

◆ AddGhostCellField() [3/3]

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

◆ AddPointField() [1/4]

template<typename T >
VTKM_CONT 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 >
VTKM_CONT 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 >
VTKM_CONT 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]

VTKM_CONT 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()

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

◆ ConvertToExpected()

VTKM_CONT 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()

VTKM_CONT 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 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 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 vtkm::cont::UnknownCellSet& vtkm::cont::DataSet::GetCellSet ( )
inline

◆ GetCellSet() [2/2]

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

◆ GetCoordinateSystem() [1/2]

VTKM_CONT 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 vtkm::cont::CoordinateSystem vtkm::cont::DataSet::GetCoordinateSystem ( vtkm::Id  index = 0) const

◆ GetCoordinateSystemIndex()

VTKM_CONT 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 VTKM_CONT std::string& vtkm::cont::DataSet::GetCoordinateSystemName ( vtkm::Id  index = 0) const

◆ GetField() [1/4]

VTKM_CONT 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 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 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 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_CONT 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()

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

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

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

◆ GetGhostCellFieldName()

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

◆ GetNumberOfCells()

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

Get the number of cells contained in this DataSet.

◆ GetNumberOfCoordinateSystems()

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

◆ GetNumberOfFields()

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

◆ GetNumberOfPoints()

VTKM_CONT 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 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 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()

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

◆ HasCoordinateSystem()

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

◆ HasField()

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

◆ HasGhostCellField()

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

◆ HasPointField()

VTKM_CONT 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()

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

◆ SetCellSet()

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

◆ SetCellSetImpl()

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

◆ SetGhostCellField() [1/4]

VTKM_CONT 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]

VTKM_CONT 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]

VTKM_CONT 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]

VTKM_CONT 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()

VTKM_CONT 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
vtkm::cont::Field::Association::Points
@ Points
vtkm::cont::Field::Association::Cells
@ Cells