DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::host_device_vector_r1< T > Class Template Reference

Host + optional device vector of trivially copyable T. More...

#include <Vector.hpp>

Inheritance diagram for DNDS::host_device_vector_r1< T >:
[legend]
Collaboration diagram for DNDS::host_device_vector_r1< T >:
[legend]

Public Types

template<DeviceBackend B, typename TSize = int64_t>
using t_deviceView = vector_DeviceView< B, T, TSize >
 

Public Member Functions

DNDS_HOST host_device_vector_r1 ()=default
 
DNDS_HOST host_device_vector_r1 (size_t n)
 
template<class TFill >
DNDS_HOST host_device_vector_r1 (size_t n, TFill &&val)
 
DNDS_HOST t_self & operator= (const std::vector< T > &v)
 
DNDS_HOST host_device_vector_r1 (const std::vector< T > &v)
 
DNDS_HOST size_t size () const
 
DNDS_HOST void resize (size_t new_size)
 
template<class TFill >
DNDS_HOST void resize (size_t new_size, TFill &&fill)
 
DNDS_HOST void create_device_data (DeviceBackend B)
 
DNDS_HOST T * data ()
 
DNDS_HOST const T * data () const
 
DNDS_HOST T * dataDevice ()
 
DNDS_HOST const T * dataDevice () const
 
DNDS_HOST auto begin ()
 
DNDS_HOST auto end ()
 
DNDS_HOST auto begin () const
 
DNDS_HOST auto end () const
 
DNDS_HOST auto cbegin () const
 
DNDS_HOST auto cend () const
 
DNDS_HOST operator std::vector< T > () const
 
DNDS_HOST void to_device (DeviceBackend backend=DeviceBackend::Host)
 
DNDS_HOST void clear_device ()
 
DNDS_HOST void clear ()
 
DNDS_HOST void to_host ()
 
template<DeviceBackend B, typename TSize = int64_t>
t_deviceView< B, TSizedeviceView ()
 
t_self & operator= (const t_self &R)
 
 host_device_vector_r1 (const t_self &R)
 
DeviceBackend device ()
 
DNDS_HOST void swap (t_self &R) noexcept
 
- Public Member Functions inherited from DNDS::data_vector_base< T, host_device_vector_r1< T > >
T & operator[] (size_t i)
 
const T & operator[] (size_t i) const
 
const T & at (size_t i) const
 
T & at (size_t i)
 

Detailed Description

template<typename T>
class DNDS::host_device_vector_r1< T >

Host + optional device vector of trivially copyable T.

Primary storage type used inside Array. Always maintains a host copy; on demand, a device mirror can be created via to_device. Many "vector-like" std::vector operations (resize, assign, operator[]) have been reimplemented so the class can be used as a drop-in replacement in DNDSR code paths that need device-awareness.

Use the variant host_device_vector (a thin alias below) to pick up the appropriate specialisation based on element type.

Definition at line 216 of file Vector.hpp.

Member Typedef Documentation

◆ t_deviceView

template<typename T >
template<DeviceBackend B, typename TSize = int64_t>
using DNDS::host_device_vector_r1< T >::t_deviceView = vector_DeviceView<B, T, TSize>

Definition at line 349 of file Vector.hpp.

Constructor & Destructor Documentation

◆ host_device_vector_r1() [1/5]

template<typename T >
DNDS_HOST DNDS::host_device_vector_r1< T >::host_device_vector_r1 ( )
default

◆ host_device_vector_r1() [2/5]

template<typename T >
DNDS_HOST DNDS::host_device_vector_r1< T >::host_device_vector_r1 ( size_t  n)
inline

Definition at line 242 of file Vector.hpp.

Here is the call graph for this function:

◆ host_device_vector_r1() [3/5]

template<typename T >
template<class TFill >
DNDS_HOST DNDS::host_device_vector_r1< T >::host_device_vector_r1 ( size_t  n,
TFill &&  val 
)
inline

Definition at line 248 of file Vector.hpp.

Here is the call graph for this function:

◆ host_device_vector_r1() [4/5]

template<typename T >
DNDS_HOST DNDS::host_device_vector_r1< T >::host_device_vector_r1 ( const std::vector< T > &  v)
inline

Definition at line 261 of file Vector.hpp.

Here is the call graph for this function:

◆ host_device_vector_r1() [5/5]

template<typename T >
DNDS::host_device_vector_r1< T >::host_device_vector_r1 ( const t_self &  R)
inline

the cloned host "device" has no idea where new data reference is use to_device to sync it

Definition at line 377 of file Vector.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

template<typename T >
DNDS_HOST auto DNDS::host_device_vector_r1< T >::begin ( )
inline

Definition at line 296 of file Vector.hpp.

Here is the caller graph for this function:

◆ begin() [2/2]

template<typename T >
DNDS_HOST auto DNDS::host_device_vector_r1< T >::begin ( ) const
inline

Definition at line 298 of file Vector.hpp.

◆ cbegin()

template<typename T >
DNDS_HOST auto DNDS::host_device_vector_r1< T >::cbegin ( ) const
inline

Definition at line 301 of file Vector.hpp.

◆ cend()

template<typename T >
DNDS_HOST auto DNDS::host_device_vector_r1< T >::cend ( ) const
inline

Definition at line 302 of file Vector.hpp.

◆ clear()

template<typename T >
DNDS_HOST void DNDS::host_device_vector_r1< T >::clear ( )
inline

Definition at line 331 of file Vector.hpp.

Here is the call graph for this function:

◆ clear_device()

template<typename T >
DNDS_HOST void DNDS::host_device_vector_r1< T >::clear_device ( )
inline

Definition at line 324 of file Vector.hpp.

Here is the caller graph for this function:

◆ create_device_data()

template<typename T >
DNDS_HOST void DNDS::host_device_vector_r1< T >::create_device_data ( DeviceBackend  B)
inline

Definition at line 283 of file Vector.hpp.

Here is the caller graph for this function:

◆ data() [1/2]

template<typename T >
DNDS_HOST T * DNDS::host_device_vector_r1< T >::data ( )
inline

Definition at line 290 of file Vector.hpp.

Here is the caller graph for this function:

◆ data() [2/2]

template<typename T >
DNDS_HOST const T * DNDS::host_device_vector_r1< T >::data ( ) const
inline

Definition at line 291 of file Vector.hpp.

◆ dataDevice() [1/2]

template<typename T >
DNDS_HOST T * DNDS::host_device_vector_r1< T >::dataDevice ( )
inline

Definition at line 293 of file Vector.hpp.

Here is the caller graph for this function:

◆ dataDevice() [2/2]

template<typename T >
DNDS_HOST const T * DNDS::host_device_vector_r1< T >::dataDevice ( ) const
inline

Definition at line 294 of file Vector.hpp.

◆ device()

template<typename T >
DeviceBackend DNDS::host_device_vector_r1< T >::device ( )
inline

Definition at line 390 of file Vector.hpp.

Here is the caller graph for this function:

◆ deviceView()

template<typename T >
template<DeviceBackend B, typename TSize = int64_t>
t_deviceView< B, TSize > DNDS::host_device_vector_r1< T >::deviceView ( )
inline

Definition at line 351 of file Vector.hpp.

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

◆ end() [1/2]

template<typename T >
DNDS_HOST auto DNDS::host_device_vector_r1< T >::end ( )
inline

Definition at line 297 of file Vector.hpp.

Here is the caller graph for this function:

◆ end() [2/2]

template<typename T >
DNDS_HOST auto DNDS::host_device_vector_r1< T >::end ( ) const
inline

Definition at line 299 of file Vector.hpp.

◆ operator std::vector< T >()

template<typename T >
DNDS_HOST DNDS::host_device_vector_r1< T >::operator std::vector< T > ( ) const
inlineexplicit

Definition at line 304 of file Vector.hpp.

◆ operator=() [1/2]

template<typename T >
DNDS_HOST t_self & DNDS::host_device_vector_r1< T >::operator= ( const std::vector< T > &  v)
inline

Definition at line 254 of file Vector.hpp.

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

◆ operator=() [2/2]

template<typename T >
t_self & DNDS::host_device_vector_r1< T >::operator= ( const t_self &  R)
inline

the cloned host "device" has no idea where new data reference is use to_device to sync it

Definition at line 361 of file Vector.hpp.

Here is the call graph for this function:

◆ resize() [1/2]

template<typename T >
DNDS_HOST void DNDS::host_device_vector_r1< T >::resize ( size_t  new_size)
inline

Definition at line 268 of file Vector.hpp.

Here is the caller graph for this function:

◆ resize() [2/2]

template<typename T >
template<class TFill >
DNDS_HOST void DNDS::host_device_vector_r1< T >::resize ( size_t  new_size,
TFill &&  fill 
)
inline

Definition at line 277 of file Vector.hpp.

Here is the call graph for this function:

◆ size()

template<typename T >
DNDS_HOST size_t DNDS::host_device_vector_r1< T >::size ( ) const
inline

Definition at line 266 of file Vector.hpp.

Here is the caller graph for this function:

◆ swap()

template<typename T >
DNDS_HOST void DNDS::host_device_vector_r1< T >::swap ( t_self &  R)
inlinenoexcept

Definition at line 395 of file Vector.hpp.

◆ to_device()

template<typename T >
DNDS_HOST void DNDS::host_device_vector_r1< T >::to_device ( DeviceBackend  backend = DeviceBackend::Host)
inline

Definition at line 312 of file Vector.hpp.

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

◆ to_host()

template<typename T >
DNDS_HOST void DNDS::host_device_vector_r1< T >::to_host ( )
inline

Definition at line 339 of file Vector.hpp.

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

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