# PhasicFlow: indexContainer< IndexType > Class Template Reference
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

indexContainer< IndexType > Class Template Reference

It holds two vectors of indecis on Host and Device. More...

## Classes

class | IndexAccessor
| Helper class for accessing index on host or device. More...

## Public Types

using | DVType = DualViewType1D< IndexType >
using | DeviceViewType = typename DVType::t_dev
| Device type on device. More...
using | HostViewType = typename DVType::t_host
| Host type on device. More...
using | HostType = typename HostViewType::device_type
| Host memory type. More...
using | DeviceType = typename DeviceViewType::device_type
| Device memory ype. More...

## Public Member Functions

| TypeInfoTemplateNV11 ("indexContainer", IndexType)
| indexContainer ()
| Default. More...
template<typename T >
| indexContainer (const Range< T > &rng)
| Construct from a Range (half open) More...
| indexContainer (IndexType begin, IndexType end)
| Construct half open [begin,end) More...
| indexContainer (IndexType *data, int32 numElems)
| From data and number of elements in data. More...
| indexContainer (std::vector< IndexType > &ind)
| indexContainer (const DeviceViewType &ind)
| indexContainer (const indexContainer &)=default
| Copy. More...
indexContainer & | operator= (const indexContainer &)=default
| Copy assignment. More...
| indexContainer (indexContainer &&)=default
| Move. More...
indexContainer & | operator= (indexContainer &&)=default
| Mover assignement. More...
| ~indexContainer ()=default
| Destructor. More...
INLINE_FUNCTION_HD auto | size () const
| Size. More...
INLINE_FUNCTION_HD bool | empty () const
| If the container empty. More...
INLINE_FUNCTION_HD IndexType | min () const
| Min value of indices. More...
INLINE_FUNCTION_HD IndexType | max () const
| Max value of indices. More...
const HostViewType & | hostView () const
| Return Host veiw. More...
const DeviceViewType & | deviceView () const
| Return Device view. More...
HostViewType & | hostView ()
| Return Host veiw. More...
DeviceViewType & | deviceView ()
| Return Device veiw. More...
auto | indicesHost () const
| Return index accessor that works on Host. More...
auto | indicesDevice () const
| Return index accessor that works on Device. More...
void | modifyOnHost ()
| Mark host is modified. More...
void | modifyOnDevice ()
| Mark device is modified. More...
void | syncViews ()
| synchronize views More...
void | syncViews (uint32 newSize)

## Protected Attributes

IndexType | min_ = 0
| min value in indices More...
IndexType | max_ = 0
| max value in the indices More...
uint32 | size_ = 0
| number/size of index vector More...
DVType | views_
| views to hold indices on Host and Device More...

## Detailed Description

### template<typename IndexType>
class pFlow::indexContainer< IndexType >

It holds two vectors of indecis on Host and Device.

Host vector should be used for threads running on Host and Device vector should be used for threads running on Device.

Definition at line 39 of file indexContainer.hpp.

## Member Typedef Documentation

## DVType

using DVType = DualViewType1D<IndexType>

Definition at line 43 of file indexContainer.hpp.

## DeviceViewType

using DeviceViewType = typename DVType::t_dev

Device type on device.

Definition at line 45 of file indexContainer.hpp.

## HostViewType

using HostViewType = typename DVType::t_host

Host type on device.

Definition at line 48 of file indexContainer.hpp.

## HostType

using HostType = typename HostViewType::device_type

Host memory type.

Definition at line 51 of file indexContainer.hpp.

## DeviceType

using DeviceType = typename DeviceViewType::device_type

Device memory ype.

Definition at line 54 of file indexContainer.hpp.

## Constructor & Destructor Documentation

## indexContainer() [1/8]

indexContainer | ( |  | ) |

inline

Default.

Definition at line 102 of file indexContainer.hpp.

## indexContainer() [2/8]

indexContainer | ( | const Range< T > & | rng | ) |

inline

Construct from a Range (half open)

Definition at line 106 of file indexContainer.hpp.

## indexContainer() [3/8]

indexContainer | ( | IndexType | begin,
|  | IndexType | end
| ) |  |

inline

Construct half open [begin,end)

Definition at line 116 of file indexContainer.hpp.

References pFlow::copy(), pFlow::fillSequence(), indexContainer< IndexType >::min_, indexContainer< IndexType >::size_, and indexContainer< IndexType >::views_.

Here is the call graph for this function:

## indexContainer() [4/8]

indexContainer | ( | IndexType * | data,
|  | int32 | numElems
| ) |  |

inline

From data and number of elements in data.

data is a pointer in the Host memory

Definition at line 129 of file indexContainer.hpp.

References pFlow::copy(), pFlow::max(), indexContainer< IndexType >::max_, pFlow::min(), indexContainer< IndexType >::min_, and indexContainer< IndexType >::views_.

Here is the call graph for this function:

## indexContainer() [5/8]

indexContainer | ( | std::vector< IndexType > & | ind | ) |

inline

Definition at line 141 of file indexContainer.hpp.

## indexContainer() [6/8]

indexContainer | ( | const DeviceViewType & | ind | ) |

inline

Definition at line 146 of file indexContainer.hpp.

References pFlow::copy(), pFlow::max(), indexContainer< IndexType >::max_, pFlow::min(), indexContainer< IndexType >::min_, indexContainer< IndexType >::size_, and indexContainer< IndexType >::views_.

Here is the call graph for this function:

## indexContainer() [7/8]

indexContainer | ( | const indexContainer< IndexType > & |  | ) |

default

Copy.

## indexContainer() [8/8]

indexContainer | ( | indexContainer< IndexType > && |  | ) |

default

Move.

## ~indexContainer()

~indexContainer | ( |  | ) |

default

Destructor.

## Member Function Documentation

## TypeInfoTemplateNV11()

TypeInfoTemplateNV11 | ( | "indexContainer< IndexType >" | ,
|  | IndexType |
| ) |  |

## operator=() [1/2]

indexContainer& operator= | ( | const indexContainer< IndexType > & |  | ) |

default

Copy assignment.

## operator=() [2/2]

indexContainer& operator= | ( | indexContainer< IndexType > && |  | ) |

default

Mover assignement.

## size()

INLINE_FUNCTION_HD auto size | ( |  | ) | const

inline

Size.

Definition at line 175 of file indexContainer.hpp.

References indexContainer< IndexType >::size_.

Referenced by particleIdHandler::hearChanges(), VectorSingle< uint32, HostSpace >::insertSetElement(), VectorDual< multiRotatingAxis >::insertSetElement(), VectorSingle< uint32, HostSpace >::reorderItems(), VectorDual< multiRotatingAxis >::sortItems(), and internalPoints::sortPoints().

Here is the caller graph for this function:

## empty()

INLINE_FUNCTION_HD bool empty | ( |  | ) | const

inline

If the container empty.

Definition at line 182 of file indexContainer.hpp.

References indexContainer< IndexType >::size_.

Referenced by VectorSingle< uint32, HostSpace >::insertSetElement().

Here is the caller graph for this function:

## min()

INLINE_FUNCTION_HD IndexType min | ( |  | ) | const

inline

Min value of indices.

Definition at line 189 of file indexContainer.hpp.

References indexContainer< IndexType >::min_.

Referenced by VectorDual< multiRotatingAxis >::insertSetElement().

Here is the caller graph for this function:

## max()

INLINE_FUNCTION_HD IndexType max | ( |  | ) | const

inline

Max value of indices.

Definition at line 196 of file indexContainer.hpp.

References indexContainer< IndexType >::max_.

Referenced by VectorSingle< uint32, HostSpace >::insertSetElement(), VectorDual< multiRotatingAxis >::insertSetElement(), and VectorSingle< uint32, HostSpace >::reorderItems().

Here is the caller graph for this function:

## hostView() [1/2]

const HostViewType& hostView | ( |  | ) | const

inline

Return Host veiw.

Definition at line 202 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

Referenced by VectorSingle< uint32, HostSpace >::insertSetElement(), VectorDual< multiRotatingAxis >::insertSetElement(), and VectorSingle< uint32, HostSpace >::reorderItems().

Here is the caller graph for this function:

## deviceView() [1/2]

const DeviceViewType& deviceView | ( |  | ) | const

inline

Return Device view.

Definition at line 208 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

Referenced by pFlow::getSortedIndices(), VectorSingle< uint32, HostSpace >::insertSetElement(), VectorDual< multiRotatingAxis >::insertSetElement(), VectorSingle< uint32, HostSpace >::reorderItems(), and VectorDual< multiRotatingAxis >::sortItems().

Here is the caller graph for this function:

## hostView() [2/2]

HostViewType& hostView | ( |  | ) |

inline

Return Host veiw.

Definition at line 214 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

## deviceView() [2/2]

DeviceViewType& deviceView | ( |  | ) |

inline

Return Device veiw.

Definition at line 220 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

## indicesHost()

auto indicesHost | ( |  | ) | const

inline

Return index accessor that works on Host.

Definition at line 226 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

## indicesDevice()

auto indicesDevice | ( |  | ) | const

inline

Return index accessor that works on Device.

Definition at line 232 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

## modifyOnHost()

void modifyOnHost | ( |  | ) |

inline

Mark host is modified.

Definition at line 238 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

## modifyOnDevice()

void modifyOnDevice | ( |  | ) |

inline

Mark device is modified.

Definition at line 244 of file indexContainer.hpp.

References indexContainer< IndexType >::views_.

Referenced by pFlow::getSortedIndices().

Here is the caller graph for this function:

## syncViews() [1/2]

void syncViews | ( |  | ) |

inline

synchronize views

Definition at line 250 of file indexContainer.hpp.

References pFlow::max(), indexContainer< IndexType >::max_, pFlow::min(), indexContainer< IndexType >::min_, indexContainer< IndexType >::size_, and indexContainer< IndexType >::views_.

Referenced by pFlow::getSortedIndices(), and indexContainer< IndexType >::syncViews().

Here is the call graph for this function:
Here is the caller graph for this function:

## syncViews() [2/2]

void syncViews | ( | uint32 | newSize | ) |

inline

Definition at line 273 of file indexContainer.hpp.

References indexContainer< IndexType >::size_, and indexContainer< IndexType >::syncViews().

Here is the call graph for this function:

## Member Data Documentation

## min_

IndexType min_ = 0

protected

min value in indices

Definition at line 84 of file indexContainer.hpp.

Referenced by indexContainer< IndexType >::indexContainer(), indexContainer< IndexType >::min(), and indexContainer< IndexType >::syncViews().

## max_

IndexType max_ = 0

protected

max value in the indices

Definition at line 87 of file indexContainer.hpp.

Referenced by indexContainer< IndexType >::indexContainer(), indexContainer< IndexType >::max(), and indexContainer< IndexType >::syncViews().

## size_

uint32 size_ = 0

protected

number/size of index vector

Definition at line 90 of file indexContainer.hpp.

Referenced by indexContainer< IndexType >::empty(), indexContainer< IndexType >::indexContainer(), indexContainer< IndexType >::size(), and indexContainer< IndexType >::syncViews().

## views_

DVType views_

protected

views to hold indices on Host and Device

Definition at line 93 of file indexContainer.hpp.

Referenced by indexContainer< IndexType >::deviceView(), indexContainer< IndexType >::hostView(), indexContainer< IndexType >::indexContainer(), indexContainer< IndexType >::indicesDevice(), indexContainer< IndexType >::indicesHost(), indexContainer< IndexType >::modifyOnDevice(), indexContainer< IndexType >::modifyOnHost(), and indexContainer< IndexType >::syncViews().

The documentation for this class was generated from the following file:

- src/phasicFlow/containers/indexContainer/indexContainer.hpp