5db762ee71
The `From` and `To` nomenclature for topology mapping has been confusing for both users and developers, especially at lower levels where the intention of mapping attributes from one element to another is easily conflated with the concept of mapping indices (which maps in the exact opposite direction). These identifiers have been renamed to `VisitTopology` and `IncidentTopology` to clarify the direction of the mapping. The order in which these template parameters are specified for `WorkletMapTopology` have also been reversed, since eventually there may be more than one `IncidentTopology`, and having `IncidentTopology` at the end will allow us to replace it with a variadic template parameter pack in the future. Other implementation details supporting these worklets, include `Fetch` tags, `Connectivity` classes, and methods on the various `CellSet` classes (such as `PrepareForInput` have also reversed their template arguments. These will need to be cautiously updated. The convenience implementations of `WorkletMapTopology` have been renamed for clarity as follows: ``` WorkletMapPointToCell --> WorkletVisitCellsWithPoints WorkletMapCellToPoint --> WorkletVisitPointsWithCells ``` The `ControlSignature` tags have been renamed as follows: ``` FieldInTo --> FieldInVisit FieldInFrom --> FieldInMap FromCount --> IncidentElementCount FromIndices --> IncidentElementIndices ```
63 lines
1.9 KiB
C++
63 lines
1.9 KiB
C++
//============================================================================
|
|
// Copyright (c) Kitware, Inc.
|
|
// All rights reserved.
|
|
// See LICENSE.txt for details.
|
|
//
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_worklet_gradient_CellGradient_h
|
|
#define vtk_m_worklet_gradient_CellGradient_h
|
|
|
|
#include <vtkm/exec/CellDerivative.h>
|
|
#include <vtkm/exec/ParametricCoordinates.h>
|
|
#include <vtkm/worklet/WorkletMapTopology.h>
|
|
|
|
#include <vtkm/worklet/gradient/GradientOutput.h>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace worklet
|
|
{
|
|
namespace gradient
|
|
{
|
|
|
|
template <typename T>
|
|
struct CellGradientInType : vtkm::ListTagBase<T>
|
|
{
|
|
};
|
|
|
|
template <typename T>
|
|
struct CellGradient : vtkm::worklet::WorkletVisitCellsWithPoints
|
|
{
|
|
using ControlSignature = void(CellSetIn,
|
|
FieldInPoint pointCoordinates,
|
|
FieldInPoint inputField,
|
|
GradientOutputs outputFields);
|
|
|
|
using ExecutionSignature = void(CellShape, PointCount, _2, _3, _4);
|
|
using InputDomain = _1;
|
|
|
|
template <typename CellTagType,
|
|
typename PointCoordVecType,
|
|
typename FieldInVecType,
|
|
typename GradientOutType>
|
|
VTKM_EXEC void operator()(CellTagType shape,
|
|
vtkm::IdComponent pointCount,
|
|
const PointCoordVecType& wCoords,
|
|
const FieldInVecType& field,
|
|
GradientOutType& outputGradient) const
|
|
{
|
|
vtkm::Vec3f center = vtkm::exec::ParametricCoordinatesCenter(pointCount, shape, *this);
|
|
|
|
outputGradient = vtkm::exec::CellDerivative(field, wCoords, center, shape, *this);
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|