Newer
Older
/***************************************************************************
EllpackIndexMultimapValues.h - description
-------------------
begin : Sep 10, 2015
copyright : (C) 2015 by Tomas Oberhuber et al.
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/* See Copyright Notice in tnl/Copyright */
Jakub Klinkovský
committed
#include <type_traits>
Tomáš Oberhuber
committed
#include <ostream>
#include <TNL/Devices/Cuda.h>
namespace Containers {
namespace Multimaps {
typename LocalIndex,
int SliceSize >
class EllpackIndexMultimap;
template< typename Index,
typename Device,
typename LocalIndex,
int step = 1 >
class EllpackIndexMultimapValues
using DeviceType = Device;
using IndexType = Index;
using LocalIndexType = LocalIndex;
using NetworkType = EllpackIndexMultimap< IndexType, DeviceType, LocalIndexType, step >;
EllpackIndexMultimapValues();
EllpackIndexMultimapValues( EllpackIndexMultimapValues&& other );
Jakub Klinkovský
committed
EllpackIndexMultimapValues& operator=( const EllpackIndexMultimapValues& );
Jakub Klinkovský
committed
// converting assignment, needed for 'const int' -> 'int' etc.
template< typename Index_, typename LocalIndex_, int step_ >
__cuda_callable__
EllpackIndexMultimapValues& operator=( const EllpackIndexMultimapValues< Index_, Device, LocalIndex_, step_ >& other );
EllpackIndexMultimapValues& operator=( EllpackIndexMultimapValues&& other );
Jakub Klinkovský
committed
void bind( const EllpackIndexMultimapValues& other );
void setSize( const LocalIndexType& portsCount );
Jakub Klinkovský
committed
LocalIndexType getSize() const;
Jakub Klinkovský
committed
LocalIndexType getAllocatedSize() const;
Jakub Klinkovský
committed
void setValue( const LocalIndexType& portIndex,
const IndexType& value );
Jakub Klinkovský
committed
IndexType getValue( const LocalIndexType& portIndex ) const;
IndexType& operator[]( const LocalIndexType& portIndex );
const IndexType& operator[]( const LocalIndexType& portIndex ) const;
bool operator==( const EllpackIndexMultimapValues& other ) const;
bool operator!=( const EllpackIndexMultimapValues& other ) const;
Jakub Klinkovský
committed
Jakub Klinkovský
committed
using ValuesCountType = typename std::conditional< std::is_const< IndexType >::value,
Jakub Klinkovský
committed
LocalIndexType >::type;
Jakub Klinkovský
committed
EllpackIndexMultimapValues( IndexType* values,
Jakub Klinkovský
committed
const LocalIndexType& allocatedSize );
Jakub Klinkovský
committed
IndexType* values;
Jakub Klinkovský
committed
ValuesCountType* valuesCount;
Jakub Klinkovský
committed
Jakub Klinkovský
committed
// TODO: this is useless for a const-accessor (without setSize etc.)
Jakub Klinkovský
committed
LocalIndexType allocatedSize;
friend EllpackIndexMultimap< IndexType, DeviceType, LocalIndexType, step >;
friend EllpackIndexMultimap< typename std::remove_const< IndexType >::type, DeviceType, LocalIndexType, step >;
Tomáš Oberhuber
committed
template< typename Index,
typename LocalIndex,
int step >
std::ostream& operator << ( std::ostream& str, const EllpackIndexMultimapValues< Index, Device, LocalIndex, step >& ports );
Tomáš Oberhuber
committed
} // namespace Multimaps
} // namespace Containers
#include <TNL/Containers/Multimaps/EllpackIndexMultimapValues.hpp>