mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
Merge branch 'cell-to-point-map' into 'master'
Add WorkletMapCellToPoint class The map topology worklets are to have convenience classes for all the common mappings. However WorkletMapCellToPoint was left out as an oversight. This adds the class. See merge request !324
This commit is contained in:
commit
33cc8a2b19
@ -194,6 +194,43 @@ public:
|
||||
struct PointIndices : FromIndices { };
|
||||
};
|
||||
|
||||
/// Base class for worklets that map from Cells to Points.
|
||||
///
|
||||
class WorkletMapCellToPoint: public WorkletMapTopologyBase
|
||||
{
|
||||
public:
|
||||
typedef vtkm::TopologyElementTagCell FromTopologyType;
|
||||
typedef vtkm::TopologyElementTagPoint ToTopologyType;
|
||||
|
||||
/// \brief A control signature tag for input connectivity.
|
||||
///
|
||||
struct TopologyIn : vtkm::cont::arg::ControlSignatureTagBase {
|
||||
typedef vtkm::cont::arg::TypeCheckTagTopology TypeCheckTag;
|
||||
typedef vtkm::cont::arg::TransportTagTopologyIn<FromTopologyType,ToTopologyType> TransportTag;
|
||||
typedef vtkm::exec::arg::FetchTagTopologyIn FetchTag;
|
||||
};
|
||||
|
||||
//While we would love to use templates, that feature is not possible
|
||||
//until c++11 ( alias templates), so we have to replicate that feature
|
||||
//by using inheritance.
|
||||
|
||||
template<typename TypeList = AllTypes >
|
||||
struct FieldInCell : FieldInFrom<TypeList> { };
|
||||
|
||||
template<typename TypeList = AllTypes >
|
||||
struct FieldInPoint : FieldInTo<TypeList> { };
|
||||
|
||||
template<typename TypeList = AllTypes >
|
||||
struct FieldOutPoint : FieldOut<TypeList> { };
|
||||
|
||||
template<typename TypeList = AllTypes >
|
||||
struct FieldInOutPoint : FieldInOut<TypeList> { };
|
||||
|
||||
struct CellCount : FromCount { };
|
||||
|
||||
struct CellIndices : FromIndices { };
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::worklet
|
||||
|
||||
|
@ -30,15 +30,14 @@
|
||||
|
||||
namespace test_explicit {
|
||||
|
||||
class MaxPointOrCellValue :
|
||||
public vtkm::worklet::WorkletMapPointToCell
|
||||
class MaxPointOrCellValue : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldInCell<Scalar> inCells,
|
||||
FieldInPoint<Scalar> inPoints,
|
||||
TopologyIn topology,
|
||||
FieldOutCell<Scalar> outCells);
|
||||
typedef void ExecutionSignature(_1, _4, _2, FromCount, CellShape, FromIndices);
|
||||
typedef void ExecutionSignature(_1, _4, _2, PointCount, CellShape, PointIndices);
|
||||
typedef _3 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -48,14 +47,14 @@ public:
|
||||
typename OutCellType,
|
||||
typename InPointVecType,
|
||||
typename CellShapeTag,
|
||||
typename FromIndexType>
|
||||
typename PointIndexType>
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(const InCellType &cellValue,
|
||||
OutCellType &maxValue,
|
||||
const InPointVecType &pointValues,
|
||||
const vtkm::IdComponent &numPoints,
|
||||
const CellShapeTag &vtkmNotUsed(type),
|
||||
const FromIndexType &vtkmNotUsed(pointIDs)) const
|
||||
const PointIndexType &vtkmNotUsed(pointIDs)) const
|
||||
{
|
||||
//simple functor that returns the max of cellValue and pointValue
|
||||
maxValue = static_cast<OutCellType>(cellValue);
|
||||
@ -67,14 +66,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AveragePointToCellValue :
|
||||
public vtkm::worklet::WorkletMapPointToCell
|
||||
class AveragePointToCellValue : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldInPoint<Scalar> inPoints,
|
||||
TopologyIn topology,
|
||||
FieldOutCell<Scalar> outCells);
|
||||
typedef void ExecutionSignature(_1, _3, FromCount);
|
||||
typedef void ExecutionSignature(_1, _3, PointCount);
|
||||
typedef _2 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -96,15 +94,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AverageCellToPointValue :
|
||||
public vtkm::worklet::WorkletMapTopology<vtkm::TopologyElementTagCell,
|
||||
vtkm::TopologyElementTagPoint>
|
||||
class AverageCellToPointValue : public vtkm::worklet::WorkletMapCellToPoint
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldInFrom<Scalar> inCells,
|
||||
typedef void ControlSignature(FieldInCell<Scalar> inCells,
|
||||
TopologyIn topology,
|
||||
FieldOut<Scalar> outPoints);
|
||||
typedef void ExecutionSignature(_1, _3, FromCount);
|
||||
typedef void ExecutionSignature(_1, _3, CellCount);
|
||||
typedef _2 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
|
@ -30,15 +30,14 @@
|
||||
|
||||
namespace test_uniform {
|
||||
|
||||
class MaxPointOrCellValue :
|
||||
public vtkm::worklet::WorkletMapPointToCell
|
||||
class MaxPointOrCellValue : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldInCell<Scalar> inCells,
|
||||
FieldInPoint<Scalar> inPoints,
|
||||
TopologyIn topology,
|
||||
FieldOutCell<Scalar> outCells);
|
||||
typedef void ExecutionSignature(_1, _4, _2, FromCount, CellShape, FromIndices);
|
||||
typedef void ExecutionSignature(_1, _4, _2, PointCount, CellShape, PointIndices);
|
||||
typedef _3 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -48,14 +47,14 @@ public:
|
||||
typename OutCellType,
|
||||
typename InPointVecType,
|
||||
typename CellShapeTag,
|
||||
typename FromIndexType>
|
||||
typename PointIndexType>
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(const InCellType &cellValue,
|
||||
OutCellType &maxValue,
|
||||
const InPointVecType &pointValues,
|
||||
const vtkm::IdComponent &numPoints,
|
||||
const CellShapeTag &vtkmNotUsed(type),
|
||||
const FromIndexType &vtkmNotUsed(pointIDs)) const
|
||||
const PointIndexType &vtkmNotUsed(pointIDs)) const
|
||||
{
|
||||
//simple functor that returns the max of cellValue and pointValue
|
||||
maxValue = static_cast<OutCellType>(cellValue);
|
||||
@ -67,14 +66,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AveragePointToCellValue :
|
||||
public vtkm::worklet::WorkletMapPointToCell
|
||||
class AveragePointToCellValue : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldInPoint<Scalar> inPoints,
|
||||
TopologyIn topology,
|
||||
FieldOutCell<Scalar> outCells);
|
||||
typedef void ExecutionSignature(_1, _3, FromCount);
|
||||
typedef void ExecutionSignature(_1, _3, PointCount);
|
||||
typedef _2 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -96,15 +94,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AverageCellToPointValue :
|
||||
public vtkm::worklet::WorkletMapTopology<vtkm::TopologyElementTagCell,
|
||||
vtkm::TopologyElementTagPoint>
|
||||
class AverageCellToPointValue : public vtkm::worklet::WorkletMapCellToPoint
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldInFrom<Scalar> inCells,
|
||||
typedef void ControlSignature(FieldInCell<Scalar> inCells,
|
||||
TopologyIn topology,
|
||||
FieldOut<Scalar> outPoints);
|
||||
typedef void ExecutionSignature(_1, _3, FromCount);
|
||||
typedef void ExecutionSignature(_1, _3, CellCount);
|
||||
typedef _2 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -130,7 +126,7 @@ struct CheckStructuredUniformPointCoords
|
||||
: public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
typedef void ControlSignature(TopologyIn topology,
|
||||
FieldInFrom<Vec3> pointCoords);
|
||||
FieldInPoint<Vec3> pointCoords);
|
||||
typedef void ExecutionSignature(_2);
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
|
Loading…
Reference in New Issue
Block a user