VTK-m
2.2
|
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>
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) | |
Create a field with the given name, association, and data. More... | |
template<typename T , typename Storage > | |
Field (std::string name, Association association, const vtkm::cont::ArrayHandle< T, Storage > &data) | |
Create a field with the given name, association, and data. More... | |
Field (const vtkm::cont::Field &src) | |
Field (vtkm::cont::Field &&src) noexcept | |
virtual | ~Field () |
Field & | operator= (const vtkm::cont::Field &src) |
Field & | operator= (vtkm::cont::Field &&src) noexcept |
bool | IsCellField () const |
Return true if this field is associated with cells. More... | |
bool | IsPointField () const |
Return true if this field is associated with points. More... | |
bool | IsWholeDataSetField () const |
Return true if this field is associated with the whole data set. More... | |
bool | IsPartitionsField () const |
Return true if this field is associated with partitions in a partitioned data set. More... | |
bool | IsGlobalField () const |
Return true if this field is global. More... | |
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 |
Return the number of values in the field array. More... | |
const std::string & | GetName () const |
Return the name of the field. More... | |
Association | GetAssociation () const |
Return the association of the field. More... | |
const vtkm::cont::UnknownArrayHandle & | GetData () const |
Get the array of the data for the field. More... | |
vtkm::cont::UnknownArrayHandle & | GetData () |
Get the array of the data for the field. More... | |
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 |
Returns the range of each component in the field array. More... | |
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, bool full=false) const |
Print a summary of the data in the field. More... | |
virtual void | ReleaseResourcesExecution () |
Remove the data from the device memory (but preserve the data on the host). More... | |
Private Attributes | |
std::string | Name |
name of field More... | |
Association | FieldAssociation = Association::Any |
vtkm::cont::UnknownArrayHandle | Data |
vtkm::cont::ArrayHandle< vtkm::Range > | Range |
bool | ModifiedFlag = true |
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.
|
strong |
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 |
WholeDataSet | A "global" field that applies to the entirety of a 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 |
Global | A field that applies to all partitions. This type of field is attached to a |
|
default |
vtkm::cont::Field::Field | ( | std::string | name, |
Association | association, | ||
const vtkm::cont::UnknownArrayHandle & | data | ||
) |
Create a field with the given name, association, and data.
|
inline |
Create a field with the given name, association, and data.
vtkm::cont::Field::Field | ( | const vtkm::cont::Field & | src | ) |
|
noexcept |
|
virtual |
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 Vec
s, the returned array will also contain Vec
s 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
.
|
inline |
Return the association of the field.
vtkm::cont::UnknownArrayHandle& vtkm::cont::Field::GetData | ( | ) |
Get the array of the data for the field.
const vtkm::cont::UnknownArrayHandle& vtkm::cont::Field::GetData | ( | ) | const |
Get the array of the data for the field.
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 Vec
s 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.
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 Vec
s, the returned array will also contain Vec
s 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
.
|
inline |
Return the name of the field.
|
inline |
Return the number of values in the field array.
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.
void vtkm::cont::Field::GetRange | ( | vtkm::Range * | range | ) | const |
Returns the range of each component in the field array.
A C array of vtkm::Range
objects is passed in as a place to store the result. It is imperative that the array be allocated to be large enough to hold an entry for each component.
|
inline |
Return true if this field is associated with cells.
|
inline |
Return true if this field is global.
A global field is applied to a vtkm::cont::PartitionedDataSet
to refer to data that applies across an entire collection of data.
|
inline |
Return true if this field is associated with partitions in a partitioned data set.
|
inline |
Return true if this field is associated with points.
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
.
|
inline |
Return true if this field is associated with the whole data set.
Field& vtkm::cont::Field::operator= | ( | const vtkm::cont::Field & | src | ) |
|
noexcept |
|
virtual |
Print a summary of the data in the field.
Reimplemented in vtkm::cont::CoordinateSystem.
|
inlinevirtual |
Remove the data from the device memory (but preserve the data on the host).
Reimplemented in vtkm::cont::CoordinateSystem.
|
inline |
void vtkm::cont::Field::SetData | ( | const vtkm::cont::UnknownArrayHandle & | newdata | ) |
|
private |
|
private |
|
mutableprivate |
|
private |
name of field
|
mutableprivate |