VTK-m  2.2
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
vtkm::cont::PartitionedDataSet Class Reference

Comprises a set of vtkm::cont::DataSet objects. More...

#include <PartitionedDataSet.h>

Public Types

using iterator = typename StorageVec::iterator
 
using const_iterator = typename StorageVec::const_iterator
 
using value_type = typename StorageVec::value_type
 
using reference = typename StorageVec::reference
 
using const_reference = typename StorageVec::const_reference
 

Public Member Functions

 PartitionedDataSet (const vtkm::cont::DataSet &ds)
 Create a new PartitionedDataSet containng a single DataSet ds. More...
 
 PartitionedDataSet (const std::vector< vtkm::cont::DataSet > &partitions)
 Create a new PartitionedDataSet with a DataSet vector partitions. More...
 
 PartitionedDataSet (vtkm::Id size)
 Create a new PartitionedDataSet with the capacity set to be size. More...
 
 PartitionedDataSet ()=default
 
vtkm::cont::Field GetFieldFromPartition (const std::string &field_name, int partition_index) const
 Get the field field_name from partition partition_index. More...
 
vtkm::Id GetNumberOfPartitions () const
 Get number of DataSet objects stored in this PartitionedDataSet. More...
 
vtkm::Id GetGlobalNumberOfPartitions () const
 Get number of partations across all MPI ranks. More...
 
const vtkm::cont::DataSetGetPartition (vtkm::Id partId) const
 Get the DataSet partId. More...
 
const std::vector< vtkm::cont::DataSet > & GetPartitions () const
 Get an STL vector of all DataSet objects stored in PartitionedDataSet. More...
 
void AppendPartition (const vtkm::cont::DataSet &ds)
 Add DataSet ds to the end of the list of partitions. More...
 
void InsertPartition (vtkm::Id index, const vtkm::cont::DataSet &ds)
 Add DataSet ds to position index of the contained DataSet vector. More...
 
void ReplacePartition (vtkm::Id index, const vtkm::cont::DataSet &ds)
 Replace the index positioned element of the contained DataSet vector with ds. More...
 
void AppendPartitions (const std::vector< vtkm::cont::DataSet > &partitions)
 Append the DataSet vector partitions to the end of list of partitions. More...
 
vtkm::IdComponent GetNumberOfFields () const
 Methods to Add and Get fields on a PartitionedDataSet. More...
 
void AddField (const Field &field)
 Adds a field that is applied to the meta-partition structure. More...
 
void AddField (const std::string &name, vtkm::cont::Field::Association association, const vtkm::cont::UnknownArrayHandle &data)
 Adds a field that is applied to the meta-partition structure. More...
 
template<typename T , typename Storage >
void AddGlobalField (const std::string &fieldName, const vtkm::cont::ArrayHandle< T, Storage > &field)
 Add a field with a global association. More...
 
template<typename T >
void AddGlobalField (const std::string &fieldName, const std::vector< T > &field)
 
template<typename T >
void AddGlobalField (const std::string &fieldName, const T *field, const vtkm::Id &n)
 
template<typename T , typename Storage >
void AddPartitionsField (const std::string &fieldName, const vtkm::cont::ArrayHandle< T, Storage > &field)
 Add a field where each entry is associated with a whole partition. More...
 
template<typename T >
void AddPartitionsField (const std::string &fieldName, const std::vector< T > &field)
 
template<typename T >
void AddPartitionsField (const std::string &fieldName, const T *field, const vtkm::Id &n)
 
const vtkm::cont::FieldGetField (vtkm::Id index) const
 
vtkm::cont::FieldGetField (vtkm::Id index)
 
const vtkm::cont::FieldGetField (const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
 
vtkm::cont::FieldGetField (const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any)
 Get a field associated with the partitioned data structure. More...
 
const vtkm::cont::FieldGetGlobalField (const std::string &name) const
 Get a global field. More...
 
const vtkm::cont::FieldGetPartitionsField (const std::string &name) const
 Get a field associated with the partitions. More...
 
vtkm::cont::FieldGetGlobalField (const std::string &name)
 
vtkm::cont::FieldGetPartitionsField (const std::string &name)
 
bool HasField (const std::string &name, vtkm::cont::Field::Association assoc=vtkm::cont::Field::Association::Any) const
 Query whether the partitioned data set has the named field. More...
 
bool HasGlobalField (const std::string &name) const
 Query whether the partitioned data set has the named global field. More...
 
bool HasPartitionsField (const std::string &name) const
 Query whether the partitioned data set has the named partition field. More...
 
void CopyPartitions (const vtkm::cont::PartitionedDataSet &source)
 Copies the partitions from the source. The fields on the PartitionedDataSet are not copied. More...
 
void PrintSummary (std::ostream &stream) const
 
Iterators

PartitionedDataSet provides an iterator interface that allows you to iterate over the contained partitions using the for (auto ds : pds) syntax.

iterator begin () noexcept
 
iterator end () noexcept
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 

Private Types

using StorageVec = std::vector< vtkm::cont::DataSet >
 

Private Attributes

std::vector< vtkm::cont::DataSetPartitions
 
vtkm::cont::internal::FieldCollection Fields
 

Detailed Description

Comprises a set of vtkm::cont::DataSet objects.

Member Typedef Documentation

◆ const_iterator

using vtkm::cont::PartitionedDataSet::const_iterator = typename StorageVec::const_iterator

◆ const_reference

using vtkm::cont::PartitionedDataSet::const_reference = typename StorageVec::const_reference

◆ iterator

using vtkm::cont::PartitionedDataSet::iterator = typename StorageVec::iterator

◆ reference

using vtkm::cont::PartitionedDataSet::reference = typename StorageVec::reference

◆ StorageVec

◆ value_type

using vtkm::cont::PartitionedDataSet::value_type = typename StorageVec::value_type

Constructor & Destructor Documentation

◆ PartitionedDataSet() [1/4]

vtkm::cont::PartitionedDataSet::PartitionedDataSet ( const vtkm::cont::DataSet ds)

Create a new PartitionedDataSet containng a single DataSet ds.

◆ PartitionedDataSet() [2/4]

vtkm::cont::PartitionedDataSet::PartitionedDataSet ( const std::vector< vtkm::cont::DataSet > &  partitions)
explicit

Create a new PartitionedDataSet with a DataSet vector partitions.

◆ PartitionedDataSet() [3/4]

vtkm::cont::PartitionedDataSet::PartitionedDataSet ( vtkm::Id  size)
explicit

Create a new PartitionedDataSet with the capacity set to be size.

◆ PartitionedDataSet() [4/4]

vtkm::cont::PartitionedDataSet::PartitionedDataSet ( )
default

Member Function Documentation

◆ AddField() [1/2]

void vtkm::cont::PartitionedDataSet::AddField ( const Field field)
inline

Adds a field that is applied to the meta-partition structure.

The field must have an association that applies across all partitions.

◆ AddField() [2/2]

void vtkm::cont::PartitionedDataSet::AddField ( const std::string &  name,
vtkm::cont::Field::Association  association,
const vtkm::cont::UnknownArrayHandle data 
)
inline

Adds a field that is applied to the meta-partition structure.

The field must have an association that applies across all partitions.

◆ AddGlobalField() [1/3]

template<typename T >
void vtkm::cont::PartitionedDataSet::AddGlobalField ( const std::string &  fieldName,
const std::vector< T > &  field 
)
inline

◆ AddGlobalField() [2/3]

template<typename T >
void vtkm::cont::PartitionedDataSet::AddGlobalField ( const std::string &  fieldName,
const T *  field,
const vtkm::Id n 
)
inline

◆ AddGlobalField() [3/3]

template<typename T , typename Storage >
void vtkm::cont::PartitionedDataSet::AddGlobalField ( const std::string &  fieldName,
const vtkm::cont::ArrayHandle< T, Storage > &  field 
)
inline

Add a field with a global association.

◆ AddPartitionsField() [1/3]

template<typename T >
void vtkm::cont::PartitionedDataSet::AddPartitionsField ( const std::string &  fieldName,
const std::vector< T > &  field 
)
inline

◆ AddPartitionsField() [2/3]

template<typename T >
void vtkm::cont::PartitionedDataSet::AddPartitionsField ( const std::string &  fieldName,
const T *  field,
const vtkm::Id n 
)
inline

◆ AddPartitionsField() [3/3]

template<typename T , typename Storage >
void vtkm::cont::PartitionedDataSet::AddPartitionsField ( const std::string &  fieldName,
const vtkm::cont::ArrayHandle< T, Storage > &  field 
)
inline

Add a field where each entry is associated with a whole partition.

◆ AppendPartition()

void vtkm::cont::PartitionedDataSet::AppendPartition ( const vtkm::cont::DataSet ds)

Add DataSet ds to the end of the list of partitions.

◆ AppendPartitions()

void vtkm::cont::PartitionedDataSet::AppendPartitions ( const std::vector< vtkm::cont::DataSet > &  partitions)

Append the DataSet vector partitions to the end of list of partitions.

This list can be provided as a std::vector, or it can be an initializer list (declared in { } curly braces).

◆ begin() [1/2]

const_iterator vtkm::cont::PartitionedDataSet::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

iterator vtkm::cont::PartitionedDataSet::begin ( )
inlinenoexcept

◆ cbegin()

const_iterator vtkm::cont::PartitionedDataSet::cbegin ( ) const
inlinenoexcept

◆ cend()

const_iterator vtkm::cont::PartitionedDataSet::cend ( ) const
inlinenoexcept

◆ CopyPartitions()

void vtkm::cont::PartitionedDataSet::CopyPartitions ( const vtkm::cont::PartitionedDataSet source)

Copies the partitions from the source. The fields on the PartitionedDataSet are not copied.

◆ end() [1/2]

const_iterator vtkm::cont::PartitionedDataSet::end ( ) const
inlinenoexcept

◆ end() [2/2]

iterator vtkm::cont::PartitionedDataSet::end ( )
inlinenoexcept

◆ GetField() [1/4]

vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetField ( const std::string &  name,
vtkm::cont::Field::Association  assoc = vtkm::cont::Field::Association::Any 
)
inline

Get a field associated with the partitioned data structure.

The field is selected by name and, optionally, the association.

◆ GetField() [2/4]

const vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetField ( const std::string &  name,
vtkm::cont::Field::Association  assoc = vtkm::cont::Field::Association::Any 
) const
inline

◆ GetField() [3/4]

vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetField ( vtkm::Id  index)
inline

◆ GetField() [4/4]

const vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetField ( vtkm::Id  index) const
inline

◆ GetFieldFromPartition()

vtkm::cont::Field vtkm::cont::PartitionedDataSet::GetFieldFromPartition ( const std::string &  field_name,
int  partition_index 
) const

Get the field field_name from partition partition_index.

◆ GetGlobalField() [1/2]

vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetGlobalField ( const std::string &  name)
inline

◆ GetGlobalField() [2/2]

const vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetGlobalField ( const std::string &  name) const
inline

Get a global field.

◆ GetGlobalNumberOfPartitions()

vtkm::Id vtkm::cont::PartitionedDataSet::GetGlobalNumberOfPartitions ( ) const

Get number of partations across all MPI ranks.

Warning
This method requires global communication (MPI_Allreduce) if MPI is enabled.

◆ GetNumberOfFields()

vtkm::IdComponent vtkm::cont::PartitionedDataSet::GetNumberOfFields ( ) const
inline

Methods to Add and Get fields on a PartitionedDataSet.

◆ GetNumberOfPartitions()

vtkm::Id vtkm::cont::PartitionedDataSet::GetNumberOfPartitions ( ) const

Get number of DataSet objects stored in this PartitionedDataSet.

◆ GetPartition()

const vtkm::cont::DataSet& vtkm::cont::PartitionedDataSet::GetPartition ( vtkm::Id  partId) const

Get the DataSet partId.

◆ GetPartitions()

const std::vector<vtkm::cont::DataSet>& vtkm::cont::PartitionedDataSet::GetPartitions ( ) const

Get an STL vector of all DataSet objects stored in PartitionedDataSet.

◆ GetPartitionsField() [1/2]

vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetPartitionsField ( const std::string &  name)
inline

◆ GetPartitionsField() [2/2]

const vtkm::cont::Field& vtkm::cont::PartitionedDataSet::GetPartitionsField ( const std::string &  name) const
inline

Get a field associated with the partitions.

◆ HasField()

bool vtkm::cont::PartitionedDataSet::HasField ( const std::string &  name,
vtkm::cont::Field::Association  assoc = vtkm::cont::Field::Association::Any 
) const
inline

Query whether the partitioned data set has the named field.

◆ HasGlobalField()

bool vtkm::cont::PartitionedDataSet::HasGlobalField ( const std::string &  name) const
inline

Query whether the partitioned data set has the named global field.

◆ HasPartitionsField()

bool vtkm::cont::PartitionedDataSet::HasPartitionsField ( const std::string &  name) const
inline

Query whether the partitioned data set has the named partition field.

◆ InsertPartition()

void vtkm::cont::PartitionedDataSet::InsertPartition ( vtkm::Id  index,
const vtkm::cont::DataSet ds 
)

Add DataSet ds to position index of the contained DataSet vector.

All partitions at or after this location are pushed back.

◆ PrintSummary()

void vtkm::cont::PartitionedDataSet::PrintSummary ( std::ostream &  stream) const

◆ ReplacePartition()

void vtkm::cont::PartitionedDataSet::ReplacePartition ( vtkm::Id  index,
const vtkm::cont::DataSet ds 
)

Replace the index positioned element of the contained DataSet vector with ds.

Member Data Documentation

◆ Fields

vtkm::cont::internal::FieldCollection vtkm::cont::PartitionedDataSet::Fields
private

◆ Partitions

std::vector<vtkm::cont::DataSet> vtkm::cont::PartitionedDataSet::Partitions
private

The documentation for this class was generated from the following file:
vtkm::cont::Field::Association::Global
@ Global
A field that applies to all partitions.
vtkm::cont::Field::Association::Partitions
@ Partitions
A field that applies to partitions.