VTK-m  2.1
Public Types | Public Member Functions | Private Attributes | List of all members
vtkm::cont::Field Class Reference

A Field encapsulates an array on some piece of the mesh, such as the points, a cell set, a point logical dimension, or the whole mesh. More...

#include <Field.h>

Inheritance diagram for vtkm::cont::Field:
vtkm::cont::CoordinateSystem

Public Types

enum  Association {
  Association::Any, Association::WholeDataSet, Association::Points, Association::Cells,
  Association::Partitions, Association::Global
}
 Identifies what elements of a data set a field is associated with. More...
 

Public Member Functions

 Field ()=default
 
 Field (std::string name, Association association, const vtkm::cont::UnknownArrayHandle &data)
 
template<typename T , typename Storage >
 Field (std::string name, Association association, const vtkm::cont::ArrayHandle< T, Storage > &data)
 
 Field (const vtkm::cont::Field &src)
 
 Field (vtkm::cont::Field &&src) noexcept
 
virtual ~Field ()
 
Fieldoperator= (const vtkm::cont::Field &src)
 
Fieldoperator= (vtkm::cont::Field &&src) noexcept
 
bool IsCellField () const
 
bool IsPointField () const
 
bool IsWholeDataSetField () const
 
bool IsPartitionsField () const
 
bool IsGlobalField () const
 
bool IsSupportedType () const
 Returns true if the array of the field has a value type that matches something in VTKM_FIELD_TYPE_LIST and a storage that matches something in VTKM_FIELD_STORAGE_LIST. More...
 
vtkm::Id GetNumberOfValues () const
 
const std::string & GetName () const
 
Association GetAssociation () const
 
const vtkm::cont::UnknownArrayHandleGetData () const
 
vtkm::cont::UnknownArrayHandleGetData ()
 
const vtkm::cont::ArrayHandle< vtkm::Range > & GetRange () const
 Returns the range of each component in the field array. More...
 
void GetRange (vtkm::Range *range) const
 
vtkm::cont::UnknownArrayHandle GetDataAsDefaultFloat () const
 Get the data as an array with vtkm::FloatDefault components. More...
 
vtkm::cont::UnknownArrayHandle GetDataWithExpectedTypes () const
 Get the data as an array of an expected type. More...
 
void ConvertToExpected ()
 Convert this field to use an array of an expected type. More...
 
void SetData (const vtkm::cont::UnknownArrayHandle &newdata)
 
template<typename T , typename StorageTag >
void SetData (const vtkm::cont::ArrayHandle< T, StorageTag > &newdata)
 
virtual void PrintSummary (std::ostream &out) const
 
virtual void ReleaseResourcesExecution ()
 

Private Attributes

std::string Name
 name of field More...
 
Association FieldAssociation = Association::Any
 
vtkm::cont::UnknownArrayHandle Data
 
vtkm::cont::ArrayHandle< vtkm::RangeRange
 
bool ModifiedFlag = true
 

Detailed Description

A Field encapsulates an array on some piece of the mesh, such as the points, a cell set, a point logical dimension, or the whole mesh.

Member Enumeration Documentation

◆ Association

Identifies what elements of a data set a field is associated with.

The Association enum is used by vtkm::cont::Field to specify on what topological elements each item in the field is associated with.

Enumerator
Any 

Any field regardless of the association.

This is used when choosing a vtkm::cont::Field that could be of any association. It is often used as the default if no association is given.

WholeDataSet 

A "global" field that applies to the entirety of a vtkm::cont::DataSet.

Fields of this association often contain summary or annotation information. An example of a whole data set field could be the region that the mesh covers.

Points 

A field that applies to points.

There is a separate field value attached to each point. Point fields usually represent samples of continuous data that can be reinterpolated through cells. Physical properties such as temperature, pressure, density, velocity, etc. are usually best represented in point fields. Data that deals with the points of the topology, such as displacement vectors, are also appropriate for point data.

Cells 

A field that applies to cells.

There is a separate field value attached to each cell in a cell set. Cell fields usually represent values from an integration over the finite cells of the mesh. Integrated values like mass or volume are best represented in cell fields. Statistics about each cell like strain or cell quality are also appropriate for cell data.

Partitions 

A field that applies to partitions.

This type of field is attached to a vtkm::cont::PartitionedDataSet. There is a separate field value attached to each partition. Identification or information about the arrangement of partitions such as hierarchy levels are usually best represented in partition fields.

Global 

A field that applies to all partitions.

This type of field is attached to a vtkm::cont::PartitionedDataSet. It contains values that are "global" across all partitions and data therin.

Constructor & Destructor Documentation

◆ Field() [1/5]

vtkm::cont::Field::Field ( )
default

◆ Field() [2/5]

vtkm::cont::Field::Field ( std::string  name,
Association  association,
const vtkm::cont::UnknownArrayHandle data 
)

◆ Field() [3/5]

template<typename T , typename Storage >
vtkm::cont::Field::Field ( std::string  name,
Association  association,
const vtkm::cont::ArrayHandle< T, Storage > &  data 
)
inline

◆ Field() [4/5]

vtkm::cont::Field::Field ( const vtkm::cont::Field src)

◆ Field() [5/5]

vtkm::cont::Field::Field ( vtkm::cont::Field &&  src)
noexcept

◆ ~Field()

virtual vtkm::cont::Field::~Field ( )
virtual

Member Function Documentation

◆ ConvertToExpected()

void vtkm::cont::Field::ConvertToExpected ( )

Convert this field to use an array of an expected type.

Copies the internal data, as necessary, to an array that (probably) has a value type that matches something in VTKM_FIELD_TYPE_LIST and a storage that matches something in VTKM_FIELD_STORAGE_LIST. If the field already has a value type and storage that match VTKM_FIELD_TYPE_LIST and VTKM_FIELD_STORAGE_LIST respectively, then nothing in the field is changed. If something does not match, then the data are copied to a vtkm::cont::ArrayHandleBasic with a value type component of vtkm::FloatDefault.

Note that the returned array is likely to be compatible with VTKM_FIELD_TYPE_LIST, but not guaranteed. In particular, if this field contains Vecs, the returned array will also contain Vecs of the same size. For example, if the field contains vtkm::Vec2i_16 values, they will (likely) be converted to vtkm::Vec2f. Howver, vtkm::Vec2f may still not be in VTKM_FIELD_TYPE_LIST.

◆ GetAssociation()

Association vtkm::cont::Field::GetAssociation ( ) const
inline

◆ GetData() [1/2]

vtkm::cont::UnknownArrayHandle& vtkm::cont::Field::GetData ( )

◆ GetData() [2/2]

const vtkm::cont::UnknownArrayHandle& vtkm::cont::Field::GetData ( ) const

◆ GetDataAsDefaultFloat()

vtkm::cont::UnknownArrayHandle vtkm::cont::Field::GetDataAsDefaultFloat ( ) const

Get the data as an array with vtkm::FloatDefault components.

Returns a vtkm::cont::UnknownArrayHandle that contains an array that either contains values of type vtkm::FloatDefault or contains Vecs with components of type vtkm::FloatDefault. If the array has value types that do not match this type, then it will be copied into an array that does.

Additionally, the returned array will have a storage that is compatible with something in VTKM_FIELD_STORAGE_LIST. If this condition is not met, then the array will be copied.

If the array contained in the field already matches the required criteria, the array will be returned without copying.

◆ GetDataWithExpectedTypes()

vtkm::cont::UnknownArrayHandle vtkm::cont::Field::GetDataWithExpectedTypes ( ) const

Get the data as an array of an expected type.

Returns a vtkm::cont::UnknownArrayHandle that contains an array that (probably) has a value type that matches something in VTKM_FIELD_TYPE_LIST and a storage that matches something in VTKM_FIELD_STORAGE_LIST. If the array has a value type and storage that match VTKM_FIELD_TYPE_LIST and VTKM_FIELD_STORAGE_LIST respectively, then the same array is returned. If something does not match, then the data are copied to a vtkm::cont::ArrayHandleBasic with a value type component of vtkm::FloatDefault.

Note that the returned array is likely to be compatible with VTKM_FIELD_TYPE_LIST, but not guaranteed. In particular, if this field contains Vecs, the returned array will also contain Vecs of the same size. For example, if the field contains vtkm::Vec2i_16 values, they will (likely) be converted to vtkm::Vec2f. Howver, vtkm::Vec2f may still not be in VTKM_FIELD_TYPE_LIST.

◆ GetName()

const std::string& vtkm::cont::Field::GetName ( ) const
inline

◆ GetNumberOfValues()

vtkm::Id vtkm::cont::Field::GetNumberOfValues ( ) const
inline

◆ GetRange() [1/2]

const vtkm::cont::ArrayHandle<vtkm::Range>& vtkm::cont::Field::GetRange ( ) const

Returns the range of each component in the field array.

The ranges of each component are returned in an ArrayHandle containing vtkm::Range values. So, for example, calling GetRange on a scalar field will return an ArrayHandle with exactly 1 entry in it. Calling GetRange on a field of 3D vectors will return an ArrayHandle with exactly 3 entries corresponding to each of the components in the range.

◆ GetRange() [2/2]

void vtkm::cont::Field::GetRange ( vtkm::Range range) const

◆ IsCellField()

bool vtkm::cont::Field::IsCellField ( ) const
inline

◆ IsGlobalField()

bool vtkm::cont::Field::IsGlobalField ( ) const
inline

◆ IsPartitionsField()

bool vtkm::cont::Field::IsPartitionsField ( ) const
inline

◆ IsPointField()

bool vtkm::cont::Field::IsPointField ( ) const
inline

◆ IsSupportedType()

bool vtkm::cont::Field::IsSupportedType ( ) const

Returns true if the array of the field has a value type that matches something in VTKM_FIELD_TYPE_LIST and a storage that matches something in VTKM_FIELD_STORAGE_LIST.

◆ IsWholeDataSetField()

bool vtkm::cont::Field::IsWholeDataSetField ( ) const
inline

◆ operator=() [1/2]

Field& vtkm::cont::Field::operator= ( const vtkm::cont::Field src)

◆ operator=() [2/2]

Field& vtkm::cont::Field::operator= ( vtkm::cont::Field &&  src)
noexcept

◆ PrintSummary()

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

Reimplemented in vtkm::cont::CoordinateSystem.

◆ ReleaseResourcesExecution()

virtual void vtkm::cont::Field::ReleaseResourcesExecution ( )
inlinevirtual

Reimplemented in vtkm::cont::CoordinateSystem.

◆ SetData() [1/2]

template<typename T , typename StorageTag >
void vtkm::cont::Field::SetData ( const vtkm::cont::ArrayHandle< T, StorageTag > &  newdata)
inline

◆ SetData() [2/2]

void vtkm::cont::Field::SetData ( const vtkm::cont::UnknownArrayHandle newdata)

Member Data Documentation

◆ Data

vtkm::cont::UnknownArrayHandle vtkm::cont::Field::Data
private

◆ FieldAssociation

Association vtkm::cont::Field::FieldAssociation = Association::Any
private

◆ ModifiedFlag

bool vtkm::cont::Field::ModifiedFlag = true
mutableprivate

◆ Name

std::string vtkm::cont::Field::Name
private

name of field

◆ Range

vtkm::cont::ArrayHandle<vtkm::Range> vtkm::cont::Field::Range
mutableprivate

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