Viskores  1.0
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
viskores::cont::PartitionedDataSet Class Reference

Comprises a set of viskores::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 viskores::cont::DataSet &ds)
 Create a new PartitionedDataSet containng a single DataSet ds. More...
 
 PartitionedDataSet (const std::vector< viskores::cont::DataSet > &partitions)
 Create a new PartitionedDataSet with a DataSet vector partitions. More...
 
 PartitionedDataSet (viskores::Id size)
 Create a new PartitionedDataSet with the capacity set to be size. More...
 
 PartitionedDataSet ()=default
 
viskores::cont::Field GetFieldFromPartition (const std::string &field_name, int partition_index) const
 Get the field field_name from partition partition_index. More...
 
viskores::Id GetNumberOfPartitions () const
 Get number of DataSet objects stored in this PartitionedDataSet. More...
 
viskores::Id GetGlobalNumberOfPartitions () const
 Get number of partations across all MPI ranks. More...
 
const viskores::cont::DataSetGetPartition (viskores::Id partId) const
 Get the DataSet partId. More...
 
const std::vector< viskores::cont::DataSet > & GetPartitions () const
 Get an STL vector of all DataSet objects stored in PartitionedDataSet. More...
 
void AppendPartition (const viskores::cont::DataSet &ds)
 Add DataSet ds to the end of the list of partitions. More...
 
void InsertPartition (viskores::Id index, const viskores::cont::DataSet &ds)
 Add DataSet ds to position index of the contained DataSet vector. More...
 
void ReplacePartition (viskores::Id index, const viskores::cont::DataSet &ds)
 Replace the index positioned element of the contained DataSet vector with ds. More...
 
void AppendPartitions (const std::vector< viskores::cont::DataSet > &partitions)
 Append the DataSet vector partitions to the end of list of partitions. More...
 
viskores::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, viskores::cont::Field::Association association, const viskores::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 viskores::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 viskores::Id &n)
 
template<typename T , typename Storage >
void AddPartitionsField (const std::string &fieldName, const viskores::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 viskores::Id &n)
 
const viskores::cont::FieldGetField (viskores::Id index) const
 
viskores::cont::FieldGetField (viskores::Id index)
 
const viskores::cont::FieldGetField (const std::string &name, viskores::cont::Field::Association assoc=viskores::cont::Field::Association::Any) const
 
viskores::cont::FieldGetField (const std::string &name, viskores::cont::Field::Association assoc=viskores::cont::Field::Association::Any)
 Get a field associated with the partitioned data structure. More...
 
const viskores::cont::FieldGetGlobalField (const std::string &name) const
 Get a global field. More...
 
const viskores::cont::FieldGetPartitionsField (const std::string &name) const
 Get a field associated with the partitions. More...
 
viskores::cont::FieldGetGlobalField (const std::string &name)
 
viskores::cont::FieldGetPartitionsField (const std::string &name)
 
bool HasField (const std::string &name, viskores::cont::Field::Association assoc=viskores::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 viskores::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< viskores::cont::DataSet >
 

Private Attributes

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

Detailed Description

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

Member Typedef Documentation

◆ const_iterator

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

◆ const_reference

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

◆ iterator

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

◆ reference

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

◆ StorageVec

◆ value_type

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

Constructor & Destructor Documentation

◆ PartitionedDataSet() [1/4]

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

Create a new PartitionedDataSet containng a single DataSet ds.

◆ PartitionedDataSet() [2/4]

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

Create a new PartitionedDataSet with a DataSet vector partitions.

◆ PartitionedDataSet() [3/4]

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

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

◆ PartitionedDataSet() [4/4]

viskores::cont::PartitionedDataSet::PartitionedDataSet ( )
default

Member Function Documentation

◆ AddField() [1/2]

void viskores::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 viskores::cont::PartitionedDataSet::AddField ( const std::string &  name,
viskores::cont::Field::Association  association,
const viskores::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 viskores::cont::PartitionedDataSet::AddGlobalField ( const std::string &  fieldName,
const std::vector< T > &  field 
)
inline

◆ AddGlobalField() [2/3]

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

◆ AddGlobalField() [3/3]

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

Add a field with a global association.

◆ AddPartitionsField() [1/3]

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

◆ AddPartitionsField() [2/3]

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

◆ AddPartitionsField() [3/3]

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

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

◆ AppendPartition()

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

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

◆ AppendPartitions()

void viskores::cont::PartitionedDataSet::AppendPartitions ( const std::vector< viskores::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 viskores::cont::PartitionedDataSet::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

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

◆ cbegin()

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

◆ cend()

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

◆ CopyPartitions()

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

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

◆ end() [1/2]

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

◆ end() [2/2]

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

◆ GetField() [1/4]

viskores::cont::Field& viskores::cont::PartitionedDataSet::GetField ( const std::string &  name,
viskores::cont::Field::Association  assoc = viskores::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 viskores::cont::Field& viskores::cont::PartitionedDataSet::GetField ( const std::string &  name,
viskores::cont::Field::Association  assoc = viskores::cont::Field::Association::Any 
) const
inline

◆ GetField() [3/4]

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

◆ GetField() [4/4]

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

◆ GetFieldFromPartition()

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

Get the field field_name from partition partition_index.

◆ GetGlobalField() [1/2]

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

◆ GetGlobalField() [2/2]

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

Get a global field.

◆ GetGlobalNumberOfPartitions()

viskores::Id viskores::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()

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

Methods to Add and Get fields on a PartitionedDataSet.

◆ GetNumberOfPartitions()

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

Get number of DataSet objects stored in this PartitionedDataSet.

◆ GetPartition()

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

Get the DataSet partId.

◆ GetPartitions()

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

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

◆ GetPartitionsField() [1/2]

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

◆ GetPartitionsField() [2/2]

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

Get a field associated with the partitions.

◆ HasField()

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

Query whether the partitioned data set has the named field.

◆ HasGlobalField()

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

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

◆ HasPartitionsField()

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

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

◆ InsertPartition()

void viskores::cont::PartitionedDataSet::InsertPartition ( viskores::Id  index,
const viskores::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 viskores::cont::PartitionedDataSet::PrintSummary ( std::ostream &  stream) const

◆ ReplacePartition()

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

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

Member Data Documentation

◆ Fields

viskores::cont::internal::FieldCollection viskores::cont::PartitionedDataSet::Fields
private

◆ Partitions

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

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