# PhasicFlow: Vector< T, Allocator > 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.

Vector< T, Allocator > Class Template Reference
Inheritance diagram for Vector< T, Allocator >:
[legend]

## Public Types

using | VectorType = Vector< T, Allocator >
using | vectorType = typename std::vector< T, Allocator >
using | iterator = typename vectorType::iterator
using | const_iterator = typename vectorType::const_iterator
using | reference = typename vectorType::reference
using | const_reference = typename vectorType::const_reference
using | value_type = T
using | pointer = T *
using | const_pointer = const T *
using | init_list = typename std::initializer_list< T >

## Public Member Functions

| TypeInfoTemplateNV111 ("Vector", T, memoerySpaceName())
| Vector ()
| Empty Vector. More...
| Vector (const word &name)
| Empty Vector with a name. More...
| Vector (const word &name, size_t len)
| Vector with specified length and name. More...
| Vector (const word &name, size_t len, const T &val)
| Vector with name, length and value. More...
| Vector (const word &name, size_t cap, size_t len, RESERVE)
| Vector with name, size and reserved capacity. More...
| Vector (const word &name, const init_list &l)
| Vector from name and initializer list. More...
| Vector (const word &name, const vectorType &src)
| Construct with a name and form std::vector (host memory) More...
| Vector (const word &name, const vectorType &src, size_t cap)
| Construct with a name and form std::vector (host memory) and with a desired capacity. More...
| Vector (const VectorType &src)=default
| Copy construct. More...
| Vector (const word &name, const Vector< T > &src)
| Copy from src with a new name. More...
VectorType & | operator= (const VectorType &rhs)=default
| Copy assignment. More...
VectorType & | operator= (const vectorType &rhs)
| Copy assignment from std::vector. More...
| Vector (VectorType &&mv) noexcept=default
| Move construct. More...
VectorType & | operator= (VectorType &&mv) noexcept=default
| Move assignment. More...
void | operator= (const T &val)
| Scalar assignment. More...
| ~Vector ()=default
| Destructor. More...
uniquePtr< VectorType > | clone () const
| Clone as a uniquePtr. More...
VectorType * | clonePtr () const
| Clone as a pointer. More...
const VectorType & | VectorField () const
| Access to this, mostly used by derived classes. More...
VectorType & | VectorField ()
const vectorType & | vectorField () const
vectorType & | vectorField ()
auto & | deviceVectorAll ()
const auto & | deviceVectorAll () const
auto & | deviceVector ()
const auto & | deviceVector () const
const word & | name () const
| Name of the vector. More...
auto | size () const
| Size of the vector. More...
auto | capacity () const
| Capacity of the vector. More...
bool | empty () const
| If vector is empty. More...
void | reserve (size_t cap)
| Reserve capacity for vector Preserve the content. More...
void | fill (const T &val)
void | fill (uint32 start, uint32 end, const T &val)
| fill the content in range [start, end) More...
auto | getSpan ()
auto | getSpan () const
void | operator+= (const T &val)
void | operator-= (const T &val)
void | operator*= (const T &val)
void | operator/= (const T &val)
void | operator+= (const VectorType &v)
void | operator-= (const VectorType &v)
void | operator/= (const VectorType &v)
void | operator*= (const VectorType &v)
VectorType | operator- () const
bool | read (iIstream &is)
bool | write (iOstream &os) const
bool | read (iIstream &is, const IOPattern &iop)
bool | write (iOstream &os, const IOPattern &iop) const

## Static Public Member Functions

static constexpr bool | isHostAccessible ()
static constexpr const char * | memoerySpaceName ()

## Private Attributes

word | name_

## Static Private Attributes

static constexpr bool | isHostAccessible_ = true

## Detailed Description

### template<typename T, typename Allocator = vecAllocator<T>>
class pFlow::Vector< T, Allocator >

Definition at line 48 of file Vector.hpp.

## Member Typedef Documentation

## VectorType

using VectorType = Vector<T, Allocator>

Definition at line 62 of file Vector.hpp.

## vectorType

using vectorType = typename std::vector<T, Allocator>

Definition at line 64 of file Vector.hpp.

## iterator

using iterator = typename vectorType::iterator

Definition at line 66 of file Vector.hpp.

## const_iterator

using const_iterator = typename vectorType::const_iterator

Definition at line 68 of file Vector.hpp.

## reference

using reference = typename vectorType::reference

Definition at line 70 of file Vector.hpp.

## const_reference

using const_reference = typename vectorType::const_reference

Definition at line 72 of file Vector.hpp.

## value_type

using value_type = T

Definition at line 74 of file Vector.hpp.

## pointer

using pointer = T *

Definition at line 76 of file Vector.hpp.

## const_pointer

using const_pointer = const T *

Definition at line 78 of file Vector.hpp.

## init_list

using init_list = typename std::initializer_list<T>

Definition at line 80 of file Vector.hpp.

## Constructor & Destructor Documentation

## Vector() [1/11]

Vector | ( |  | ) |

inline

Empty Vector.

Definition at line 101 of file Vector.hpp.

## Vector() [2/11]

Vector | ( | const word & | name | ) |

inlineexplicit

Empty Vector with a name.

Definition at line 109 of file Vector.hpp.

## Vector() [3/11]

Vector | ( | const word & | name,
|  | size_t | len
| ) |  |

inline

Vector with specified length and name.

Definition at line 117 of file Vector.hpp.

## Vector() [4/11]

Vector | ( | const word & | name,
|  | size_t | len,
|  | const T & | val
| ) |  |

inline

Vector with name, length and value.

Definition at line 125 of file Vector.hpp.

## Vector() [5/11]

Vector | ( | const word & | name,
|  | size_t | cap,
|  | size_t | len,
|  | RESERVE |
| ) |  |

inline

Vector with name, size and reserved capacity.

Definition at line 133 of file Vector.hpp.

## Vector() [6/11]

Vector | ( | const word & | name,
|  | const init_list & | l
| ) |  |

inline

Vector from name and initializer list.

Definition at line 143 of file Vector.hpp.

## Vector() [7/11]

Vector | ( | const word & | name,
|  | const vectorType & | src
| ) |  |

inline

Construct with a name and form std::vector (host memory)

Definition at line 150 of file Vector.hpp.

## Vector() [8/11]

Vector | ( | const word & | name,
|  | const vectorType & | src,
|  | size_t | cap
| ) |  |

inline

Construct with a name and form std::vector (host memory) and with a desired capacity.

Definition at line 158 of file Vector.hpp.

## Vector() [9/11]

Vector | ( | const VectorType & | src | ) |

inlinedefault

Copy construct.

## Vector() [10/11]

Vector | ( | const word & | name,
|  | const Vector< T > & | src
| ) |  |

inline

Copy from src with a new name.

Definition at line 169 of file Vector.hpp.

## Vector() [11/11]

Vector | ( | VectorType && | mv | ) |

defaultnoexcept

Move construct.

## ~Vector()

~Vector | ( |  | ) |

default

Destructor.

## Member Function Documentation

## TypeInfoTemplateNV111()

TypeInfoTemplateNV111 | ( | "Vector< T, Allocator >" | ,
|  | T | ,
|  | memoerySpaceName() |
| ) |  |

## operator=() [1/4]

VectorType& operator= | ( | const VectorType & | rhs | ) |

inlinedefault

Copy assignment.

## operator=() [2/4]

VectorType& operator= | ( | const vectorType & | rhs | ) |

inline

Copy assignment from std::vector.

Definition at line 178 of file Vector.hpp.

## operator=() [3/4]

VectorType& operator= | ( | VectorType && | mv | ) |

defaultnoexcept

Move assignment.

## operator=() [4/4]

void operator= | ( | const T & | val | ) |

inline

Scalar assignment.

Definition at line 191 of file Vector.hpp.

## clone()

uniquePtr<VectorType> clone | ( |  | ) | const

inline

Clone as a uniquePtr.

Definition at line 201 of file Vector.hpp.

## clonePtr()

VectorType* clonePtr | ( |  | ) | const

inline

Clone as a pointer.

Definition at line 207 of file Vector.hpp.

## VectorField() [1/2]

const VectorType& VectorField | ( |  | ) | const

inline

Access to this, mostly used by derived classes.

Definition at line 217 of file Vector.hpp.

## VectorField() [2/2]

VectorType& VectorField | ( |  | ) |

inline

Definition at line 222 of file Vector.hpp.

## vectorField() [1/2]

const vectorType& vectorField | ( |  | ) | const

inline

Definition at line 227 of file Vector.hpp.

Referenced by main(), Vector< word >::read(), and Vector< word >::write().

Here is the caller graph for this function:

## vectorField() [2/2]

vectorType& vectorField | ( |  | ) |

inline

Definition at line 232 of file Vector.hpp.

## deviceVectorAll() [1/2]

auto& deviceVectorAll | ( |  | ) |

inline

Definition at line 237 of file Vector.hpp.

## deviceVectorAll() [2/2]

const auto& deviceVectorAll | ( |  | ) | const

inline

Definition at line 242 of file Vector.hpp.

## deviceVector() [1/2]

auto& deviceVector | ( |  | ) |

inline

Definition at line 247 of file Vector.hpp.

## deviceVector() [2/2]

const auto& deviceVector | ( |  | ) | const

inline

Definition at line 252 of file Vector.hpp.

## name()

const word& name | ( |  | ) | const

inline

Name of the vector.

Definition at line 259 of file Vector.hpp.

Referenced by triSurface::append(), VectorSingle< word, HostSpace >::name(), and pFlow::pow().

Here is the caller graph for this function:

## size()

auto size | ( |  | ) | const

inline

Size of the vector.

Definition at line 265 of file Vector.hpp.

Referenced by symArray< nonLinearProperties >::assign(), VectorDual< multiRotatingAxis >::assign(), collisionCheck::build(), pFlow::convertToTriSurfaceComponents(), VectorDual< multiRotatingAxis >::deleteElement(), VectorSingle< word, HostSpace >::deviceView(), VectorSingle< word, HostSpace >::empty(), pFlow::fillSequence(), sphereParticles::getParticlesInfoFromShape(), grainParticles::getParticlesInfoFromShape(), Vector< word >::getSpan(), VectorSingle< word, HostSpace >::getSpan(), baseShapeNames::hashToIndex(), VectorSingle< word, HostSpace >::hostView(), MotionModel< rotatingAxisMotion, rotatingAxis >::impl_readDictionary(), Insertion< ShapeType >::insertParticles(), internalPoints::insertPoints(), VectorDual< multiRotatingAxis >::insertSetElement(), pFlow::max(), pFlow::min(), positionRandom::numPoints(), positionOrdered::numPoints(), Vector< word >::operator*=(), Vector< word >::operator+=(), Vector< word >::operator-=(), Vector< word >::operator/=(), positionRandom::positionOnePass(), pFlow::pow(), property::readDictionary(), sphereShape::readFromDictionary3(), grainShape::readFromDictionary3(), linear< limited >::readLinearDictionary(), cGRelativeLinear< limited >::readLinearDictionary(), cGAbsoluteLinear< limited >::readLinearDictionary(), nonLinear< limited >::readNonLinearDictionary(), nonLinearMod< limited >::readNonLinearDictionary(), positionRandom::size(), positionOrdered::size(), shapeMixture::size(), VectorSingle< word, HostSpace >::size(), pFlow::sum(), symArray< nonLinearProperties >::write(), and VectorDual< multiRotatingAxis >::write().

Here is the caller graph for this function:

## capacity()

auto capacity | ( |  | ) | const

inline

Capacity of the vector.

Definition at line 271 of file Vector.hpp.

Referenced by VectorSingle< word, HostSpace >::capacity(), VectorSingle< word, HostSpace >::deviceViewAll(), VectorSingle< word, HostSpace >::hostViewAll(), InsertionRegion< ShapeType >::insertParticles(), and pFlow::pow().

Here is the caller graph for this function:

## empty()

bool empty | ( |  | ) | const

inline

If vector is empty.

Definition at line 277 of file Vector.hpp.

Referenced by pFlow::selectedFieldVals().

Here is the caller graph for this function:

## reserve()

void reserve | ( | size_t | cap | ) |

inline

Reserve capacity for vector Preserve the content.

Definition at line 284 of file Vector.hpp.

Referenced by VectorSingle< word, HostSpace >::assign(), pFlow::convertToTriSurfaceComponents(), sphereParticles::getParticlesInfoFromShape(), grainParticles::getParticlesInfoFromShape(), InsertionRegion< ShapeType >::insertParticles(), VectorSingle< word, HostSpace >::reserve(), selectBox::selectAllPointsInBox(), selectorRandomPoints::selectAllPointsInRange(), selectorStridedRange::selectAllPointsInRange(), and Vector< word >::Vector().

Here is the caller graph for this function:

## fill() [1/2]

void fill | ( | const T & | val | ) |

inline

Definition at line 23 of file VectorI.hpp.

Referenced by geometry::createPropertyId(), VectorSingle< word, HostSpace >::fill(), and Vector< word >::operator=().

Here is the caller graph for this function:

## fill() [2/2]

void fill | ( | uint32 | start,
|  | uint32 | end,
|  | const T & | val
| ) |  |

inline

fill the content in range [start, end)

Definition at line 29 of file VectorI.hpp.

## getSpan() [1/2]

auto getSpan | ( |  | ) |

inline

Definition at line 296 of file Vector.hpp.

Referenced by triSurface::append().

Here is the caller graph for this function:

## getSpan() [2/2]

auto getSpan | ( |  | ) | const

inline

Definition at line 302 of file Vector.hpp.

## isHostAccessible()

static constexpr bool isHostAccessible | ( |  | ) |

inlinestaticconstexpr

Definition at line 307 of file Vector.hpp.

## operator+=() [1/2]

void operator+= | ( | const T & | val | ) |

inline

Definition at line 38 of file VectorI.hpp.

## operator-=() [1/2]

void operator-= | ( | const T & | val | ) |

inline

Definition at line 48 of file VectorI.hpp.

## operator*=() [1/2]

void operator*= | ( | const T & | val | ) |

inline

Definition at line 58 of file VectorI.hpp.

## operator/=() [1/2]

void operator/= | ( | const T & | val | ) |

inline

Definition at line 68 of file VectorI.hpp.

## operator+=() [2/2]

void operator+= | ( | const VectorType & | v | ) |

inline

Definition at line 78 of file VectorI.hpp.

## operator-=() [2/2]

void operator-= | ( | const VectorType & | v | ) |

inline

Definition at line 97 of file VectorI.hpp.

## operator/=() [2/2]

void operator/= | ( | const VectorType & | v | ) |

inline

Definition at line 135 of file VectorI.hpp.

## operator*=() [2/2]

void operator*= | ( | const VectorType & | v | ) |

inline

Definition at line 116 of file VectorI.hpp.

## operator-()

pFlow::Vector< T, Allocator > operator-

inline

Definition at line 155 of file VectorI.hpp.

## read() [1/2]

bool read | ( | iIstream & | is | ) |

inline

Definition at line 324 of file Vector.hpp.

Referenced by pFlow::operator>>(), symArray< nonLinearProperties >::read(), and VectorSingle< word, HostSpace >::read().

Here is the caller graph for this function:

## write() [1/2]

bool write | ( | iOstream & | os | ) | const

inline

Definition at line 328 of file Vector.hpp.

Referenced by pFlow::operator<<(), symArray< nonLinearProperties >::write(), VectorSingle< word, HostSpace >::write(), and VectorDual< multiRotatingAxis >::write().

Here is the caller graph for this function:

## read() [2/2]

bool read | ( | iIstream & | is,
|  | const IOPattern & | iop
| ) |  |

inline

Definition at line 333 of file Vector.hpp.

## write() [2/2]

bool write | ( | iOstream & | os,
|  | const IOPattern & | iop
| ) |  | const

inline

Definition at line 338 of file Vector.hpp.

## memoerySpaceName()

static constexpr const char* memoerySpaceName | ( |  | ) |

inlinestaticconstexpr

Definition at line 344 of file Vector.hpp.

## Member Data Documentation

## name_

word name_

private

Definition at line 85 of file Vector.hpp.

Referenced by Vector< word >::name().

## isHostAccessible_

constexpr bool isHostAccessible_ = true

staticconstexprprivate

Definition at line 88 of file Vector.hpp.

Referenced by Vector< word >::isHostAccessible().

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

- src/phasicFlow/containers/Vector/Vector.hpp
- src/phasicFlow/containers/Vector/VectorI.hpp