mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
07c59fcf72
Rather than do a CastAndCall on all possible field types when calling a worklet with two fields (where they all typically get cast to the same type as the primary field), use the new mechanism with ArrayHandleMultiplexer to create one code path. Also update the ApplyPolicy to accept the Field type, which is used to determine any additional storage types to support.
51 lines
1.3 KiB
C++
51 lines
1.3 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_filter_FilterTraits_h
|
|
#define vtk_m_filter_FilterTraits_h
|
|
|
|
#include <vtkm/TypeListTag.h>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace filter
|
|
{
|
|
|
|
template <typename Derived>
|
|
class Filter;
|
|
|
|
namespace detail
|
|
{
|
|
// template<typename T> vtkm::ListTagBase<T> as_list(T);
|
|
vtkm::ListTagUniversal as_list(vtkm::ListTagUniversal);
|
|
template <typename... T>
|
|
vtkm::ListTagBase<T...> as_list(vtkm::ListTagBase<T...>);
|
|
}
|
|
|
|
|
|
template <typename Filter>
|
|
struct FilterTraits
|
|
{
|
|
using InputFieldTypeList =
|
|
decltype(detail::as_list(std::declval<typename Filter::SupportedTypes>()));
|
|
using AdditionalFieldStorage = typename Filter::AdditionalFieldStorage;
|
|
};
|
|
|
|
template <typename DerivedPolicy, typename ListOfTypes>
|
|
struct DeduceFilterFieldTypes
|
|
{
|
|
using PList = typename DerivedPolicy::FieldTypeList;
|
|
using TypeList = vtkm::ListTagIntersect<ListOfTypes, PList>;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif //vtk_m_filter_FilterTraits_h
|