VTK-m  2.1
Public Types | Public Member Functions | Public Attributes | List of all members
vtkm::exec::FieldNeighborhood< FieldPortalType > Struct Template Reference

Retrieves field values from a neighborhood. More...

#include <FieldNeighborhood.h>

Public Types

using ValueType = typename FieldPortalType::ValueType
 

Public Member Functions

 FieldNeighborhood (const FieldPortalType &portal, const vtkm::exec::BoundaryState &boundary)
 
ValueType Get (vtkm::IdComponent i, vtkm::IdComponent j, vtkm::IdComponent k) const
 Retrieve a field value relative to the visited element. More...
 
ValueType GetUnchecked (vtkm::IdComponent i, vtkm::IdComponent j, vtkm::IdComponent k) const
 Retrieve a field value relative to the visited element without bounds checking. More...
 
ValueType Get (const vtkm::Id3 &ijk) const
 Retrieve a field value relative to the visited element. More...
 
ValueType GetUnchecked (const vtkm::Id3 &ijk) const
 Retrieve a field value relative to the visited element without bounds checking. More...
 

Public Attributes

vtkm::exec::BoundaryState const *const Boundary
 The vtkm::exec::BoundaryState used to find field values from local indices. More...
 
FieldPortalType Portal
 The array portal containing field values. More...
 

Detailed Description

template<typename FieldPortalType>
struct vtkm::exec::FieldNeighborhood< FieldPortalType >

Retrieves field values from a neighborhood.

FieldNeighborhood manages the retrieval of field values within the neighborhood of a vtkm::worklet::WorkletPointNeighborhood worklet. The Get methods take ijk indices relative to the neighborhood (with 0, 0, 0 being the element visted) and return the field value at that part of the neighborhood. If the requested neighborhood is outside the boundary, the value at the nearest boundary will be returned. A vtkm::exec::BoundaryState object can be used to determine if the neighborhood extends beyond the boundary of the mesh.

This class is typically constructed using the FieldInNeighborhood tag in an ExecutionSignature. There is little reason to construct this in user code.

Member Typedef Documentation

◆ ValueType

template<typename FieldPortalType >
using vtkm::exec::FieldNeighborhood< FieldPortalType >::ValueType = typename FieldPortalType::ValueType

Constructor & Destructor Documentation

◆ FieldNeighborhood()

template<typename FieldPortalType >
vtkm::exec::FieldNeighborhood< FieldPortalType >::FieldNeighborhood ( const FieldPortalType &  portal,
const vtkm::exec::BoundaryState boundary 
)
inline

Member Function Documentation

◆ Get() [1/2]

template<typename FieldPortalType >
ValueType vtkm::exec::FieldNeighborhood< FieldPortalType >::Get ( const vtkm::Id3 ijk) const
inline

Retrieve a field value relative to the visited element.

The index is given as three dimensional i, j, k indices. These indices are relative to the currently visited element. So, calling Get(0, 0, 0) retrieves the field value at the visited element. Calling Get(-1, 0, 0) retrieves the value to the "left" and Get(1, 0, 0) retrieves the value to the "right."

If the relative index points outside the bounds of the mesh, Get will return the value closest to the boundary (i.e. clamping behvior). For example, if the visited element is at the leftmost index of the mesh, Get(-1, 0, 0) will refer to a value outside the bounds of the mesh. In this case, Get will return the value at the visited index, which is the closest element at that boundary.

When referring to values in a mesh of less than 3 dimensions (such as a 2D structured), simply use 0 for the unused dimensions.

◆ Get() [2/2]

template<typename FieldPortalType >
ValueType vtkm::exec::FieldNeighborhood< FieldPortalType >::Get ( vtkm::IdComponent  i,
vtkm::IdComponent  j,
vtkm::IdComponent  k 
) const
inline

Retrieve a field value relative to the visited element.

The index is given as three dimensional i, j, k indices. These indices are relative to the currently visited element. So, calling Get(0, 0, 0) retrieves the field value at the visited element. Calling Get(-1, 0, 0) retrieves the value to the "left" and Get(1, 0, 0) retrieves the value to the "right."

If the relative index points outside the bounds of the mesh, Get will return the value closest to the boundary (i.e. clamping behvior). For example, if the visited element is at the leftmost index of the mesh, Get(-1, 0, 0) will refer to a value outside the bounds of the mesh. In this case, Get will return the value at the visited index, which is the closest element at that boundary.

When referring to values in a mesh of less than 3 dimensions (such as a 2D structured), simply use 0 for the unused dimensions.

◆ GetUnchecked() [1/2]

template<typename FieldPortalType >
ValueType vtkm::exec::FieldNeighborhood< FieldPortalType >::GetUnchecked ( const vtkm::Id3 ijk) const
inline

Retrieve a field value relative to the visited element without bounds checking.

GetUnchecked behaves the same as Get except that no bounds checking is done before retrieving the field value. If the relative index is out of bounds of the mesh, the results are undefined.

GetUnchecked is useful in circumstances where the bounds have already be checked. This prevents wasting time repeating checks.

◆ GetUnchecked() [2/2]

template<typename FieldPortalType >
ValueType vtkm::exec::FieldNeighborhood< FieldPortalType >::GetUnchecked ( vtkm::IdComponent  i,
vtkm::IdComponent  j,
vtkm::IdComponent  k 
) const
inline

Retrieve a field value relative to the visited element without bounds checking.

GetUnchecked behaves the same as Get except that no bounds checking is done before retrieving the field value. If the relative index is out of bounds of the mesh, the results are undefined.

GetUnchecked is useful in circumstances where the bounds have already be checked. This prevents wasting time repeating checks.

Member Data Documentation

◆ Boundary

template<typename FieldPortalType >
vtkm::exec::BoundaryState const* const vtkm::exec::FieldNeighborhood< FieldPortalType >::Boundary

The vtkm::exec::BoundaryState used to find field values from local indices.

◆ Portal

template<typename FieldPortalType >
FieldPortalType vtkm::exec::FieldNeighborhood< FieldPortalType >::Portal

The array portal containing field values.


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