Go to the documentation of this file.
10 #ifndef vtk_m_cont_DataSetBuilderExplicit_h
11 #define vtk_m_cont_DataSetBuilderExplicit_h
53 const std::vector<vtkm::UInt8>& shapes,
54 const std::vector<vtkm::IdComponent>& numIndices,
55 const std::vector<vtkm::Id>& connectivity,
56 const std::string& coordsNm =
"coords")
58 std::vector<T> yVals(xVals.size(), 0), zVals(xVals.size(), 0);
60 xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm);
84 const std::vector<T>& yVals,
85 const std::vector<vtkm::UInt8>& shapes,
86 const std::vector<vtkm::IdComponent>& numIndices,
87 const std::vector<vtkm::Id>& connectivity,
88 const std::string& coordsNm =
"coords")
90 std::vector<T> zVals(xVals.size(), 0);
92 xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm);
115 template <
typename T>
117 const std::vector<T>& yVals,
118 const std::vector<T>& zVals,
119 const std::vector<vtkm::UInt8>& shapes,
120 const std::vector<vtkm::IdComponent>& numIndices,
121 const std::vector<vtkm::Id>& connectivity,
122 const std::string& coordsNm =
"coords");
142 template <
typename T>
144 const std::vector<vtkm::UInt8>& shapes,
145 const std::vector<vtkm::IdComponent>& numIndices,
146 const std::vector<vtkm::Id>& connectivity,
147 const std::string& coordsNm =
"coords");
168 template <
typename T>
174 const std::string& coordsNm =
"coords")
201 template <
typename T,
typename CellShapeTag>
205 const std::vector<vtkm::Id>& connectivity,
206 const std::string& coordsNm =
"coords");
229 template <
typename T,
typename CellShapeTag>
235 const std::string& coordsNm =
"coords")
238 coords, tag, numberOfPointsPerCell, connectivity, coordsNm);
242 template <
typename T>
248 const std::string& coordsNm);
250 template <
typename T,
typename CellShapeTag>
256 const std::string& coordsNm);
259 template <
typename T>
261 const std::vector<T>& xVals,
262 const std::vector<T>& yVals,
263 const std::vector<T>& zVals,
264 const std::vector<vtkm::UInt8>& shapes,
265 const std::vector<vtkm::IdComponent>& numIndices,
266 const std::vector<vtkm::Id>& connectivity,
267 const std::string& coordsNm)
269 VTKM_ASSERT(xVals.size() == yVals.size() && yVals.size() == zVals.size() && xVals.size() > 0);
274 for (std::size_t index = 0; index < xVals.size(); ++index)
276 coordsPortal.Set(
static_cast<vtkm::Id>(index),
289 coordsArray, shapesArray, offsetsArray, connArray, coordsNm);
292 template <
typename T>
295 const std::vector<vtkm::UInt8>& shapes,
296 const std::vector<vtkm::IdComponent>& numIndices,
297 const std::vector<vtkm::Id>& connectivity,
298 const std::string& coordsNm)
308 coordsArray, shapesArray, offsetsArray, connArray, coordsNm);
311 template <
typename T>
317 const std::string& coordsNm)
325 cellSet.
Fill(nPts, shapes, connectivity, offsets);
331 template <
typename T,
typename CellShapeTag>
336 const std::vector<vtkm::Id>& connectivity,
337 const std::string& coordsNm)
343 coordsArray, tag, numberOfPointsPerCell, connArray, coordsNm);
346 template <
typename T,
typename CellShapeTag>
352 const std::string& coordsNm)
360 cellSet.
Fill(coords.GetNumberOfValues(), tag.Id, numberOfPointsPerCell, connectivity);
380 VTKM_CONT void Begin(
const std::string& coordName =
"coords");
392 template <
typename T>
414 template <
typename T>
469 #endif //vtk_m_cont_DataSetBuilderExplicit_h
Manages an array-worth of data.
Definition: ArrayHandle.h:300
void Fill(vtkm::Id numPoints, vtkm::UInt8 shapeId, vtkm::IdComponent numberOfPointsPerCell, const vtkm::cont::ArrayHandle< vtkm::Id, ConnectivityStorageTag > &connectivity)
Set all the cells of the mesh.
Definition: CellSetSingleType.h:200
static vtkm::cont::DataSet Create(const vtkm::cont::ArrayHandle< vtkm::Vec< T, 3 >> &coords, CellShapeTag tag, vtkm::IdComponent numberOfPointsPerCell, const vtkm::cont::ArrayHandle< vtkm::Id > &connectivity, const std::string &coordsNm="coords")
Create a 3D DataSet with arbitrary cell connectivity for a single cell type.
Definition: DataSetBuilderExplicit.h:230
Groups connected points that have the same field value.
Definition: Atomic.h:19
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
constexpr vtkm::Vec< T, vtkm::IdComponent(sizeof...(Ts)+1)> make_Vec(T value0, Ts &&... args)
Initializes and returns a Vec containing all the arguments.
Definition: Types.h:1253
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
static vtkm::cont::DataSet Create(const vtkm::cont::ArrayHandle< vtkm::Vec< T, 3 >> &coords, const vtkm::cont::ArrayHandle< vtkm::UInt8 > &shapes, const vtkm::cont::ArrayHandle< vtkm::IdComponent > &numIndices, const vtkm::cont::ArrayHandle< vtkm::Id > &connectivity, const std::string &coordsNm="coords")
Create a 3D DataSet with arbitrary cell connectivity.
Definition: DataSetBuilderExplicit.h:169
void SetCellSet(const CellSetType &cellSet)
Definition: DataSet.h:396
An explicit cell set with all cells of the same shape.
Definition: CastAndCall.h:34
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
void Fill(vtkm::Id numPoints, const vtkm::cont::ArrayHandle< vtkm::UInt8, ShapesStorageTag > &cellTypes, const vtkm::cont::ArrayHandle< vtkm::Id, ConnectivityStorageTag > &connectivity, const vtkm::cont::ArrayHandle< vtkm::Id, OffsetsStorageTag > &offsets)
Set all the cells of the mesh.
vtkm::Id AddPoint(const T &x, const T &y, const T &z=0)
Add a point to the DataSet.
Definition: DataSetBuilderExplicit.h:415
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:30
std::vector< vtkm::Vec3f > points
Definition: DataSetBuilderExplicit.h:461
static vtkm::cont::DataSet BuildDataSet(const vtkm::cont::ArrayHandle< vtkm::Vec< T, 3 >> &coords, const vtkm::cont::ArrayHandle< vtkm::UInt8 > &shapes, const vtkm::cont::ArrayHandle< vtkm::Id > &offsets, const vtkm::cont::ArrayHandle< vtkm::Id > &connectivity, const std::string &coordsNm)
Definition: DataSetBuilderExplicit.h:312
void ConvertNumComponentsToOffsets(const vtkm::cont::UnknownArrayHandle &numComponentsArray, vtkm::cont::ArrayHandle< vtkm::Id > &offsetsArray, vtkm::Id &componentsArraySize, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny{})
ConvertNumComponentsToOffsets takes an array of Vec sizes (i.e.
vtkm::Id AddPoint(const vtkm::Vec< T, 3 > &pt)
Add a point to the DataSet.
Definition: DataSetBuilderExplicit.h:393
std::vector< vtkm::Id > connectivity
Definition: DataSetBuilderExplicit.h:464
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:169
vtkm::IdComponent AddCoordinateSystem(const vtkm::cont::CoordinateSystem &cs)
Adds the given CoordinateSystem to the DataSet.
DataSetBuilderExplicit()
Definition: DataSetBuilderExplicit.h:31
std::vector< vtkm::IdComponent > numIdx
Definition: DataSetBuilderExplicit.h:463
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
Defines an irregular collection of cells.
Definition: CastAndCall.h:36
std::vector< vtkm::UInt8 > shapes
Definition: DataSetBuilderExplicit.h:462
void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:490
Definition: DataSetBuilderExplicit.h:27
vtkm::cont::ArrayHandleBasic< T > make_ArrayHandle(const T *array, vtkm::Id numberOfValues, vtkm::CopyFlag copy)
A convenience function for creating an ArrayHandle from a standard C array.
Definition: ArrayHandleBasic.h:270
WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:454
std::string coordNm
Definition: DataSetBuilderExplicit.h:459
static vtkm::cont::DataSet Create(const std::vector< T > &xVals, const std::vector< T > &yVals, const std::vector< vtkm::UInt8 > &shapes, const std::vector< vtkm::IdComponent > &numIndices, const std::vector< vtkm::Id > &connectivity, const std::string &coordsNm="coords")
Create a 2D DataSet with arbitrary cell connectivity.
Definition: DataSetBuilderExplicit.h:83
static vtkm::cont::DataSet Create(const std::vector< T > &xVals, const std::vector< vtkm::UInt8 > &shapes, const std::vector< vtkm::IdComponent > &numIndices, const std::vector< vtkm::Id > &connectivity, const std::string &coordsNm="coords")
Create a 1D DataSet with arbitrary cell connectivity.
Definition: DataSetBuilderExplicit.h:52
Helper class to build a DataSet by iteratively adding points and cells.
Definition: DataSetBuilderExplicit.h:369