Go to the documentation of this file.
10 #ifndef vtk_m_cont_DataSet_h
11 #define vtk_m_cont_DataSet_h
95 VTKM_CONT void AddField(
const std::string& name,
118 return this->Fields.HasField(name, assoc);
128 bool HasGhostCellField()
const;
131 const std::string& GetGhostCellFieldName()
const;
150 const std::string& name,
153 return this->Fields.GetFieldIndex(name, assoc);
163 const std::string& name,
166 return this->Fields.GetField(name, assoc);
172 const std::string& name,
175 return this->Fields.GetField(name, assoc);
237 template <
typename T,
typename Storage>
244 template <
typename T>
251 template <
typename T>
272 template <
typename T,
typename Storage>
279 template <
typename T>
286 template <
typename T>
297 VTKM_CONT void SetGhostCellFieldName(
const std::string& name);
302 VTKM_CONT void SetGhostCellField(
const std::string& name);
315 VTKM_CONT void SetGhostCellField(
const std::string& fieldName,
334 this->SetGhostCellField(fieldName, field);
341 this->SetGhostCellField(field);
346 void AddGhostCellField(const
vtkm::cont::
Field& field) { this->SetGhostCellField(field); }
376 return this->GetCoordinateSystemIndex(name) >= 0;
395 template <
typename CellSetType>
399 this->SetCellSetImpl(cellSet);
439 void PrintSummary(std::ostream& out)
const;
472 template <
typename... CellSetTypes>
473 struct DataSetWithCellSetTypes
477 DataSetWithCellSetTypes() =
default;
485 template <
typename... CellSetTypes>
486 struct DataSetWithCellSetTypes<
vtkm::List<CellSetTypes...>>
487 : DataSetWithCellSetTypes<CellSetTypes...>
489 using DataSetWithCellSetTypes<CellSetTypes...>::DataSetWithCellSetTypes;
496 "Serialize DataSet directly or use DataSetWithCellSetTypes for weird CellSets.")
497 SerializableDataSet : DataSetWithCellSetTypes<CellSetTypesList>
499 using DataSetWithCellSetTypes<CellSetTypesList>::DataSetWithCellSetTypes;
516 template <
typename... CellSetTypes>
517 struct Serialization<
vtkm::cont::DataSetWithCellSetTypes<CellSetTypes...>>
520 using Type = vtkm::cont::DataSetWithCellSetTypes<CellSetTypes...>;
523 static VTKM_CONT void save(BinaryBuffer& bb,
const Type& serializable)
525 const auto& dataset = serializable.DataSet;
530 vtkmdiy::save(bb, numberOfFields);
533 vtkmdiy::save(bb, dataset.GetField(i));
536 vtkm::IdComponent numberOfCoordinateSystems = dataset.GetNumberOfCoordinateSystems();
537 vtkmdiy::save(bb, numberOfCoordinateSystems);
540 vtkmdiy::save(bb, dataset.GetCoordinateSystemName(i));
544 static VTKM_CONT void load(BinaryBuffer& bb, Type& serializable)
546 auto& dataset = serializable.DataSet;
551 dataset.SetCellSet(cells);
559 dataset.AddField(field);
566 std::string coordName;
568 dataset.AddCoordinateSystem(coordName);
573 template <
typename... CellSetTypes>
574 struct Serialization<
vtkm::cont::DataSetWithCellSetTypes<vtkm::List<CellSetTypes...>>>
575 : Serialization<vtkm::cont::DataSetWithCellSetTypes<CellSetTypes...>>
580 template <
typename FieldTypeList,
typename CellSetTypesList>
581 struct Serialization<
vtkm::cont::SerializableDataSet<FieldTypeList, CellSetTypesList>>
582 : Serialization<vtkm::cont::DataSetWithCellSetTypes<CellSetTypesList>>
590 #endif //vtk_m_cont_DataSet_h
const vtkm::cont::UnknownCellSet & GetCellSet() const
Definition: DataSet.h:403
Manages an array-worth of data.
Definition: ArrayHandle.h:300
vtkm::Id GetFieldIndex(const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
Returns the field that matches the provided name and association.
Definition: DataSet.h:149
T load(const U &u, vtkm::Id v)
Definition: FetchTagArrayDirectIn.h:36
Groups connected points that have the same field value.
Definition: Atomic.h:19
#define VTKM_IS_KNOWN_OR_UNKNOWN_CELL_SET(T)
Definition: UnknownCellSet.h:313
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
bool HasPointField(const std::string &name) const
Definition: DataSet.h:134
vtkm::cont::Field & GetPointField(const std::string &name)
Returns the first point field that matches the provided name.
Definition: DataSet.h:218
const vtkm::cont::Field & GetField(vtkm::Id index) const
Retrieves a field by index.
Definition: DataSet.h:108
Association
Identifies what elements of a data set a field is associated with.
Definition: Field.h:38
vtkm::cont::Field make_Field(std::string name, Field::Association association, const T *data, vtkm::Id size, vtkm::CopyFlag copy)
Convenience functions to build fields from C style arrays and std::vector.
Definition: Field.h:257
void SetCellSet(const CellSetType &cellSet)
Definition: DataSet.h:396
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:430
A CellSet of an uncertain type.
Definition: UncertainCellSet.h:38
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
@ WholeDataSet
A "global" field that applies to the entirety of a vtkm::cont::DataSet.
const vtkm::cont::Field & GetPointField(const std::string &name) const
Returns the first point field that matches the provided name.
Definition: DataSet.h:212
A CellSet of an unknown type.
Definition: UnknownCellSet.h:48
vtkm::cont::Field & GetCellField(const std::string &name)
Returns the first cell field that matches the provided name.
Definition: DataSet.h:191
bool HasCellField(const std::string &name) const
Definition: DataSet.h:122
vtkm::IdComponent GetNumberOfCoordinateSystems() const
Definition: DataSet.h:412
Definition: Particle.h:351
void SetGlobalGhostCellFieldName(const std::string &name) noexcept
#define VTKM_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:123
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:30
void AddCellField(const std::string &fieldName, const vtkm::cont::ArrayHandle< T, Storage > &field)
Adds a cell field of a given name to the DataSet.
Definition: DataSet.h:273
void AddPointField(const std::string &fieldName, const std::vector< T > &field)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:245
void AddCellField(const std::string &fieldName, const std::vector< T > &field)
Adds a cell field of a given name to the DataSet.
Definition: DataSet.h:280
vtkm::cont::Field & GetField(const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any)
Returns the field that matches the provided name and association.
Definition: DataSet.h:171
vtkm::cont::UnknownCellSet CellSet
Definition: DataSet.h:447
void AddPointField(const std::string &fieldName, const vtkm::cont::ArrayHandle< T, Storage > &field)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:238
#define VTKM_DEFAULT_CELL_SET_LIST
Definition: DefaultTypes.h:77
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:31
void AddCellField(const std::string &fieldName, const T *field, const vtkm::Id &n)
Adds a cell field of a given name to the DataSet.
Definition: DataSet.h:287
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
@ Any
Any field regardless of the association.
@ Points
A field that applies to points.
#define VTKM_CONT
Definition: ExportMacros.h:57
bool HasCoordinateSystem(const std::string &name) const
Definition: DataSet.h:374
bool HasField(const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
Definition: DataSet.h:115
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
Defines the topological structure of the data in a DataSet.
Definition: CellSet.h:28
const vtkm::cont::Field & GetField(const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
Returns the field that matches the provided name and association.
Definition: DataSet.h:162
#define VTKM_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:122
void AddCellField(const std::string &fieldName, const vtkm::cont::UnknownArrayHandle &field)
Adds a cell field of a given name to the DataSet.
Definition: DataSet.h:267
vtkm::cont::UnknownCellSet & GetCellSet()
Definition: DataSet.h:406
const std::string & GetGlobalGhostCellFieldName() noexcept
std::string & GlobalGhostCellFieldName() noexcept
#define VTKM_DEFAULT_TYPE_LIST
Definition: DefaultTypes.h:45
@ Cells
A field that applies to cells.
std::shared_ptr< std::string > GhostCellName
Definition: DataSet.h:448
A template used to hold a list of types.
Definition: List.h:39
void AddPointField(const std::string &fieldName, const vtkm::cont::UnknownArrayHandle &field)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:232
const vtkm::cont::Field & GetCellField(const std::string &name) const
Returns the first cell field that matches the provided name.
Definition: DataSet.h:185
std::vector< std::string > CoordSystemNames
Definition: DataSet.h:442
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145
vtkm::cont::Field & GetField(vtkm::Id index)
Retrieves a field by index.
Definition: DataSet.h:111
vtkm::IdComponent GetNumberOfFields() const
Definition: DataSet.h:409
void AddPointField(const std::string &fieldName, const T *field, const vtkm::Id &n)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:252