www.cemf.ir
VectorSingle< word, HostSpace > Class Reference
+ Inheritance diagram for VectorSingle< word, HostSpace >:
+ Collaboration diagram for VectorSingle< word, HostSpace >:

Public Types

using VectorType = VectorSingle< word, HostSpace >
 
using VectorTypeHost = VectorSingle< word, HostSpace >
 
using iterator = word *
 
using const_iterator = const word *
 
using reference = word &
 
using const_reference = const word &
 
using value_type = word
 
using pointer = word *
 
using const_pointer = const word *
 
using viewType = ViewType1D< word, HostSpace >
 
using device_type = typename viewType::device_type
 
using memory_space = typename viewType::memory_space
 
using execution_space = typename viewType::execution_space
 

Public Member Functions

 TypeInfoTemplateNV111 ("VectorSingle", word, memoerySpaceName())
 Type info. More...
 
 VectorSingle ()=default
 Empty vector. More...
 
 VectorSingle (const word &name)
 Empty vector with a name (capacity = 2) More...
 
 VectorSingle (const word &name, uint32 n)
 Vector with name and size n. More...
 
 VectorSingle (const word &name, uint32 n, const word &val)
 Vector with name, size and value. More...
 
 VectorSingle (const word &name, uint32 cap, uint32 n, const RESERVE &r)
 Vector with name, size (n) and reserved capacity. More...
 
 VectorSingle (const word &name, const std::vector< word > &src)
 Construct with a name and form std::vector (host memory) More...
 
 VectorSingle (const word &name, const std::vector< word > &src, uint32 cap)
 Construct with a name and form std::vector (host memory) and with a desired capacity. More...
 
 VectorSingle (const VectorSingle &src)=default
 Copy construct (performs deep copy) More...
 
 VectorSingle (const word &name, const VectorSingle &src)
 Copy construct with a new name (perform deep copy) More...
 
VectorSingleoperator= (const VectorSingle &rhs)=default
 Copy assignment (perform deep copy from rhs to *this) More...
 
 VectorSingle (VectorSingle &&)=default
 Move construct. More...
 
VectorSingleoperator= (VectorSingle &&)=default
 Move assignment. More...
 
 ~VectorSingle ()=default
 Descructor This may not destroy the underlying memory, sice view is shared_ptr and maybe referenced by another object too
More...
 
INLINE_FUNCTION_H uniquePtr< VectorSingleclone () const
 Clone as a uniquePtr (perform deep copy) More...
 
INLINE_FUNCTION_H VectorTypeVectorField ()
 Return *this. More...
 
const INLINE_FUNCTION_H VectorTypeVectorField () const
 Return *this. More...
 
INLINE_FUNCTION_H auto & deviceViewAll ()
 Device view range [0,capcity) More...
 
const INLINE_FUNCTION_H auto & deviceViewAll () const
 Device view range [0,capcity) More...
 
INLINE_FUNCTION_H auto deviceView () const
 Device view range [0, size) More...
 
INLINE_FUNCTION_H auto hostViewAll () const
 Return a view accessible on Host in range [0,capacity) More...
 
INLINE_FUNCTION_H auto hostView () const
 Return a view accessible on Host in range [0,size) More...
 
INLINE_FUNCTION_H word name () const
 Name of the vector. More...
 
INLINE_FUNCTION_H uint32 size () const
 Size of the vector. More...
 
INLINE_FUNCTION_H uint32 capacity () const
 
INLINE_FUNCTION_H bool empty () const
 If vector is empty. More...
 
INLINE_FUNCTION_H void reserve (uint32 cap)
 Reserve capacity for vector Preserve the content. More...
 
INLINE_FUNCTION_H void resize (uint32 n)
 Reallocate memory to new cap and set size to 0. More...
 
INLINE_FUNCTION_H void resize (uint32 n, const word &val)
 Resize the vector and assign the value to it. More...
 
INLINE_FUNCTION_H void clear ()
 Clear the vector, but keep the allocated memory unchanged. More...
 
INLINE_FUNCTION_H void fill (const word &val)
 Fill the range [0,size) with val. More...
 
INLINE_FUNCTION_H void fill (rangeU32 r, const word &val)
 
INLINE_FUNCTION_H void assign (size_t n, const word &val)
 Change size of the vector and assign val to vector and. More...
 
INLINE_FUNCTION_H void assign (const std::vector< word > &src, uint32 cap)
 Assign source vector with specified capacity. More...
 
INLINE_FUNCTION_H void assign (const std::vector< word > &src)
 Assign source vector. More...
 
INLINE_FUNCTION_H void assignFromHost (const VectorTypeHost &src)
 Assign source vector from host side. More...
 
INLINE_FUNCTION_H void assign (const VectorType &src, bool srcCapacity=true)
 
template<typename MSpace >
INLINE_FUNCTION_H void assignFromDevice (const VectorSingle< word, MSpace > &src, bool srcCapacity=true)
 
INLINE_FUNCTION_H auto getSpan ()
 
INLINE_FUNCTION_H auto getSpan () const
 
bool insertSetElement (const uint32IndexContainer &indices, const word &val)
 
bool insertSetElement (const uint32IndexContainer &indices, const std::vector< word > &vals)
 
bool insertSetElement (const uint32IndexContainer &indices, const ViewType1D< word, memory_space > vals)
 
INLINE_FUNCTION_H bool reorderItems (const uint32IndexContainer &indices)
 
void push_back (const word &val)
 push a new element at the end (host call only) resize if necessary and works on host accessible vector. More...
 
INLINE_FUNCTION_H pointer data ()
 
INLINE_FUNCTION_H const_pointer data () const
 
auto begin ()
 Return begin iterator. It works when devices is host accessible. More...
 
const auto begin () const
 Return begin iterator. it works when host is accessible. More...
 
auto end ()
 
const auto end () const
 Return end iterator. it works when host is accessible. More...
 
wordoperator[] (size_t i)
 Return reference to element i. it works when host is accessible.
More...
 
const wordoperator[] (size_t i) const
 
FUNCTION_H bool read (iIstream &is)
 Read vector from stream. More...
 
FUNCTION_H bool read (iIstream &is, const IOPattern &iop)
 Read vector from stream. More...
 
FUNCTION_H bool write (iOstream &os, const IOPattern &iop) const
 Write the vector to os. More...
 
FUNCTION_H bool write (iOstream &os) const
 
template<typename HostMask >
FUNCTION_H bool write (iOstream &os, const IOPattern &iop, const HostMask &mask) const
 

Static Public Member Functions

static constexpr const char * memoerySpaceName ()
 Name of the memory space. More...
 

Private Attributes

Vector< wordcontainer_
 
viewType unManagedView_
 

Static Private Attributes

static constexpr bool isHostAccessible_ = true
 Is the memory of this vector accessible from Host. More...
 
static constexpr bool isDeviceAccessible_ = false
 Is the memory of this vector accessiple from Divce. More...
 
static constexpr bool isTriviallyCopyable_ = false
 

Detailed Description

Definition at line 31 of file wordVectorHost.hpp.

Member Typedef Documentation

◆ VectorType

Definition at line 37 of file wordVectorHost.hpp.

◆ VectorTypeHost

Definition at line 39 of file wordVectorHost.hpp.

◆ iterator

using iterator = word*

Definition at line 41 of file wordVectorHost.hpp.

◆ const_iterator

using const_iterator = const word*

Definition at line 43 of file wordVectorHost.hpp.

◆ reference

using reference = word&

Definition at line 45 of file wordVectorHost.hpp.

◆ const_reference

using const_reference = const word&

Definition at line 47 of file wordVectorHost.hpp.

◆ value_type

using value_type = word

Definition at line 49 of file wordVectorHost.hpp.

◆ pointer

using pointer = word*

Definition at line 51 of file wordVectorHost.hpp.

◆ const_pointer

using const_pointer = const word*

Definition at line 53 of file wordVectorHost.hpp.

◆ viewType

Definition at line 57 of file wordVectorHost.hpp.

◆ device_type

using device_type = typename viewType::device_type

Definition at line 59 of file wordVectorHost.hpp.

◆ memory_space

using memory_space = typename viewType::memory_space

Definition at line 61 of file wordVectorHost.hpp.

◆ execution_space

using execution_space = typename viewType::execution_space

Definition at line 63 of file wordVectorHost.hpp.

Constructor & Destructor Documentation

◆ VectorSingle() [1/10]

VectorSingle ( )
default

Empty vector.

◆ VectorSingle() [2/10]

VectorSingle ( const word name)
inlineexplicit

Empty vector with a name (capacity = 2)

Definition at line 98 of file wordVectorHost.hpp.

◆ VectorSingle() [3/10]

VectorSingle ( const word name,
uint32  n 
)
inline

Vector with name and size n.

Definition at line 104 of file wordVectorHost.hpp.

◆ VectorSingle() [4/10]

VectorSingle ( const word name,
uint32  n,
const word val 
)
inline

Vector with name, size and value.

Definition at line 110 of file wordVectorHost.hpp.

◆ VectorSingle() [5/10]

VectorSingle ( const word name,
uint32  cap,
uint32  n,
const RESERVE r 
)
inline

Vector with name, size (n) and reserved capacity.

Definition at line 116 of file wordVectorHost.hpp.

◆ VectorSingle() [6/10]

VectorSingle ( const word name,
const std::vector< word > &  src 
)
inline

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

Definition at line 122 of file wordVectorHost.hpp.

◆ VectorSingle() [7/10]

VectorSingle ( const word name,
const std::vector< word > &  src,
uint32  cap 
)
inline

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

Definition at line 128 of file wordVectorHost.hpp.

◆ VectorSingle() [8/10]

VectorSingle ( const VectorSingle< word, HostSpace > &  src)
default

Copy construct (performs deep copy)

◆ VectorSingle() [9/10]

VectorSingle ( const word name,
const VectorSingle< word, HostSpace > &  src 
)
inline

Copy construct with a new name (perform deep copy)

Definition at line 137 of file wordVectorHost.hpp.

◆ VectorSingle() [10/10]

VectorSingle ( VectorSingle< word, HostSpace > &&  )
default

Move construct.

◆ ~VectorSingle()

~VectorSingle ( )
default

Descructor This may not destroy the underlying memory, sice view is shared_ptr and maybe referenced by another object too

Member Function Documentation

◆ TypeInfoTemplateNV111()

TypeInfoTemplateNV111 ( "VectorSingle< word, HostSpace >"  ,
word  ,
memoerySpaceName()   
)

Type info.

◆ operator=() [1/2]

VectorSingle& operator= ( const VectorSingle< word, HostSpace > &  rhs)
default

Copy assignment (perform deep copy from rhs to *this)

◆ operator=() [2/2]

VectorSingle& operator= ( VectorSingle< word, HostSpace > &&  )
default

Move assignment.

◆ clone()

INLINE_FUNCTION_H uniquePtr<VectorSingle> clone ( ) const
inline

Clone as a uniquePtr (perform deep copy)

Definition at line 159 of file wordVectorHost.hpp.

◆ VectorField() [1/2]

INLINE_FUNCTION_H VectorType& VectorField ( )
inline

Return *this.

Definition at line 169 of file wordVectorHost.hpp.

◆ VectorField() [2/2]

const INLINE_FUNCTION_H VectorType& VectorField ( ) const
inline

Return *this.

Definition at line 176 of file wordVectorHost.hpp.

◆ deviceViewAll() [1/2]

INLINE_FUNCTION_H auto& deviceViewAll ( )
inline

Device view range [0,capcity)

Definition at line 183 of file wordVectorHost.hpp.

References Vector< T, Allocator >::capacity().

+ Here is the call graph for this function:

◆ deviceViewAll() [2/2]

const INLINE_FUNCTION_H auto& deviceViewAll ( ) const
inline

Device view range [0,capcity)

Definition at line 192 of file wordVectorHost.hpp.

References Vector< T, Allocator >::capacity().

+ Here is the call graph for this function:

◆ deviceView()

INLINE_FUNCTION_H auto deviceView ( ) const
inline

Device view range [0, size)

Definition at line 201 of file wordVectorHost.hpp.

References Vector< T, Allocator >::size().

+ Here is the call graph for this function:

◆ hostViewAll()

INLINE_FUNCTION_H auto hostViewAll ( ) const
inline

Return a view accessible on Host in range [0,capacity)

Definition at line 208 of file wordVectorHost.hpp.

References Vector< T, Allocator >::capacity().

+ Here is the call graph for this function:

◆ hostView()

INLINE_FUNCTION_H auto hostView ( ) const
inline

Return a view accessible on Host in range [0,size)

Definition at line 216 of file wordVectorHost.hpp.

References Vector< T, Allocator >::size().

+ Here is the call graph for this function:

◆ name()

INLINE_FUNCTION_H word name ( ) const
inline

Name of the vector.

Definition at line 223 of file wordVectorHost.hpp.

References Vector< T, Allocator >::name().

+ Here is the call graph for this function:

◆ size()

INLINE_FUNCTION_H uint32 size ( ) const
inline

Size of the vector.

Definition at line 231 of file wordVectorHost.hpp.

References Vector< T, Allocator >::size().

Referenced by geometry::createPropertyId().

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

◆ capacity()

INLINE_FUNCTION_H uint32 capacity ( ) const
inline

Definition at line 239 of file wordVectorHost.hpp.

References Vector< T, Allocator >::capacity().

+ Here is the call graph for this function:

◆ empty()

INLINE_FUNCTION_H bool empty ( ) const
inline

If vector is empty.

Definition at line 246 of file wordVectorHost.hpp.

References Vector< T, Allocator >::size().

+ Here is the call graph for this function:

◆ reserve()

INLINE_FUNCTION_H void reserve ( uint32  cap)
inline

Reserve capacity for vector Preserve the content.

Definition at line 255 of file wordVectorHost.hpp.

References Vector< T, Allocator >::reserve().

+ Here is the call graph for this function:

◆ resize() [1/2]

INLINE_FUNCTION_H void resize ( uint32  n)
inline

Reallocate memory to new cap and set size to 0.

Resize the vector and preserve the content

Definition at line 271 of file wordVectorHost.hpp.

References n.

◆ resize() [2/2]

INLINE_FUNCTION_H void resize ( uint32  n,
const word val 
)
inline

Resize the vector and assign the value to it.

Definition at line 278 of file wordVectorHost.hpp.

References n.

◆ clear()

INLINE_FUNCTION_H void clear ( )
inline

Clear the vector, but keep the allocated memory unchanged.

Definition at line 285 of file wordVectorHost.hpp.

◆ fill() [1/2]

INLINE_FUNCTION_H void fill ( const word val)
inline

Fill the range [0,size) with val.

Definition at line 292 of file wordVectorHost.hpp.

References Vector< T, Allocator >::fill().

+ Here is the call graph for this function:

◆ fill() [2/2]

INLINE_FUNCTION_H void fill ( rangeU32  r,
const word val 
)
inline

Definition at line 298 of file wordVectorHost.hpp.

References Range< T >::end(), Vector< T, Allocator >::fill(), and Range< T >::start().

+ Here is the call graph for this function:

◆ assign() [1/4]

INLINE_FUNCTION_H void assign ( size_t  n,
const word val 
)
inline

Change size of the vector and assign val to vector and.

Definition at line 305 of file wordVectorHost.hpp.

References n.

◆ assign() [2/4]

INLINE_FUNCTION_H void assign ( const std::vector< word > &  src,
uint32  cap 
)
inline

Assign source vector with specified capacity.

The size of *this becomes the size of src.

Definition at line 313 of file wordVectorHost.hpp.

References VectorSingle< T, MemorySpace >::assign(), and Vector< T, Allocator >::reserve().

+ Here is the call graph for this function:

◆ assign() [3/4]

INLINE_FUNCTION_H void assign ( const std::vector< word > &  src)
inline

Assign source vector.

The size of *this becomes the size of src. The capacity of *this becomes the capacity of src.

Definition at line 324 of file wordVectorHost.hpp.

◆ assignFromHost()

INLINE_FUNCTION_H void assignFromHost ( const VectorTypeHost src)
inline

Assign source vector from host side.

The size of *this becomes the size of src. The capacity of *this becomes the capacity of src.

Definition at line 333 of file wordVectorHost.hpp.

References fatalExit, and notImplementedFunction.

◆ assign() [4/4]

INLINE_FUNCTION_H void assign ( const VectorType src,
bool  srcCapacity = true 
)
inline

Definition at line 340 of file wordVectorHost.hpp.

References fatalExit, and notImplementedFunction.

◆ assignFromDevice()

INLINE_FUNCTION_H void assignFromDevice ( const VectorSingle< word, MSpace > &  src,
bool  srcCapacity = true 
)
inline

Definition at line 348 of file wordVectorHost.hpp.

References fatalExit, and notImplementedFunction.

◆ getSpan() [1/2]

INLINE_FUNCTION_H auto getSpan ( )
inline

Definition at line 364 of file wordVectorHost.hpp.

References Vector< T, Allocator >::size().

+ Here is the call graph for this function:

◆ getSpan() [2/2]

INLINE_FUNCTION_H auto getSpan ( ) const
inline

Definition at line 370 of file wordVectorHost.hpp.

References Vector< T, Allocator >::size().

+ Here is the call graph for this function:

◆ insertSetElement() [1/3]

bool insertSetElement ( const uint32IndexContainer indices,
const word val 
)

◆ insertSetElement() [2/3]

bool insertSetElement ( const uint32IndexContainer indices,
const std::vector< word > &  vals 
)

◆ insertSetElement() [3/3]

bool insertSetElement ( const uint32IndexContainer indices,
const ViewType1D< word, memory_space vals 
)

◆ reorderItems()

INLINE_FUNCTION_H bool reorderItems ( const uint32IndexContainer indices)
inline

Definition at line 391 of file wordVectorHost.hpp.

References notImplementedFunction.

◆ push_back()

void push_back ( const word val)
inline

push a new element at the end (host call only) resize if necessary and works on host accessible vector.

Definition at line 400 of file wordVectorHost.hpp.

◆ data() [1/2]

INLINE_FUNCTION_H pointer data ( )
inline

Definition at line 406 of file wordVectorHost.hpp.

◆ data() [2/2]

INLINE_FUNCTION_H const_pointer data ( ) const
inline

Definition at line 411 of file wordVectorHost.hpp.

◆ begin() [1/2]

auto begin ( )
inline

Return begin iterator. It works when devices is host accessible.

Definition at line 417 of file wordVectorHost.hpp.

◆ begin() [2/2]

const auto begin ( ) const
inline

Return begin iterator. it works when host is accessible.

Definition at line 423 of file wordVectorHost.hpp.

◆ end() [1/2]

auto end ( )
inline

Definition at line 427 of file wordVectorHost.hpp.

◆ end() [2/2]

const auto end ( ) const
inline

Return end iterator. it works when host is accessible.

Definition at line 432 of file wordVectorHost.hpp.

◆ operator[]() [1/2]

word& operator[] ( size_t  i)
inline

Return reference to element i. it works when host is accessible.

Definition at line 437 of file wordVectorHost.hpp.

◆ operator[]() [2/2]

const word& operator[] ( size_t  i) const
inline

Definition at line 441 of file wordVectorHost.hpp.

◆ read() [1/2]

FUNCTION_H bool read ( iIstream is)
inline

Read vector from stream.

Definition at line 449 of file wordVectorHost.hpp.

References Vector< T, Allocator >::read().

Referenced by pFlow::operator>>().

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

◆ read() [2/2]

FUNCTION_H bool read ( iIstream is,
const IOPattern iop 
)
inline

Read vector from stream.

Definition at line 456 of file wordVectorHost.hpp.

References Vector< T, Allocator >::read().

+ Here is the call graph for this function:

◆ write() [1/3]

FUNCTION_H bool write ( iOstream os,
const IOPattern iop 
) const
inline

Write the vector to os.

Definition at line 463 of file wordVectorHost.hpp.

References Vector< T, Allocator >::write().

Referenced by pFlow::operator<<().

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

◆ write() [2/3]

FUNCTION_H bool write ( iOstream os) const
inline

Definition at line 469 of file wordVectorHost.hpp.

References Vector< T, Allocator >::write().

+ Here is the call graph for this function:

◆ write() [3/3]

FUNCTION_H bool write ( iOstream os,
const IOPattern iop,
const HostMask &  mask 
) const
inline

Definition at line 476 of file wordVectorHost.hpp.

References notImplementedFunction.

◆ memoerySpaceName()

static constexpr const char* memoerySpaceName ( )
inlinestaticconstexpr

Name of the memory space.

Definition at line 485 of file wordVectorHost.hpp.

Member Data Documentation

◆ container_

Vector<word> container_
private

Definition at line 69 of file wordVectorHost.hpp.

◆ unManagedView_

viewType unManagedView_
mutableprivate

Definition at line 71 of file wordVectorHost.hpp.

◆ isHostAccessible_

constexpr bool isHostAccessible_ = true
staticconstexprprivate

Is the memory of this vector accessible from Host.

Definition at line 77 of file wordVectorHost.hpp.

◆ isDeviceAccessible_

constexpr bool isDeviceAccessible_ = false
staticconstexprprivate

Is the memory of this vector accessiple from Divce.

Definition at line 81 of file wordVectorHost.hpp.

◆ isTriviallyCopyable_

constexpr bool isTriviallyCopyable_ = false
staticconstexprprivate

Definition at line 84 of file wordVectorHost.hpp.


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