Go to the documentation of this file.
18 #ifndef viskores_cont_DataSet_h
19 #define viskores_cont_DataSet_h
41 const std::
string& name) noexcept;
119 return this->Fields.GetField(index);
128 const std::string& name,
131 return this->Fields.HasField(name, assoc);
141 bool HasGhostCellField()
const;
144 const std::string& GetGhostCellFieldName()
const;
163 const std::string& name,
166 return this->Fields.GetFieldIndex(name, assoc);
176 const std::string& name,
179 return this->Fields.GetField(name, assoc);
185 const std::string& name,
188 return this->Fields.GetField(name, assoc);
250 template <
typename T,
typename Storage>
257 template <
typename T>
264 template <
typename T>
287 template <
typename T,
typename Storage>
294 template <
typename T>
301 template <
typename T>
314 VISKORES_CONT void SetGhostCellFieldName(
const std::string& name);
319 VISKORES_CONT void SetGhostCellField(
const std::string& name);
332 VISKORES_CONT void SetGhostCellField(
const std::string& fieldName,
349 void AddGhostCellField(const std::
string& fieldName,
352 this->SetGhostCellField(fieldName, field);
359 this->SetGhostCellField(field);
364 void AddGhostCellField(const
viskores::cont::
Field& field) { this->SetGhostCellField(field); }
381 const std::string& name,
395 return this->GetCoordinateSystemIndex(name) >= 0;
414 template <
typename CellSetType>
418 this->SetCellSetImpl(cellSet);
458 void PrintSummary(std::ostream& out)
const;
462 viskores::cont::internal::FieldCollection Fields{
493 template <
typename... CellSetTypes>
494 struct DataSetWithCellSetTypes
498 DataSetWithCellSetTypes() =
default;
506 template <
typename... CellSetTypes>
507 struct DataSetWithCellSetTypes<
viskores::List<CellSetTypes...>>
508 : DataSetWithCellSetTypes<CellSetTypes...>
510 using DataSetWithCellSetTypes<CellSetTypes...>::DataSetWithCellSetTypes;
517 "Serialize DataSet directly or use DataSetWithCellSetTypes for weird CellSets.")
518 SerializableDataSet : DataSetWithCellSetTypes<CellSetTypesList>
520 using DataSetWithCellSetTypes<CellSetTypesList>::DataSetWithCellSetTypes;
530 struct VISKORES_CONT_EXPORT Serialization<
viskores::cont::DataSet>
537 template <
typename... CellSetTypes>
538 struct Serialization<
viskores::cont::DataSetWithCellSetTypes<CellSetTypes...>>
541 using Type = viskores::cont::DataSetWithCellSetTypes<CellSetTypes...>;
544 static VISKORES_CONT void save(BinaryBuffer& bb,
const Type& serializable)
546 const auto& dataset = serializable.DataSet;
551 viskoresdiy::save(bb, numberOfFields);
554 viskoresdiy::save(bb, dataset.GetField(i));
558 viskoresdiy::save(bb, numberOfCoordinateSystems);
561 viskoresdiy::save(bb, dataset.GetCoordinateSystemName(i));
567 auto& dataset = serializable.DataSet;
572 dataset.SetCellSet(cells);
580 dataset.AddField(field);
587 std::string coordName;
589 dataset.AddCoordinateSystem(coordName);
594 template <
typename... CellSetTypes>
595 struct Serialization<
viskores::cont::DataSetWithCellSetTypes<viskores::List<CellSetTypes...>>>
596 : Serialization<viskores::cont::DataSetWithCellSetTypes<CellSetTypes...>>
601 template <
typename FieldTypeList,
typename CellSetTypesList>
602 struct Serialization<
viskores::cont::SerializableDataSet<FieldTypeList, CellSetTypesList>>
603 : Serialization<viskores::cont::DataSetWithCellSetTypes<CellSetTypesList>>
611 #endif //viskores_cont_DataSet_h
T load(const U &u, viskores::Id v)
Definition: FetchTagArrayDirectIn.h:44
#define VISKORES_IS_KNOWN_OR_UNKNOWN_CELL_SET(T)
Definition: UnknownCellSet.h:325
viskores::cont::Field & GetCellField(const std::string &name)
Returns the first cell field that matches the provided name.
Definition: DataSet.h:204
viskores::IdComponent GetNumberOfCoordinateSystems() const
Definition: DataSet.h:431
const viskores::cont::Field & GetPointField(const std::string &name) const
Returns the first point field that matches the provided name.
Definition: DataSet.h:225
std::vector< std::string > CoordSystemNames
Definition: DataSet.h:461
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::cont::Field & GetPointField(const std::string &name)
Returns the first point field that matches the provided name.
Definition: DataSet.h:231
Association
Identifies what elements of a data set a field is associated with.
Definition: Field.h:46
const viskores::cont::Field & GetCellField(const std::string &name) const
Returns the first cell field that matches the provided name.
Definition: DataSet.h:198
#define VISKORES_DEFAULT_TYPE_LIST
Definition: DefaultTypes.h:53
bool HasPointField(const std::string &name) const
Definition: DataSet.h:147
@ Any
Any field regardless of the association.
void AddCellField(const std::string &fieldName, const viskores::cont::ArrayHandle< T, Storage > &field)
Adds a cell field of a given name to the DataSet.
Definition: DataSet.h:288
Manages an array-worth of data.
Definition: ArrayHandle.h:313
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:38
const viskores::cont::Field & GetField(viskores::Id index) const
Retrieves a field by index.
Definition: DataSet.h:117
viskores::IdComponent GetNumberOfFields() const
Definition: DataSet.h:428
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
void AddPointField(const std::string &fieldName, const viskores::cont::UnknownArrayHandle &field)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:245
viskores::cont::Field & GetField(viskores::Id index)
Retrieves a field by index.
Definition: DataSet.h:123
@ Cells
A field that applies to cells.
Definition: Particle.h:373
viskores::cont::Field & GetField(const std::string &name, viskores::cont::Field::Association assoc=viskores::cont::Field::Association::Any)
Returns the field that matches the provided name and association.
Definition: DataSet.h:184
const std::string & GetGlobalGhostCellFieldName() noexcept
bool HasCoordinateSystem(const std::string &name) const
Definition: DataSet.h:393
A template used to hold a list of types.
Definition: List.h:47
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
#define VISKORES_CONT
Definition: ExportMacros.h:65
Groups connected points that have the same field value.
Definition: Atomic.h:27
void AddCellField(const std::string &fieldName, const viskores::cont::UnknownArrayHandle &field)
Adds a cell field of a given name to the DataSet.
Definition: DataSet.h:282
std::shared_ptr< std::string > GhostCellName
Definition: DataSet.h:469
#define VISKORES_DEFAULT_CELL_SET_LIST
Definition: DefaultTypes.h:85
viskores::cont::Field make_Field(std::string name, Field::Association association, const T *data, viskores::Id size, viskores::CopyFlag copy)
Convenience functions to build fields from C style arrays and std::vector.
Definition: Field.h:266
void SetGlobalGhostCellFieldName(const std::string &name) noexcept
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
viskores::cont::UnknownCellSet & GetCellSet()
Definition: DataSet.h:425
const viskores::cont::Field & GetField(const std::string &name, viskores::cont::Field::Association assoc=viskores::cont::Field::Association::Any) const
Returns the field that matches the provided name and association.
Definition: DataSet.h:175
#define VISKORES_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:132
void AddCellField(const std::string &fieldName, const T *field, const viskores::Id &n)
Adds a cell field of a given name to the DataSet.
Definition: DataSet.h:302
std::string & GlobalGhostCellFieldName() noexcept
const viskores::cont::UnknownCellSet & GetCellSet() const
Definition: DataSet.h:422
bool HasCellField(const std::string &name) const
Definition: DataSet.h:135
A CellSet of an unknown type.
Definition: UnknownCellSet.h:56
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:258
A CellSet of an uncertain type.
Definition: UncertainCellSet.h:46
void AddPointField(const std::string &fieldName, const T *field, const viskores::Id &n)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:265
@ WholeDataSet
A "global" field that applies to the entirety of a viskores::cont::DataSet.
viskores::Id GetFieldIndex(const std::string &name, viskores::cont::Field::Association assoc=viskores::cont::Field::Association::Any) const
Returns the field that matches the provided name and association.
Definition: DataSet.h:162
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:451
viskores::cont::UnknownCellSet CellSet
Definition: DataSet.h:468
@ Points
A field that applies to points.
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:39
bool HasField(const std::string &name, viskores::cont::Field::Association assoc=viskores::cont::Field::Association::Any) const
Definition: DataSet.h:127
Defines the topological structure of the data in a DataSet.
Definition: CellSet.h:36
void AddPointField(const std::string &fieldName, const viskores::cont::ArrayHandle< T, Storage > &field)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:251
#define VISKORES_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:131
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:295
void SetCellSet(const CellSetType &cellSet)
Definition: DataSet.h:415