Go to the documentation of this file.
18 #ifndef viskores_exec_celllocatorrectilineargrid_h
19 #define viskores_exec_celllocatorrectilineargrid_h
71 template <viskores::IdComponent dimensions>
79 : PlaneSize(planeSize)
81 , PointDimensions(ToId3(cellSet.GetPointDimensions()))
82 , Dimensions(dimensions)
86 this->AxisPortals[0] = coordsExecPortal.GetFirstPortal();
87 this->MinPoint[0] = coordsContPortal.GetFirstPortal().Get(0);
88 this->MaxPoint[0] = coordsContPortal.GetFirstPortal().Get(this->PointDimensions[0] - 1);
90 this->AxisPortals[1] = coordsExecPortal.GetSecondPortal();
91 this->MinPoint[1] = coordsContPortal.GetSecondPortal().Get(0);
92 this->MaxPoint[1] = coordsContPortal.GetSecondPortal().Get(this->PointDimensions[1] - 1);
95 this->AxisPortals[2] = coordsExecPortal.GetThirdPortal();
96 this->MinPoint[2] = coordsContPortal.GetThirdPortal().Get(0);
97 this->MaxPoint[2] = coordsContPortal.GetThirdPortal().Get(this->PointDimensions[2] - 1);
105 if (point[0] < this->MinPoint[0] || point[0] > this->MaxPoint[0])
107 if (point[1] < this->MinPoint[1] || point[1] > this->MaxPoint[1])
109 if (this->Dimensions == 3)
111 if (point[2] < this->MinPoint[2] || point[2] > this->MaxPoint[2])
123 return this->FindCell(point, cellId, parametric);
131 if (!this->IsInside(point))
146 if (point[dim] == MaxPoint[dim])
148 logicalCell[dim] = this->PointDimensions[dim] - 2;
157 minVal = this->AxisPortals[dim].Get(minIndex);
158 maxVal = this->AxisPortals[dim].Get(maxIndex);
159 while (maxIndex > minIndex + 1)
163 if (point[dim] <= midVal)
174 logicalCell[dim] = minIndex;
175 parametric[dim] = (point[dim] - minVal) / (maxVal - minVal);
178 cellId = logicalCell[2] * this->PlaneSize + logicalCell[1] * this->RowSize + logicalCell[0];
196 #endif //viskores_exec_celllocatorrectilineargrid_h
typename RectilinearType::ReadPortalType RectilinearPortalType
Definition: exec/CellLocatorRectilinearGrid.h:55
viskores::Id RowSize
Definition: exec/CellLocatorRectilinearGrid.h:185
ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:447
static viskores::Id3 && ToId3(viskores::Id3 &&src)
Definition: exec/CellLocatorRectilinearGrid.h:58
ReadPortalType PrepareForInput(viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
Prepares this array to be used as an input to an operation in the execution environment.
Definition: ArrayHandle.h:615
typename Superclass::ReadPortalType ReadPortalType
Definition: ArrayHandleCartesianProduct.h:362
viskores::Id PlaneSize
Definition: exec/CellLocatorRectilinearGrid.h:184
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
ErrorCode
Identifies whether an operation was successful or what type of error it had.
Definition: ErrorCode.h:36
Manages an array-worth of data.
Definition: ArrayHandle.h:313
CellLocatorRectilinearGrid(const viskores::Id planeSize, const viskores::Id rowSize, const viskores::cont::CellSetStructured< dimensions > &cellSet, const RectilinearType &coords, viskores::cont::DeviceAdapterId device, viskores::cont::Token &token)
Definition: exec/CellLocatorRectilinearGrid.h:72
typename StorageType::ReadPortalType ReadPortalType
The type of portal used when accessing data in a read-only mode.
Definition: ArrayHandle.h:325
bool IsInside(const viskores::Vec3f &point) const
Definition: exec/CellLocatorRectilinearGrid.h:102
Structure capturing the location of a cell in the search structure.
Definition: exec/CellLocatorRectilinearGrid.h:67
viskores::Vec3f MinPoint
Definition: exec/CellLocatorRectilinearGrid.h:189
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
typename AxisHandle::ReadPortalType AxisPortalType
Definition: exec/CellLocatorRectilinearGrid.h:54
viskores::Id3 PointDimensions
Definition: exec/CellLocatorRectilinearGrid.h:188
#define VISKORES_CONT
Definition: ExportMacros.h:65
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::Id Dimensions
Definition: exec/CellLocatorRectilinearGrid.h:191
viskores::ErrorCode FindCell(const viskores::Vec3f &point, viskores::Id &cellId, viskores::Vec3f ¶metric) const
Locate the cell containing the provided point.
Definition: exec/CellLocatorRectilinearGrid.h:127
viskores::Vec< viskores::Id, 3 > Id3
Id3 corresponds to a 3-dimensional index for 3d arrays.
Definition: Types.h:1053
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
Defines a 1-, 2-, or 3-dimensional structured grid of points.
Definition: CastAndCall.h:40
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:189
@ CellNotFound
A cell matching some given criteria could not be found.
static viskores::Id3 ToId3(viskores::Id &&src)
Definition: exec/CellLocatorRectilinearGrid.h:63
@ Success
A successful operation.
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
viskores::ErrorCode FindCell(const viskores::Vec3f &point, viskores::Id &cellId, viskores::Vec3f ¶metric, LastCell &) const
Locate the cell containing the provided point.
Definition: exec/CellLocatorRectilinearGrid.h:118
ArrayHandleCartesianProduct is a specialization of ArrayHandle.
Definition: ArrayHandleCartesianProduct.h:345
Structure for locating cells.
Definition: exec/CellLocatorRectilinearGrid.h:48
viskores::Vec3f MaxPoint
Definition: exec/CellLocatorRectilinearGrid.h:190
static viskores::Id3 ToId3(viskores::Id2 &&src)
Definition: exec/CellLocatorRectilinearGrid.h:59
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
#define VISKORES_EXEC
Definition: ExportMacros.h:59