Go to the documentation of this file.
18 #ifndef viskores_exec_CellLocatorBoundingIntervalHierarchy_h
19 #define viskores_exec_CellLocatorBoundingIntervalHierarchy_h
38 #if defined(VISKORES_CLANG)
39 #pragma GCC diagnostic push
40 #pragma GCC diagnostic ignored "-Wnested-anon-types"
41 #endif // gcc || clang
58 #if defined(VISKORES_CLANG)
59 #pragma GCC diagnostic pop
60 #endif // gcc || clang
81 template <
typename CellSetType>
93 const CellSetType& cellSet,
97 : Nodes(nodes.PrepareForInput(device, token))
98 , CellIds(cellIds.PrepareForInput(device, token))
100 , Coords(coords.PrepareForInput(device, token))
117 return this->FindCellImpl(point, cellId, parametric, lastCell);
129 if ((lastCell.
CellId >= 0) && (lastCell.
CellId < this->CellSet.GetNumberOfElements()))
139 if ((lastCell.
NodeIdx >= 0) && (lastCell.
NodeIdx < this->Nodes.GetNumberOfValues()))
141 const auto& node = this->Nodes.Get(lastCell.
NodeIdx);
143 if (node.ChildIndex < 0)
155 return this->FindCellImpl(point, cellId, parametric, lastCell);
168 while ((cellId < 0) && !((nodeIndex == 0) && (state == FindCellState::AscendFromNode)))
172 case FindCellState::EnterNode:
174 this->EnterNode(state, point, cellId, nodeIndex, parametric, lastCell));
176 case FindCellState::AscendFromNode:
177 this->AscendFromNode(state, nodeIndex);
179 case FindCellState::DescendLeftChild:
180 this->DescendLeftChild(state, point, nodeIndex);
182 case FindCellState::DescendRightChild:
183 this->DescendRightChild(state, point, nodeIndex);
218 this->Nodes.Get(nodeIndex);
224 state = FindCellState::AscendFromNode;
233 state = FindCellState::DescendLeftChild;
245 this->Nodes.Get(childNodeIndex);
248 this->Nodes.Get(nodeIndex);
253 state = FindCellState::DescendRightChild;
270 this->Nodes.Get(nodeIndex);
272 if (coordinate <= node.
Node.LMax)
276 state = FindCellState::EnterNode;
281 state = FindCellState::DescendRightChild;
293 this->Nodes.Get(nodeIndex);
295 if (coordinate >= node.
Node.RMin)
299 state = FindCellState::EnterNode;
304 state = FindCellState::AscendFromNode;
320 containingCellId = cellId;
325 containingCellId = -1;
334 using IndicesType =
typename CellSetPortal::IndicesType;
335 IndicesType cellPointIndices = this->CellSet.GetIndices(cellId);
338 auto cellShape = this->CellSet.GetCellShape(cellId);
342 if (isInside && viskores::exec::CellInside(parametric, cellShape))
348 template <
typename CoordsType,
typename CellShapeTag>
351 CellShapeTag cellShape,
352 const CoordsType& cellPoints,
357 cellPoints, point, cellShape, parametric));
358 isInside = viskores::exec::CellInside(parametric, cellShape);
367 typename CellSetType::template ExecConnectivityType<VisitType, IncidentType>;
369 typename viskores::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType;
381 #endif //viskores_exec_CellLocatorBoundingIntervalHierarchy_h
viskores::ErrorCode EnterNode(FindCellState &state, const viskores::Vec3f &point, viskores::Id &cellId, viskores::Id nodeIndex, viskores::Vec3f ¶metric, LastCell &lastCell) const
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:208
viskores::Id ParentIndex
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:43
CellLocatorBoundingIntervalHierarchy(const NodeArrayHandle &nodes, const CellIdArrayHandle &cellIds, const CellSetType &cellSet, const viskores::cont::CoordinateSystem::MultiplexerArrayType &coords, viskores::cont::DeviceAdapterId device, viskores::cont::Token &token)
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:90
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:36
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:32
viskores::IdComponent Dimension
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:42
viskores::Id NodeIdx
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:108
viskores::Id CellId
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:107
typename viskores::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType CoordsPortal
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:369
viskores::ErrorCode FindInLeaf(const viskores::Vec3f &point, viskores::Vec3f ¶metric, const viskores::exec::CellLocatorBoundingIntervalHierarchyNode &node, viskores::Id &containingCellId) const
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:308
ErrorCode
Identifies whether an operation was successful or what type of error it had.
Definition: ErrorCode.h:36
viskores::ErrorCode FindCell(const viskores::Vec3f &point, viskores::Id &cellId, viskores::Vec3f ¶metric, LastCell &lastCell) const
Locate the cell containing the provided point.
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:121
static viskores::ErrorCode IsPointInCell(const viskores::Vec3f &point, viskores::Vec3f ¶metric, CellShapeTag cellShape, const CoordsType &cellPoints, bool &isInside)
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:349
Structure for locating cells.
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:82
typename StorageType::ReadPortalType ReadPortalType
The type of portal used when accessing data in a read-only mode.
Definition: ArrayHandle.h:325
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:42
viskores::Id Size
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:55
#define VISKORES_RETURN_ON_ERROR(call)
Definition: ErrorCode.h:210
Structure capturing the location of a cell in the search structure.
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:105
void DescendRightChild(FindCellState &state, const viskores::Vec3f &point, viskores::Id &nodeIndex) const
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:286
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
void DescendLeftChild(FindCellState &state, const viskores::Vec3f &point, viskores::Id &nodeIndex) const
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:263
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::FloatDefault RMin
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:50
Groups connected points that have the same field value.
Definition: Atomic.h:27
FindCellState
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:199
viskores::ErrorCode FindCellImpl(const viskores::Vec3f &point, viskores::Id &cellId, viskores::Vec3f ¶metric, LastCell &lastCell) const
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:159
A short vector from an ArrayPortal and a vector of indices.
Definition: VecFromPortalPermute.h:36
viskores::Id Start
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:54
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
viskores::cont::ArrayHandleMultiplexerFromList< viskores::ListAppend< ArraysFloatDefault, ArraysFloatNonDefault > > MultiplexerArrayType
Definition: CoordinateSystem.h:109
viskores::Id ChildIndex
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:44
CellLocatorBoundingIntervalHierarchyNode()
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:63
CoordsPortal Coords
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:374
typename CellIdArrayHandle::ReadPortalType CellIdPortal
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:365
viskores::FloatDefault LMax
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:49
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
NodePortal Nodes
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:371
CellIdPortal CellIds
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:372
viskores::ErrorCode PointInCell(const viskores::Vec3f &point, viskores::Id &cellId, viskores::Vec3f ¶metric) const
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:330
@ CellNotFound
A cell matching some given criteria could not be found.
@ Success
A successful operation.
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
typename NodeArrayHandle::ReadPortalType NodePortal
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:364
CellSetPortal CellSet
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:373
void AscendFromNode(FindCellState &state, viskores::Id &nodeIndex) const
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:239
struct viskores::exec::CellLocatorBoundingIntervalHierarchyNode::@1::@4 Leaf
struct viskores::exec::CellLocatorBoundingIntervalHierarchyNode::@1::@3 Node
typename CellSetType::template ExecConnectivityType< VisitType, IncidentType > CellSetPortal
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:367
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
#define VISKORES_EXEC
Definition: ExportMacros.h:59
viskores::ErrorCode FindCell(const viskores::Vec3f &point, viskores::Id &cellId, viskores::Vec3f ¶metric) const
Locate the cell containing the provided point.
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:112