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

A FieldSelection stores information about fields to map for input dataset to output when a filter is executed. More...

#include <FieldSelection.h>

Public Types

enum  Mode { Mode::None, Mode::All, Mode::Select, Mode::Exclude }
 

Public Member Functions

 FieldSelection (Mode mode=Mode::Select)
 
 FieldSelection (const std::string &field, Mode mode=Mode::Select)
 Use this constructor to create a field selection given a single field name. More...
 
 FieldSelection (const char *field, Mode mode=Mode::Select)
 Use this constructor to create a field selection given a single field name. More...
 
 FieldSelection (const std::string &field, vtkm::cont::Field::Association association, Mode mode=Mode::Select)
 Use this constructor to create a field selection given a single name and association. More...
 
 FieldSelection (std::initializer_list< std::string > fields, Mode mode=Mode::Select)
 Use this constructor to create a field selection given the field names. More...
 
 FieldSelection (std::initializer_list< std::pair< std::string, vtkm::cont::Field::Association >> fields, Mode mode=Mode::Select)
 Use this constructor create a field selection given the field names and associations e.g. More...
 
 FieldSelection (std::initializer_list< vtkm::Pair< std::string, vtkm::cont::Field::Association >> fields, Mode mode=Mode::Select)
 Use this constructor create a field selection given the field names and associations e.g. More...
 
 FieldSelection (const FieldSelection &src)
 
 FieldSelection (FieldSelection &&rhs)
 
FieldSelectionoperator= (const FieldSelection &src)
 
FieldSelectionoperator= (FieldSelection &&rhs)
 
 ~FieldSelection ()
 
bool IsFieldSelected (const vtkm::cont::Field &inputField) const
 Returns true if the input field should be mapped to the output dataset. More...
 
bool IsFieldSelected (const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any) const
 
bool HasField (const vtkm::cont::Field &inputField) const
 Returns true if the input field has been added to this selection. More...
 
bool HasField (const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any) const
 
void ClearFields ()
 Clear all fields added using AddField. More...
 
Mode GetMode () const
 Gets the mode of the field selection. More...
 
void SetMode (Mode val)
 Sets the mode of the field selection. More...
 
void AddField (const vtkm::cont::Field &inputField)
 
void AddField (const vtkm::cont::Field &inputField, Mode mode)
 
void AddField (const std::string &fieldName, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
 
void AddField (const std::string &fieldName, Mode mode)
 
void AddField (const std::string &fieldName, vtkm::cont::Field::Association association, Mode mode)
 
Mode GetFieldMode (const vtkm::cont::Field &inputField) const
 
Mode GetFieldMode (const std::string &fieldName, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any) const
 

Private Attributes

std::unique_ptr< InternalStruct > Internals
 

Detailed Description

A FieldSelection stores information about fields to map for input dataset to output when a filter is executed.

A FieldSelection object is passed to vtkm::filter::Filter::Execute to execute the filter and map selected fields. It is possible to easily construct FieldSelection that selects all or none of the input fields.

Member Enumeration Documentation

◆ Mode

Enumerator
None 
All 
Select 
Exclude 

Constructor & Destructor Documentation

◆ FieldSelection() [1/9]

vtkm::filter::FieldSelection::FieldSelection ( Mode  mode = Mode::Select)

◆ FieldSelection() [2/9]

vtkm::filter::FieldSelection::FieldSelection ( const std::string &  field,
Mode  mode = Mode::Select 
)

Use this constructor to create a field selection given a single field name.

FieldSelection("field_name");

◆ FieldSelection() [3/9]

vtkm::filter::FieldSelection::FieldSelection ( const char *  field,
Mode  mode = Mode::Select 
)

Use this constructor to create a field selection given a single field name.

FieldSelection("field_name");

◆ FieldSelection() [4/9]

vtkm::filter::FieldSelection::FieldSelection ( const std::string &  field,
vtkm::cont::Field::Association  association,
Mode  mode = Mode::Select 
)

Use this constructor to create a field selection given a single name and association.

{cpp}

◆ FieldSelection() [5/9]

vtkm::filter::FieldSelection::FieldSelection ( std::initializer_list< std::string >  fields,
Mode  mode = Mode::Select 
)

Use this constructor to create a field selection given the field names.

FieldSelection({"field_one", "field_two"});

◆ FieldSelection() [6/9]

vtkm::filter::FieldSelection::FieldSelection ( std::initializer_list< std::pair< std::string, vtkm::cont::Field::Association >>  fields,
Mode  mode = Mode::Select 
)

Use this constructor create a field selection given the field names and associations e.g.

using pair_type = std::pair<std::string, vtkm::cont::Field::Association>;
pair_type{"field_one", vtkm::cont::Field::Association::Points},
pair_type{"field_two", vtkm::cont::Field::Association::Cells} });

◆ FieldSelection() [7/9]

vtkm::filter::FieldSelection::FieldSelection ( std::initializer_list< vtkm::Pair< std::string, vtkm::cont::Field::Association >>  fields,
Mode  mode = Mode::Select 
)

Use this constructor create a field selection given the field names and associations e.g.

◆ FieldSelection() [8/9]

vtkm::filter::FieldSelection::FieldSelection ( const FieldSelection src)

◆ FieldSelection() [9/9]

vtkm::filter::FieldSelection::FieldSelection ( FieldSelection &&  rhs)

◆ ~FieldSelection()

vtkm::filter::FieldSelection::~FieldSelection ( )

Member Function Documentation

◆ AddField() [1/5]

void vtkm::filter::FieldSelection::AddField ( const std::string &  fieldName,
Mode  mode 
)
inline

Add fields to select or exclude. If no mode is specified, then the mode will follow that of GetMode().

◆ AddField() [2/5]

void vtkm::filter::FieldSelection::AddField ( const std::string &  fieldName,
vtkm::cont::Field::Association  association,
Mode  mode 
)

Add fields to select or exclude. If no mode is specified, then the mode will follow that of GetMode().

◆ AddField() [3/5]

void vtkm::filter::FieldSelection::AddField ( const std::string &  fieldName,
vtkm::cont::Field::Association  association = vtkm::cont::Field::Association::Any 
)
inline

Add fields to select or exclude. If no mode is specified, then the mode will follow that of GetMode().

◆ AddField() [4/5]

void vtkm::filter::FieldSelection::AddField ( const vtkm::cont::Field inputField)
inline

Add fields to select or exclude. If no mode is specified, then the mode will follow that of GetMode().

◆ AddField() [5/5]

void vtkm::filter::FieldSelection::AddField ( const vtkm::cont::Field inputField,
Mode  mode 
)
inline

Add fields to select or exclude. If no mode is specified, then the mode will follow that of GetMode().

◆ ClearFields()

void vtkm::filter::FieldSelection::ClearFields ( )

Clear all fields added using AddField.

◆ GetFieldMode() [1/2]

Mode vtkm::filter::FieldSelection::GetFieldMode ( const std::string &  fieldName,
vtkm::cont::Field::Association  association = vtkm::cont::Field::Association::Any 
) const

Returns the mode for a particular field. If the field as been added with AddField (or another means), then this will return Select or Exclude. If the field has not been added, None will be returned.

◆ GetFieldMode() [2/2]

Mode vtkm::filter::FieldSelection::GetFieldMode ( const vtkm::cont::Field inputField) const
inline

Returns the mode for a particular field. If the field as been added with AddField (or another means), then this will return Select or Exclude. If the field has not been added, None will be returned.

◆ GetMode()

Mode vtkm::filter::FieldSelection::GetMode ( ) const

Gets the mode of the field selection.

If Select mode is on, then only fields that have a Select mode are considered as selected. (All others are considered unselected.) Calling AddField in this mode will mark it as Select. If Exclude mode is on, then all fields are considered selected except those fields with an Exclude mode. Calling AddField in this mode will mark it as Exclude.

◆ HasField() [1/2]

bool vtkm::filter::FieldSelection::HasField ( const std::string &  name,
vtkm::cont::Field::Association  association = vtkm::cont::Field::Association::Any 
) const
inline

◆ HasField() [2/2]

bool vtkm::filter::FieldSelection::HasField ( const vtkm::cont::Field inputField) const
inline

Returns true if the input field has been added to this selection.

Note that depending on the mode of this selection, the result of HasField is not necessarily the same as IsFieldSelected. (If the mode is MODE_SELECT, then the result of the two will be the same.)

◆ IsFieldSelected() [1/2]

bool vtkm::filter::FieldSelection::IsFieldSelected ( const std::string &  name,
vtkm::cont::Field::Association  association = vtkm::cont::Field::Association::Any 
) const

◆ IsFieldSelected() [2/2]

bool vtkm::filter::FieldSelection::IsFieldSelected ( const vtkm::cont::Field inputField) const
inline

Returns true if the input field should be mapped to the output dataset.

◆ operator=() [1/2]

FieldSelection& vtkm::filter::FieldSelection::operator= ( const FieldSelection src)

◆ operator=() [2/2]

FieldSelection& vtkm::filter::FieldSelection::operator= ( FieldSelection &&  rhs)

◆ SetMode()

void vtkm::filter::FieldSelection::SetMode ( Mode  val)

Sets the mode of the field selection.

If Select mode is on, then only fields that have a Select mode are considered as selected. (All others are considered unselected.) Calling AddField in this mode will mark it as Select. If Exclude mode is on, then all fields are considered selected except those fields with an Exclude mode. Calling AddField in this mode will mark it as Exclude.

If the mode is set to None, then the field modes are cleared and the overall mode is set to Select (meaning none of the fields are initially selected). If the mode is set to All, then the field modes are cleared and the overall mode is set to Exclude (meaning all of the fields are initially selected).

Member Data Documentation

◆ Internals

std::unique_ptr<InternalStruct> vtkm::filter::FieldSelection::Internals
private

The documentation for this class was generated from the following file:
vtkm::filter::FieldSelection::FieldSelection
FieldSelection(Mode mode=Mode::Select)
vtkm::cont::Field::Association::Points
@ Points
A field that applies to points.
vtkm::cont::Field::Association::Cells
@ Cells
A field that applies to cells.
vtkm::Pair
A vtkm::Pair is essentially the same as an STL pair object except that the methods (constructors and ...
Definition: Pair.h:29