Go to the documentation of this file.
20 #ifndef __wordVectorHost_hpp__
21 #define __wordVectorHost_hpp__
112 container_(
name,
n, val)
118 container_(
name, cap,
n, r)
124 container_(
name, src)
130 container_(
name, src, cap)
139 container_(
name, src.container_)
161 return makeUnique<VectorSingle>(*
this);
187 return unManagedView_;
196 return unManagedView_;
225 return container_.
name();
233 return container_.
size();
248 return container_.
size()==0uL;
273 container_.resize(
n);
280 container_.resize(
n, val);
294 container_.
fill(val);
307 container_.assign(
n, val);
324 void assign(
const std::vector<word>& src)
326 container_.assign(src.begin(), src.end());
346 template<
typename MSpace>
402 container_.push_back(val);
407 return container_.data();
412 return container_.data();
418 return container_.begin();
424 return container_.begin();
428 return container_.end();
433 return container_.end();
438 return container_[i];
442 return container_[i];
451 return container_.
read(is);
458 return container_.
read(is, iop);
465 return container_.
write(os, iop);
471 return container_.
write(os);
474 template<
typename HostMask>
487 return memory_space::name();
505 if( !ovec.
write(os) )
#define notImplementedFunction
Report that a function is yet not implemented.
INLINE_FUNCTION_H pointer data()
INLINE_FUNCTION_H void fill(rangeU32 r, const word &val)
INLINE_FUNCTION_H VectorType & VectorField()
Return *this.
const word * const_pointer
INLINE_FUNCTION_H bool empty() const
If vector is empty.
typename viewType::execution_space execution_space
#define fatalExit
Fatal exit.
const INLINE_FUNCTION_H VectorType & VectorField() const
Return *this.
FUNCTION_H bool read(iIstream &is, const IOPattern &iop)
Read vector from stream.
VectorSingle()
Empty vector.
auto begin()
Return begin iterator. It works when devices is host accessible.
INLINE_FUNCTION_H auto getSpan() const
INLINE_FUNCTION_HD T & end()
End.
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.
INLINE_FUNCTION_H void assign(const VectorType &src, bool srcCapacity=true)
void reserve(size_t cap)
Reserve capacity for vector Preserve the content.
const auto end() const
Return end iterator. it works when host is accessible.
INLINE_FUNCTION_H uint32 capacity() const
INLINE_FUNCTION_H void reserve(uint32 cap)
Reserve capacity for vector Preserve the content.
VectorSingle(const word &name, const std::vector< word > &src)
Construct with a name and form std::vector (host memory)
INLINE_FUNCTION_HD T & start()
Start.
INLINE_FUNCTION_H void resize(uint32 n)
Reallocate memory to new cap and set size to 0.
FUNCTION_H bool write(iOstream &os) const
INLINE_FUNCTION_H uint32 size() const
Size of the vector.
auto size() const
Size of the vector.
INLINE_FUNCTION_H void assign(const std::vector< word > &src, uint32 cap)
Assign source vector with specified capacity.
const auto begin() const
Return begin iterator. it works when host is accessible.
INLINE_FUNCTION_H void assignFromDevice(const VectorSingle< word, MSpace > &src, bool srcCapacity=true)
void push_back(const word &val)
push a new element at the end (host call only) resize if necessary and works on host accessible vecto...
Kokkos::HostSpace HostSpace
Host memory space.
INLINE_FUNCTION_H const_pointer data() const
ViewType1D< word, HostSpace > viewType
INLINE_FUNCTION_H auto & deviceViewAll()
Device view range [0,capcity)
typename viewType::device_type device_type
INLINE_FUNCTION_H word name() const
Name of the vector.
const word & operator[](size_t i) const
typename viewType::memory_space memory_space
Interface class for any input stream
~VectorSingle()
Descructor This may not destroy the underlying memory, sice view is shared_ptr and maybe referenced b...
INLINE_FUNCTION_H uniquePtr< VectorSingle > clone() const
Clone as a uniquePtr (perform deep copy)
VectorSingle(const word &name)
Empty vector with a name (capacity = 2)
auto capacity() const
Capacity of the vector.
INLINE_FUNCTION_H void resize(uint32 n, const word &val)
Resize the vector and assign the value to it.
TypeInfoTemplateNV111("VectorSingle", T, memoerySpaceName())
Type info.
VectorSingle(const word &name, const VectorSingle &src)
Copy construct with a new name (perform deep copy)
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
INLINE_FUNCTION_H bool reorderItems(const uint32IndexContainer &indices)
#define INLINE_FUNCTION_H
const INLINE_FUNCTION_H auto & deviceViewAll() const
Device view range [0,capcity)
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
INLINE_FUNCTION_H word name() const
Name of the vector.
VectorSingle(const word &name, uint32 n, const word &val)
Vector with name, size and value.
INLINE_FUNCTION_H auto getSpan()
virtual const word & name() const
Return the name of the stream.
static constexpr bool isDeviceAccessible_
Is the memory of this vector accessiple from Divce.
Kokkos::View< T *, properties... > ViewType1D
1D veiw as a vector
bool write(iOstream &os) const
word & operator[](size_t i)
Return reference to element i. it works when host is accessible.
INLINE_FUNCTION_H void assign(size_t n, const word &val)
Change size of the vector and assign val to vector and.
static constexpr const char * memoerySpaceName()
Name of the memory space.
INLINE_FUNCTION_H void assign(size_t n, const T &val)
Change size of the vector and assign val to vector and.
INLINE_FUNCTION_H auto deviceView() const
Device view range [0, size)
const word & name() const
Name of the vector.
INLINE_FUNCTION_H auto hostView() const
Return a view accessible on Host in range [0,size)
INLINE_FUNCTION_H void clear()
Clear the vector, but keep the allocated memory unchanged.
#define ioErrorInFile(fileName, lineNumber)
Report an error in file operation with supplied fileName and lineNumber.
VectorSingle(const word &name, uint32 cap, uint32 n, const RESERVE &r)
Vector with name, size (n) and reserved capacity.
int32 lineNumber() const
Const access to the current stream line number.
const word * const_iterator
static constexpr const char * memoerySpaceName()
Name of the memory space.
FUNCTION_H bool write(iOstream &os, const IOPattern &iop, const HostMask &mask) const
const word & const_reference
static constexpr bool isHostAccessible_
Is the memory of this vector accessible from Host.
VectorSingle & operator=(const VectorSingle &rhs)
Copy assignment (perform deep copy from rhs to *this)
Vector< word > container_
Interface class for any output stream.
INLINE_FUNCTION_H void assign(const std::vector< word > &src)
Assign source vector.
static constexpr bool isTriviallyCopyable_
INLINE_FUNCTION_H void assignFromHost(const VectorTypeHost &src)
Assign source vector from host side.
INLINE_FUNCTION_H bool insertSetElement(const uint32IndexContainer &indices, const T &val)
INLINE_FUNCTION_H void fill(const word &val)
Fill the range [0,size) with val.
It holds two vectors of indecis on Host and Device.
FUNCTION_H bool write(iOstream &os, const IOPattern &iop) const
Write the vector to os.
VectorSingle(const word &name, uint32 n)
Vector with name and size n.
ViewType1D< T, MemorySpace > viewType
FUNCTION_H bool read(iIstream &is)
Read vector from stream.
INLINE_FUNCTION_H auto hostViewAll() const
Return a view accessible on Host in range [0,capacity)