mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
making all map cell related parameters use max cell size in control signature topology template arg.
This commit is contained in:
parent
5a40bb2657
commit
f4975e7629
@ -25,7 +25,8 @@
|
||||
namespace vtkm {
|
||||
|
||||
/// Extent stores the values for the index ranges for a structured grid array.
|
||||
/// It does this through the minimum indices and the maximum indices.
|
||||
/// It does this through the minimum indices and the maximum indices for the
|
||||
/// points in the grid.
|
||||
///
|
||||
template<vtkm::IdComponent Dimensions>
|
||||
struct Extent
|
||||
|
@ -28,13 +28,12 @@
|
||||
#include <vtkm/exec/arg/TopologyElementType.h>
|
||||
|
||||
static const int LEN_IDS = 6;
|
||||
static const int LEN_NVALS = 7;
|
||||
|
||||
class CellType : public vtkm::worklet::WorkletMapCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldCellIn<Scalar> inCells, FieldNodeIn<LEN_NVALS> inNodes, TopologyIn topology, FieldCellOut<Scalar> outCells);
|
||||
typedef _4 ExecutionSignature(_1, _2, vtkm::exec::arg::TopologyIdCount, vtkm::exec::arg::TopologyElementType, vtkm::exec::arg::TopologyIdSet<LEN_IDS>);
|
||||
typedef void ControlSignature(FieldCellIn<Scalar> inCells, FieldNodeIn<Scalar> inNodes, TopologyIn<LEN_IDS> topology, FieldCellOut<Scalar> outCells);
|
||||
typedef _4 ExecutionSignature(_1, _2, vtkm::exec::arg::TopologyIdCount, vtkm::exec::arg::TopologyElementType, vtkm::exec::arg::TopologyIdSet);
|
||||
typedef _3 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -42,20 +41,20 @@ public:
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::Float32 operator()(const vtkm::Float32 &cellval,
|
||||
const vtkm::Vec<vtkm::Float32,LEN_NVALS> &nodevals,
|
||||
const vtkm::Vec<vtkm::Float32,LEN_IDS> &nodevals,
|
||||
const vtkm::Id &count,
|
||||
const vtkm::Id &type,
|
||||
const vtkm::Vec<vtkm::Id,LEN_IDS> &nodeIDs) const
|
||||
{
|
||||
std::cout << "CellType worklet: " << std::endl;
|
||||
std::cout << " -- input cell field value: " << cellval << std::endl;
|
||||
if (count > LEN_NVALS)
|
||||
if (count > LEN_IDS)
|
||||
std::cout << " ++ WARNING: DIDN'T USE A VALUE SET SIZE SUFFICIENTLY LARGE" << std::endl;
|
||||
std::cout << " -- input node field values: ";
|
||||
for (int i=0; i<count; ++i)
|
||||
{
|
||||
std::cout << (i>0?", ":"");
|
||||
if (i < LEN_NVALS)
|
||||
if (i < LEN_IDS)
|
||||
std::cout << nodevals[i];
|
||||
else
|
||||
std::cout << "?";
|
||||
|
@ -33,29 +33,31 @@ namespace arg {
|
||||
/// retreive values from an array portal. The fetch uses indexing based on
|
||||
/// the topology structure used for the input domain.
|
||||
///
|
||||
template <vtkm::IdComponent ItemTupleLength>
|
||||
struct FetchTagArrayTopologyMapIn { };
|
||||
|
||||
template<typename Invocation,
|
||||
vtkm::IdComponent ParameterIndex,
|
||||
vtkm::IdComponent ItemTupleLength>
|
||||
template<typename Invocation, vtkm::IdComponent ParameterIndex>
|
||||
struct Fetch<
|
||||
vtkm::exec::arg::FetchTagArrayTopologyMapIn<ItemTupleLength>,
|
||||
vtkm::exec::arg::FetchTagArrayTopologyMapIn,
|
||||
vtkm::exec::arg::AspectTagDefault,
|
||||
Invocation,
|
||||
ParameterIndex>
|
||||
{
|
||||
static const vtkm::IdComponent InputDomainIndex =
|
||||
Invocation::InputDomainIndex;
|
||||
typedef typename Invocation::ControlInterface::template
|
||||
ParameterType<InputDomainIndex>::type ControlSignatureTag;
|
||||
static const vtkm::IdComponent ITEM_TUPLE_LENGTH =
|
||||
ControlSignatureTag::ITEM_TUPLE_LENGTH;
|
||||
|
||||
typedef typename Invocation::ParameterInterface::
|
||||
template ParameterType<ParameterIndex>::type ExecObjectType;
|
||||
|
||||
typedef vtkm::Vec<typename
|
||||
ExecObjectType::ValueType,ItemTupleLength> ValueType;
|
||||
typedef vtkm::Vec<typename ExecObjectType::ValueType,
|
||||
ITEM_TUPLE_LENGTH> ValueType;
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
ValueType Load(vtkm::Id index, const Invocation &invocation) const
|
||||
{
|
||||
static const vtkm::IdComponent InputDomainIndex =
|
||||
Invocation::InputDomainIndex;
|
||||
typedef typename Invocation::ParameterInterface ParameterInterface;
|
||||
typedef typename ParameterInterface::
|
||||
template ParameterType<InputDomainIndex>::type TopologyType;
|
||||
@ -65,11 +67,11 @@ struct Fetch<
|
||||
|
||||
int nids = topology.GetNumberOfIndices(index);
|
||||
|
||||
vtkm::Vec<vtkm::Id,ItemTupleLength> ids;
|
||||
vtkm::Vec<vtkm::Id,ITEM_TUPLE_LENGTH> ids;
|
||||
topology.GetIndices(index,ids);
|
||||
|
||||
ValueType v;
|
||||
for (int i=0; i<nids && i<ItemTupleLength; ++i)
|
||||
for (int i=0; i<nids && i<ITEM_TUPLE_LENGTH; ++i)
|
||||
{
|
||||
v[i] = invocation.Parameters.template GetParameter<ParameterIndex>().
|
||||
Get(ids[i]);
|
||||
|
@ -32,27 +32,29 @@ namespace arg {
|
||||
/// The \c AspectTagTopologyIdSet aspect tag causes the \c Fetch class to
|
||||
/// obtain node IDs for a cell from a topology object.
|
||||
///
|
||||
template <vtkm::IdComponent ItemTupleLength>
|
||||
struct AspectTagTopologyIdSet { };
|
||||
|
||||
/// \brief The \c ExecutionSignature tag to use to get the node IDs.
|
||||
///
|
||||
template <vtkm::IdComponent ItemTupleLength>
|
||||
struct TopologyIdSet : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
typedef vtkm::exec::arg::AspectTagTopologyIdSet<ItemTupleLength> AspectTag;
|
||||
typedef vtkm::exec::arg::AspectTagTopologyIdSet AspectTag;
|
||||
};
|
||||
|
||||
template<typename FetchTag,
|
||||
typename Invocation,
|
||||
vtkm::IdComponent ItemTupleLength>
|
||||
template<typename FetchTag, typename Invocation>
|
||||
struct Fetch<FetchTag,
|
||||
vtkm::exec::arg::AspectTagTopologyIdSet<ItemTupleLength>,
|
||||
vtkm::exec::arg::AspectTagTopologyIdSet,
|
||||
Invocation,
|
||||
1>
|
||||
{
|
||||
typedef vtkm::Vec<vtkm::Id,ItemTupleLength> ValueType;
|
||||
static const vtkm::IdComponent InputDomainIndex =
|
||||
Invocation::InputDomainIndex;
|
||||
typedef typename Invocation::ControlInterface::template
|
||||
ParameterType<InputDomainIndex>::type ControlSignatureTag;
|
||||
static const vtkm::IdComponent ITEM_TUPLE_LENGTH =
|
||||
ControlSignatureTag::ITEM_TUPLE_LENGTH;
|
||||
typedef vtkm::Vec<vtkm::Id,ITEM_TUPLE_LENGTH> ValueType;
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
ValueType Load(vtkm::Id index, const Invocation &invocation) const
|
||||
|
@ -63,12 +63,11 @@ public:
|
||||
/// This tag takes a template argument that is a type list tag that limits
|
||||
/// the possible value types in the array.
|
||||
///
|
||||
template< vtkm::IdComponent ItemTupleLength, typename TypeList = AllTypes>
|
||||
template<typename TypeList = AllTypes>
|
||||
struct FieldNodeIn : vtkm::cont::arg::ControlSignatureTagBase {
|
||||
typedef vtkm::cont::arg::TypeCheckTagArray<TypeList> TypeCheckTag;
|
||||
typedef vtkm::cont::arg::TransportTagArrayIn TransportTag;
|
||||
typedef vtkm::exec::arg::FetchTagArrayTopologyMapIn<ItemTupleLength>
|
||||
FetchTag;
|
||||
typedef vtkm::exec::arg::FetchTagArrayTopologyMapIn FetchTag;
|
||||
};
|
||||
|
||||
/// \brief A control signature tag for input connectivity.
|
||||
@ -76,10 +75,12 @@ public:
|
||||
/// This tag takes a template argument that is a type list tag that limits
|
||||
/// the possible value types in the array.
|
||||
///
|
||||
template< vtkm::IdComponent ItemTupleLength>
|
||||
struct TopologyIn : vtkm::cont::arg::ControlSignatureTagBase {
|
||||
typedef vtkm::cont::arg::TypeCheckTagTopology TypeCheckTag;
|
||||
typedef vtkm::cont::arg::TransportTagTopologyIn TransportTag;
|
||||
typedef vtkm::exec::arg::FetchTagTopologyIn FetchTag;
|
||||
static const int ITEM_TUPLE_LENGTH = ItemTupleLength;
|
||||
};
|
||||
|
||||
/// \brief A control signature tag for output fields.
|
||||
|
Loading…
Reference in New Issue
Block a user