vtk-m2/vtkm/cont/DataSet.h

454 lines
13 KiB
C
Raw Normal View History

//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
2019-04-15 23:24:21 +00:00
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
2015-01-28 16:27:15 +00:00
#ifndef vtk_m_cont_DataSet_h
#define vtk_m_cont_DataSet_h
2015-01-27 21:22:21 +00:00
#include <vtkm/cont/vtkm_cont_export.h>
2015-01-27 21:22:21 +00:00
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/ErrorBadValue.h>
#include <vtkm/cont/Field.h>
#include <vtkm/cont/UnknownArrayHandle.h>
#include <vtkm/cont/UnknownCellSet.h>
2022-08-22 19:02:03 +00:00
#include <vtkm/cont/internal/FieldCollection.h>
2015-01-27 21:22:21 +00:00
2017-05-18 14:29:41 +00:00
namespace vtkm
{
namespace cont
{
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
VTKM_CONT_EXPORT VTKM_CONT std::string& GlobalGhostCellFieldName() noexcept;
VTKM_CONT_EXPORT VTKM_CONT const std::string& GetGlobalGhostCellFieldName() noexcept;
VTKM_CONT_EXPORT VTKM_CONT void SetGlobalGhostCellFieldName(const std::string& name) noexcept;
class VTKM_CONT_EXPORT DataSet
2015-01-27 21:22:21 +00:00
{
public:
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
DataSet() = default;
DataSet(vtkm::cont::DataSet&&) = default;
DataSet(const vtkm::cont::DataSet&) = default;
vtkm::cont::DataSet& operator=(vtkm::cont::DataSet&&) = default;
vtkm::cont::DataSet& operator=(const vtkm::cont::DataSet&) = default;
VTKM_CONT void Clear();
2015-10-23 13:43:20 +00:00
/// Get the number of cells contained in this DataSet
VTKM_CONT vtkm::Id GetNumberOfCells() const;
/// Get the number of points contained in this DataSet
///
/// Note: All coordinate systems for a DataSet are expected
/// to have the same number of points.
VTKM_CONT vtkm::Id GetNumberOfPoints() const;
VTKM_CONT void AddField(const Field& field);
VTKM_CONT
2022-08-22 19:02:03 +00:00
const vtkm::cont::Field& GetField(vtkm::Id index) const { return this->Fields.GetField(index); }
2015-02-10 17:36:10 +00:00
VTKM_CONT
2022-08-22 19:02:03 +00:00
vtkm::cont::Field& GetField(vtkm::Id index) { return this->Fields.GetField(index); }
VTKM_CONT
2017-05-18 14:29:41 +00:00
bool HasField(const std::string& name,
vtkm::cont::Field::Association assoc = vtkm::cont::Field::Association::Any) const
{
2022-08-22 19:02:03 +00:00
return this->Fields.HasField(name, assoc);
}
VTKM_CONT
bool HasCellField(const std::string& name) const
{
2022-08-22 19:02:03 +00:00
return (this->Fields.GetFieldIndex(name, vtkm::cont::Field::Association::Cells) != -1);
}
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
VTKM_CONT
bool HasGhostCellField() const
{
if (this->GhostCellName)
{
return this->HasCellField(*this->GhostCellName);
}
else
{
return false;
}
}
VTKM_CONT
const std::string& GetGhostCellFieldName() const
{
if (this->HasGhostCellField())
{
return *this->GhostCellName;
}
else
{
throw vtkm::cont::ErrorBadValue("No Ghost Cell Field Name");
}
}
VTKM_CONT
bool HasPointField(const std::string& name) const
{
2022-08-22 19:02:03 +00:00
return (this->Fields.GetFieldIndex(name, vtkm::cont::Field::Association::Points) != -1);
}
/// Returns the field that matches the provided name and association
/// Will return -1 if no match is found
VTKM_CONT
vtkm::Id GetFieldIndex(
const std::string& name,
2022-08-22 19:02:03 +00:00
vtkm::cont::Field::Association assoc = vtkm::cont::Field::Association::Any) const
{
return this->Fields.GetFieldIndex(name, assoc);
}
/// Returns the field that matches the provided name and association
/// Will throw an exception if no match is found
2022-09-09 02:29:48 +00:00
///@{
VTKM_CONT
2017-05-18 14:29:41 +00:00
const vtkm::cont::Field& GetField(
const std::string& name,
2022-08-22 19:02:03 +00:00
vtkm::cont::Field::Association assoc = vtkm::cont::Field::Association::Any) const
{
return this->Fields.GetField(name, assoc);
}
VTKM_CONT
vtkm::cont::Field& GetField(
const std::string& name,
2022-08-22 19:02:03 +00:00
vtkm::cont::Field::Association assoc = vtkm::cont::Field::Association::Any)
{
return this->Fields.GetField(name, assoc);
}
2022-09-09 02:29:48 +00:00
///@}
/// Returns the first cell field that matches the provided name.
/// Will throw an exception if no match is found
2022-09-09 02:29:48 +00:00
///@{
VTKM_CONT
2017-05-18 14:29:41 +00:00
const vtkm::cont::Field& GetCellField(const std::string& name) const
{
return this->GetField(name, vtkm::cont::Field::Association::Cells);
}
VTKM_CONT
vtkm::cont::Field& GetCellField(const std::string& name)
{
return this->GetField(name, vtkm::cont::Field::Association::Cells);
}
2022-09-09 02:29:48 +00:00
///@}
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
/// Returns the first cell field that matches the provided name.
/// Will throw an exception if no match is found
2022-09-09 02:29:48 +00:00
///@{
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
VTKM_CONT
const vtkm::cont::Field& GetGhostCellField() const
{
if (this->HasGhostCellField())
{
return this->GetCellField(*(this->GhostCellName));
}
else
{
throw vtkm::cont::ErrorBadValue("No Ghost Cell Field");
}
}
2022-09-09 02:29:48 +00:00
///@}
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
/// Returns the first point field that matches the provided name.
/// Will throw an exception if no match is found
2022-09-09 02:29:48 +00:00
///@{
VTKM_CONT
2017-05-18 14:29:41 +00:00
const vtkm::cont::Field& GetPointField(const std::string& name) const
{
return this->GetField(name, vtkm::cont::Field::Association::Points);
}
VTKM_CONT
vtkm::cont::Field& GetPointField(const std::string& name)
{
return this->GetField(name, vtkm::cont::Field::Association::Points);
}
2022-09-09 02:29:48 +00:00
///@}
2020-05-27 19:27:47 +00:00
VTKM_CONT
void AddPointField(const std::string& fieldName, const vtkm::cont::UnknownArrayHandle& field)
2020-05-27 19:27:47 +00:00
{
this->AddField(make_FieldPoint(fieldName, field));
}
template <typename T, typename Storage>
VTKM_CONT void AddPointField(const std::string& fieldName,
const vtkm::cont::ArrayHandle<T, Storage>& field)
{
this->AddField(make_FieldPoint(fieldName, field));
}
template <typename T>
VTKM_CONT void AddPointField(const std::string& fieldName, const std::vector<T>& field)
{
this->AddField(
make_Field(fieldName, vtkm::cont::Field::Association::Points, field, vtkm::CopyFlag::On));
2020-05-27 19:27:47 +00:00
}
template <typename T>
VTKM_CONT void AddPointField(const std::string& fieldName, const T* field, const vtkm::Id& n)
{
this->AddField(
make_Field(fieldName, vtkm::cont::Field::Association::Points, field, n, vtkm::CopyFlag::On));
2020-05-27 19:27:47 +00:00
}
//Cell centered field
VTKM_CONT
void AddCellField(const std::string& fieldName, const vtkm::cont::UnknownArrayHandle& field)
2020-05-27 19:27:47 +00:00
{
this->AddField(make_FieldCell(fieldName, field));
}
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
VTKM_CONT
void AddGhostCellField(const std::string& fieldName, const vtkm::cont::UnknownArrayHandle& field)
{
this->GhostCellName.reset(new std::string(fieldName));
this->AddField(make_FieldCell(fieldName, field));
}
VTKM_CONT
void AddGhostCellField(const vtkm::cont::UnknownArrayHandle& field)
{
this->AddGhostCellField(GetGlobalGhostCellFieldName(), field);
}
VTKM_CONT
void AddGhostCellField(const vtkm::cont::Field& field)
{
this->AddGhostCellField(field.GetName(), field.GetData());
}
2020-05-27 19:27:47 +00:00
template <typename T, typename Storage>
VTKM_CONT void AddCellField(const std::string& fieldName,
const vtkm::cont::ArrayHandle<T, Storage>& field)
{
this->AddField(make_FieldCell(fieldName, field));
}
template <typename T>
VTKM_CONT void AddCellField(const std::string& fieldName, const std::vector<T>& field)
{
this->AddField(
make_Field(fieldName, vtkm::cont::Field::Association::Cells, field, vtkm::CopyFlag::On));
2020-05-27 19:27:47 +00:00
}
template <typename T>
VTKM_CONT void AddCellField(const std::string& fieldName, const T* field, const vtkm::Id& n)
{
this->AddField(
make_Field(fieldName, vtkm::cont::Field::Association::Cells, field, n, vtkm::CopyFlag::On));
2020-05-27 19:27:47 +00:00
}
VTKM_CONT
void AddCoordinateSystem(const vtkm::cont::CoordinateSystem& cs);
2015-04-15 16:33:27 +00:00
VTKM_CONT
2017-05-18 14:29:41 +00:00
bool HasCoordinateSystem(const std::string& name) const
{
return this->GetCoordinateSystemIndex(name) >= 0;
}
VTKM_CONT
const vtkm::cont::CoordinateSystem& GetCoordinateSystem(vtkm::Id index = 0) const;
VTKM_CONT
vtkm::cont::CoordinateSystem& GetCoordinateSystem(vtkm::Id index = 0);
/// Returns the index for the first CoordinateSystem whose
/// name matches the provided string.
/// Will return -1 if no match is found
VTKM_CONT
vtkm::Id GetCoordinateSystemIndex(const std::string& name) const;
/// Returns the first CoordinateSystem that matches the provided name.
/// Will throw an exception if no match is found
2022-09-09 02:29:48 +00:00
///@{
VTKM_CONT
const vtkm::cont::CoordinateSystem& GetCoordinateSystem(const std::string& name) const;
VTKM_CONT
vtkm::cont::CoordinateSystem& GetCoordinateSystem(const std::string& name);
2022-09-09 02:29:48 +00:00
///@}
/// Returns an `std::vector` of `CoordinateSystem`s held in this `DataSet`.
///
VTKM_CONT
std::vector<vtkm::cont::CoordinateSystem> GetCoordinateSystems() const
{
return this->CoordSystems;
}
2017-05-18 14:29:41 +00:00
template <typename CellSetType>
VTKM_CONT void SetCellSet(const CellSetType& cellSet)
{
VTKM_IS_KNOWN_OR_UNKNOWN_CELL_SET(CellSetType);
this->SetCellSetImpl(cellSet);
}
2015-02-10 17:36:10 +00:00
VTKM_CONT
const vtkm::cont::UnknownCellSet& GetCellSet() const { return this->CellSet; }
VTKM_CONT
vtkm::cont::UnknownCellSet& GetCellSet() { return this->CellSet; }
VTKM_CONT
2022-08-22 19:02:03 +00:00
vtkm::IdComponent GetNumberOfFields() const { return this->Fields.GetNumberOfFields(); }
VTKM_CONT
vtkm::IdComponent GetNumberOfCoordinateSystems() const
{
return static_cast<vtkm::IdComponent>(this->CoordSystems.size());
}
/// Copies the structure i.e. coordinates systems and cellset from the source
/// dataset. The fields are left unchanged.
VTKM_CONT
void CopyStructure(const vtkm::cont::DataSet& source);
/// \brief Convert the structures in this data set to expected types.
///
/// A `DataSet` object can contain data structures of unknown types. Using the data
/// requires casting these data structures to concrete types. It is only possible to
/// check a finite number of data structures.
///
/// The types checked by default are listed in `vtkm/cont/DefaultTypes.h`, which can
/// be configured at compile time. If a `DataSet` contains data not listed there, then
/// it is likely going to cause problems pulling the data back out. To get around this
/// problem, you can call this method to convert the data to a form that is likely to
/// be recognized. This conversion is likely but not guaranteed because not all types
/// are convertable to something recognizable.
///
VTKM_CONT void ConvertToExpected();
VTKM_CONT
void PrintSummary(std::ostream& out) const;
2015-05-20 19:26:10 +00:00
2015-02-10 17:36:10 +00:00
private:
std::vector<vtkm::cont::CoordinateSystem> CoordSystems;
vtkm::cont::internal::FieldCollection Fields{ vtkm::cont::Field::Association::WholeDataSet,
vtkm::cont::Field::Association::Points,
vtkm::cont::Field::Association::Cells };
2022-08-22 19:02:03 +00:00
vtkm::cont::UnknownCellSet CellSet;
Addition of GhostCellField API to the Dataset Class AddGhostCellField function for Dataset class setGhostCellName function for GhostCellClassify class setGhostCellName function for GhostCellClassify class added default ghost cell name in Dataset class Default ghost cell field name defined in GhostCellClassify class Default ghost cell field name for GhostCellClassify class Unit test for ghost field name check Unit test for ghost field name check updated Default ghost field name updated Get function for GhostCellClassify and default ghost name UnitTestStreamlineFilter updated with AddGhostCellField AddGhostCellField and GetGlobalGhostCellFieldName propagated GhostCellClassify constructor now defined in header file Assigned default values to dataset class members GhostSet and GhostCellName default values set for GhostSet and GhostCellName in dataset constructor Constructor removed from dataset class and noexcept for GetGlobalGhostName added Dataset constructor with noexcept additions to make sure default move constructor has not changed GhostSetName field made as a shared pointer since string class is not noexcept AddGhostCellField funtion added without field name hasGhostCellField added and unit tests updated for addGhostCellField hasGhostCellField added and unit tests updated for addGhostCellField GetGhostCellField and GetGhostCellFieldName functions added to Dataset GetGhostCellField and GetGhostCellFieldName functions added to Dataset debugging UnitTestCellLocatorGerneral for CUDA error UnitTestCellLocatorGeneral testing for error UnitTestCellLocatorGeneral testing for cude error UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution UnitTestCellLocatorGeneral error resolution print statement removed Minor updates to Dataset class files GlobalGhostCellFieldName implementation revised to return a static variable GhostSet member removed, hasGhostCellField, constructor, copystructure updated GetGhostCellField and GetGhostCellFieldName made cosistent with GetField Fixes to a few function calls
2022-05-20 13:25:30 +00:00
std::shared_ptr<std::string> GhostCellName;
VTKM_CONT void SetCellSetImpl(const vtkm::cont::UnknownCellSet& cellSet);
2015-01-27 21:22:21 +00:00
};
} // namespace cont
} // namespace vtkm
2015-01-27 21:22:21 +00:00
2018-06-18 17:56:38 +00:00
//=============================================================================
// Specializations of serialization related classes
/// @cond SERIALIZATION
2018-06-18 17:56:38 +00:00
namespace vtkm
{
namespace cont
{
template <typename FieldTypeList = VTKM_DEFAULT_TYPE_LIST,
2019-12-05 21:38:41 +00:00
typename CellSetTypesList = VTKM_DEFAULT_CELL_SET_LIST>
2018-06-18 17:56:38 +00:00
struct SerializableDataSet
{
SerializableDataSet() = default;
explicit SerializableDataSet(const vtkm::cont::DataSet& dataset)
: DataSet(dataset)
{
}
vtkm::cont::DataSet DataSet;
};
}
} // vtkm::cont
namespace mangled_diy_namespace
2018-06-18 17:56:38 +00:00
{
template <typename FieldTypeList, typename CellSetTypesList>
struct Serialization<vtkm::cont::SerializableDataSet<FieldTypeList, CellSetTypesList>>
2018-06-18 17:56:38 +00:00
{
private:
using Type = vtkm::cont::SerializableDataSet<FieldTypeList, CellSetTypesList>;
2018-06-18 17:56:38 +00:00
public:
static VTKM_CONT void save(BinaryBuffer& bb, const Type& serializable)
{
const auto& dataset = serializable.DataSet;
vtkm::IdComponent numberOfCoordinateSystems = dataset.GetNumberOfCoordinateSystems();
vtkmdiy::save(bb, numberOfCoordinateSystems);
2018-06-18 17:56:38 +00:00
for (vtkm::IdComponent i = 0; i < numberOfCoordinateSystems; ++i)
{
vtkmdiy::save(bb, dataset.GetCoordinateSystem(i));
2018-06-18 17:56:38 +00:00
}
vtkmdiy::save(bb, dataset.GetCellSet().ResetCellSetList(CellSetTypesList{}));
2018-06-18 17:56:38 +00:00
vtkm::IdComponent numberOfFields = dataset.GetNumberOfFields();
vtkmdiy::save(bb, numberOfFields);
2018-06-18 17:56:38 +00:00
for (vtkm::IdComponent i = 0; i < numberOfFields; ++i)
{
vtkmdiy::save(bb, dataset.GetField(i));
2018-06-18 17:56:38 +00:00
}
}
static VTKM_CONT void load(BinaryBuffer& bb, Type& serializable)
{
auto& dataset = serializable.DataSet;
dataset = {}; // clear
vtkm::IdComponent numberOfCoordinateSystems = 0;
vtkmdiy::load(bb, numberOfCoordinateSystems);
2018-06-18 17:56:38 +00:00
for (vtkm::IdComponent i = 0; i < numberOfCoordinateSystems; ++i)
{
vtkm::cont::CoordinateSystem coords;
vtkmdiy::load(bb, coords);
2018-06-18 17:56:38 +00:00
dataset.AddCoordinateSystem(coords);
}
vtkm::cont::UncertainCellSet<CellSetTypesList> cells;
vtkmdiy::load(bb, cells);
dataset.SetCellSet(cells);
2018-06-18 17:56:38 +00:00
vtkm::IdComponent numberOfFields = 0;
vtkmdiy::load(bb, numberOfFields);
2018-06-18 17:56:38 +00:00
for (vtkm::IdComponent i = 0; i < numberOfFields; ++i)
{
vtkm::cont::Field field;
vtkmdiy::load(bb, field);
dataset.AddField(field);
2018-06-18 17:56:38 +00:00
}
}
};
} // diy
/// @endcond SERIALIZATION
2018-06-18 17:56:38 +00:00
2015-01-28 16:27:15 +00:00
#endif //vtk_m_cont_DataSet_h