adding execution output value type for node id set.

This commit is contained in:
Jeremy Meredith 2015-02-04 15:24:50 -05:00
parent da73c67f4a
commit 6214fa6629
3 changed files with 72 additions and 10 deletions

@ -28,18 +28,18 @@ class CellType : public vtkm::worklet::WorkletMapCell
{
public:
typedef void ControlSignature(FieldCellIn<IdType> inCells, TopologyIn topology, FieldCellOut<Scalar> outCells);
typedef _3 ExecutionSignature(_1);//, vtkm::worklet::WorkletMapCell::ThreeNodes); // FieldOut<Scalar> ExecutionSignature(FieldIn<Scalar>);
typedef _3 ExecutionSignature(_1, vtkm::exec::arg::NodeIdTriplet); // FieldOut<Scalar> ExecutionSignature(FieldIn<Scalar>);
typedef _1 InputDomain;
VTKM_CONT_EXPORT
CellType() { };
VTKM_EXEC_EXPORT
vtkm::Float32 operator()(const vtkm::Id &cell) const
vtkm::Float32 operator()(const vtkm::Id &cell, const vtkm::Id &nodeID) const
{
std::cout << "CellType worklet: " << std::endl;
std::cout << " -- input field value: " << cell << std::endl;
//std::cout << " -- input node IDs: "<<nodeId1<<","<<nodeId2<<","<<nodeId3<<","<<std::endl;
std::cout << " -- input node IDs (not really, it's just the work index for now): "<<nodeID<<","<<nodeID<<","<<nodeID<<","<<std::endl;
return (vtkm::Float32)cell;
}

@ -0,0 +1,67 @@
//============================================================================
// 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.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_exec_arg_NodeIdTriplet_h
#define vtk_m_exec_arg_NodeIdTriplet_h
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
namespace vtkm {
namespace exec {
namespace arg {
/// \brief Aspect tag to use for getting the work index.
///
/// The \c AspectTagNodeIdTriplet aspect tag causes the \c Fetch class to
/// obtain node IDs from a topology object.
///
struct AspectTagNodeIdTriplet { };
/// \brief The \c ExecutionSignature tag to use to get the node IDs.
///
struct NodeIdTriplet : vtkm::exec::arg::ExecutionSignatureTagBase
{
static const vtkm::IdComponent INDEX = 1;
typedef vtkm::exec::arg::AspectTagNodeIdTriplet AspectTag;
};
template<typename FetchTag, typename Invocation>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagNodeIdTriplet, Invocation, 1>
{
typedef vtkm::Id ValueType;
VTKM_EXEC_EXPORT
vtkm::Id Load(vtkm::Id index, const Invocation &) const
{
return index;
}
VTKM_EXEC_EXPORT
void Store(vtkm::Id, const Invocation &, const ValueType &) const
{
// Store is a no-op.
}
};
}
}
} // namespace vtkm::exec::arg
#endif //vtk_m_exec_arg_NodeIdTriplet_h

@ -31,6 +31,8 @@
#include <vtkm/cont/arg/TypeCheckTagArray.h>
#include <vtkm/cont/arg/TypeCheckTagTopology.h>
#include <vtkm/exec/arg/NodeIdTriplet.h>
#include <vtkm/exec/arg/FetchTagArrayDirectIn.h>
#include <vtkm/exec/arg/FetchTagArrayDirectOut.h>
#include <vtkm/exec/arg/FetchTagTopologyIn.h>
@ -38,8 +40,6 @@
namespace vtkm {
namespace worklet {
struct AspectTagThreeNodes { };
/// Base class for worklets that do a simple mapping of field arrays. All
/// inputs and outputs are on the same domain. That is, all the arrays are the
/// same size.
@ -82,11 +82,6 @@ public:
typedef vtkm::cont::arg::TransportTagArrayOut TransportTag;
typedef vtkm::exec::arg::FetchTagArrayDirectOut FetchTag;
};
struct ThreeNodes : vtkm::exec::arg::ExecutionSignatureTagBase {
static const vtkm::IdComponent INDEX = 1;
typedef vtkm::worklet::AspectTagThreeNodes AspectTag;
};
};
}