mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Implement GetIndices.
This commit is contained in:
parent
2d35ab05ac
commit
4cb661006e
@ -182,6 +182,34 @@ void CellSetExtrude::GetCellPointIds(vtkm::Id id, vtkm::Id* ptids) const
|
||||
}
|
||||
}
|
||||
|
||||
template <vtkm::IdComponent NumIndices = 6>
|
||||
VTKM_CONT void CellSetExtrude::GetIndices(vtkm::Id index,
|
||||
vtkm::Vec<vtkm::Id, NumIndices>& ids) const
|
||||
{
|
||||
static_assert(NumIndices == 6, "There are always 6 points in a wedge.");
|
||||
this->GetCellPointIds(index, ids.data());
|
||||
}
|
||||
|
||||
VTKM_CONT void CellSetExtrude::GetIndices(vtkm::Id index,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& ids) const
|
||||
{
|
||||
if (ids.GetNumberOfValues() < 6)
|
||||
{
|
||||
ids.Allocate(6);
|
||||
}
|
||||
auto outIdPortal = ids.WritePortal();
|
||||
vtkm::cont::Token token;
|
||||
auto conn = this->PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{},
|
||||
vtkm::TopologyElementTagCell{},
|
||||
vtkm::TopologyElementTagPoint{},
|
||||
token);
|
||||
auto indices = conn.GetIndices(index);
|
||||
for (vtkm::IdComponent i = 0; i < 6; i++)
|
||||
{
|
||||
outIdPortal.Set(i, indices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<CellSet> CellSetExtrude::NewInstance() const
|
||||
{
|
||||
return std::make_shared<CellSetExtrude>();
|
||||
|
@ -100,6 +100,11 @@ public:
|
||||
|
||||
bool GetIsPeriodic() const { return this->IsPeriodic; }
|
||||
|
||||
template <vtkm::IdComponent NumIndices>
|
||||
VTKM_CONT void GetIndices(vtkm::Id index, vtkm::Vec<vtkm::Id, NumIndices>& ids) const;
|
||||
|
||||
VTKM_CONT void GetIndices(vtkm::Id index, vtkm::cont::ArrayHandle<vtkm::Id>& ids) const;
|
||||
|
||||
template <typename VisitTopology, typename IncidentTopology>
|
||||
using ExecConnectivityType =
|
||||
typename detail::CellSetExtrudeConnectivityChooser<VisitTopology,
|
||||
|
@ -398,7 +398,7 @@ void Write(std::ostream& out, const vtkm::cont::DataSet& dataSet)
|
||||
}
|
||||
else if (cellSet.IsType<vtkm::cont::CellSetExtrude>())
|
||||
{
|
||||
WriteDataSetAsUnstructured(out, dataSet, cellSet.Cast<vtkm::cont::CellSetExplicit<>>());
|
||||
WriteDataSetAsUnstructured(out, dataSet, cellSet.Cast<vtkm::cont::CellSetExtrude>());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user