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 ```
69 lines
2.6 KiB
C++
69 lines
2.6 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_Dispatcher_MapTopology_h
|
|
#define vtk_m_worklet_Dispatcher_MapTopology_h
|
|
|
|
#include <vtkm/TopologyElementTag.h>
|
|
#include <vtkm/cont/DeviceAdapter.h>
|
|
#include <vtkm/worklet/WorkletMapTopology.h>
|
|
#include <vtkm/worklet/internal/DispatcherBase.h>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace worklet
|
|
{
|
|
|
|
/// \brief Dispatcher for worklets that inherit from \c WorkletMapTopology.
|
|
///
|
|
template <typename WorkletType>
|
|
class DispatcherMapTopology
|
|
: public vtkm::worklet::internal::DispatcherBase<DispatcherMapTopology<WorkletType>,
|
|
WorkletType,
|
|
vtkm::worklet::detail::WorkletMapTopologyBase>
|
|
{
|
|
using Superclass =
|
|
vtkm::worklet::internal::DispatcherBase<DispatcherMapTopology<WorkletType>,
|
|
WorkletType,
|
|
vtkm::worklet::detail::WorkletMapTopologyBase>;
|
|
using ScatterType = typename Superclass::ScatterType;
|
|
|
|
public:
|
|
template <typename... T>
|
|
VTKM_CONT DispatcherMapTopology(T&&... args)
|
|
: Superclass(std::forward<T>(args)...)
|
|
{
|
|
}
|
|
|
|
template <typename Invocation>
|
|
VTKM_CONT void DoInvoke(Invocation& invocation) const
|
|
{
|
|
// This is the type for the input domain
|
|
using InputDomainType = typename Invocation::InputDomainType;
|
|
using SchedulingRangeType = typename WorkletType::VisitTopologyType;
|
|
|
|
// If you get a compile error on this line, then you have tried to use
|
|
// something that is not a vtkm::cont::CellSet as the input domain to a
|
|
// topology operation (that operates on a cell set connection domain).
|
|
VTKM_IS_CELL_SET(InputDomainType);
|
|
|
|
// We can pull the input domain parameter (the data specifying the input
|
|
// domain) from the invocation object.
|
|
const auto& inputDomain = invocation.GetInputDomain();
|
|
|
|
// Now that we have the input domain, we can extract the range of the
|
|
// scheduling and call BadicInvoke.
|
|
this->BasicInvoke(invocation, internal::scheduling_range(inputDomain, SchedulingRangeType{}));
|
|
}
|
|
};
|
|
}
|
|
} // namespace vtkm::worklet
|
|
|
|
#endif //vtk_m_worklet_Dispatcher_MapTopology_h
|