Inviwo  0.9.10.1
Inviwo documentation
inviwo::discretedata::BufferChannel< T, N > Class Template Reference

Data channel as array data. More...

#include <bufferchannel.h>

+ Inheritance diagram for inviwo::discretedata::BufferChannel< T, N >:

Public Member Functions

 BufferChannel (ind numElements, const std::string &name, GridPrimitive definedOn=GridPrimitive::Vertex)
 Direct construction, empty data. More...
 
 BufferChannel (const std::vector< T > &rawData, const std::string &name, GridPrimitive definedOn=GridPrimitive::Vertex)
 Direct construction. More...
 
 BufferChannel (std::vector< T > &&data, const std::string &name, GridPrimitive definedOn=GridPrimitive::Vertex)
 Direct construction. More...
 
 BufferChannel (T *const data, ind numElements, const std::string &name, GridPrimitive definedOn=GridPrimitive::Vertex)
 Direct construction. More...
 
virtual ind size () const override
 
const std::vector< T > & data () const
 
DefaultVec & operator[] (ind index)
 Indexed point access. More...
 
const DefaultVec & operator[] (ind index) const
 Indexed point access. More...
 
template<typename VecNT = DefaultVec>
VecNT & get (ind index)
 Indexed point access. More...
 
template<typename VecNT = DefaultVec>
const VecNT & get (ind index) const
 Indexed point access. More...
 
- Public Member Functions inherited from inviwo::discretedata::DataChannel< T, N >
 DataChannel (const std::string &name, GridPrimitive definedOn=GridPrimitive::Vertex)
 Direct construction. More...
 
template<typename VecNT >
void fill (VecNT &dest, ind index) const
 Indexed point access, copy data Thread safe. More...
 
template<typename VecNT >
void operator() (VecNT &dest, ind index) const
 
template<typename VecNT = DefaultVec>
iterator< VecNT > begin ()
 
template<typename VecNT = DefaultVec>
iterator< VecNT > end ()
 
template<typename VecNT = DefaultVec>
const_iterator< VecNT > begin () const
 
template<typename VecNT = DefaultVec>
const_iterator< VecNT > end () const
 
template<typename VecNT = DefaultVec>
ChannelRange< VecNT > all ()
 Get iterator range Templated iterator return type, only specified once. More...
 
template<typename VecNT = DefaultVec>
ConstChannelRange< VecNT > all () const
 Get const iterator range Templated iterator return type, only specified once. More...
 
template<typename VecNT >
void getMin (VecNT &dest) const
 
template<typename VecNT >
void getMax (VecNT &dest) const
 
template<typename VecNT >
void getMinMax (VecNT &min, VecNT &max) const
 
- Public Member Functions inherited from inviwo::discretedata::BaseChannel< T, N >
 BaseChannel (const std::string &name, DataFormatId dataFormat, GridPrimitive definedOn=GridPrimitive::Vertex)
 
- Public Member Functions inherited from inviwo::discretedata::Channel
 Channel (ind numComponents, const std::string &name, DataFormatId dataFormat, GridPrimitive definedOn=GridPrimitive::Vertex)
 Direct construction. More...
 
const std::string getName () const
 
void setName (const std::string &)
 
GridPrimitive getGridPrimitiveType () const
 
DataFormatId getDataFormatId () const
 
ind getNumComponents () const
 
- Public Member Functions inherited from inviwo::MetaDataOwner
 MetaDataOwner (const MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (const MetaDataOwner &rhs)=default
 
void copyMetaDataFrom (const MetaDataOwner &src)
 
void copyMetaDataTo (MetaDataOwner &dst)
 
template<typename T >
T * createMetaData (const std::string &key)
 
template<typename T , typename U >
void setMetaData (const std::string &key, U value)
 
template<typename T >
bool unsetMetaData (const std::string &key)
 unset, i.e. remove the metadata entry matching the given key and type More...
 
template<typename T , typename U >
getMetaData (const std::string &key, U val) const
 
template<typename T >
T * getMetaData (const std::string &key)
 
template<typename T >
const T * getMetaData (const std::string &key) const
 
MetaDataMapgetMetaDataMap ()
 
const MetaDataMapgetMetaDataMap () const
 
template<typename T >
bool hasMetaData (const std::string &key) const
 
virtual void serialize (Serializer &s) const
 
virtual void deserialize (Deserializer &d)
 

Protected Member Functions

virtual BufferGetter< BufferChannel< T, N > > * newIterator () override
 
virtual void fillRaw (T *dest, ind index) const override
 Indexed point access, constant. More...
 
- Protected Member Functions inherited from inviwo::discretedata::DataChannel< T, N >
void computeMinMax () const
 
- Protected Member Functions inherited from inviwo::discretedata::Channel
void setGridPrimitiveType (GridPrimitive)
 
void setDataFormatId (DataFormatId)
 
void setNumComponents (ind)
 

Protected Attributes

std::vector< T > buffer_
 Vector containing the buffer data Resizeable only by DataSet. Handle with care: Resize invalidates pointers to memory, but iterators remain valid.
 
- Protected Attributes inherited from inviwo::MetaDataOwner
MetaDataMap metaData_
 

Friends

class DataSet
 
struct BufferGetter< BufferChannel >
 

Additional Inherited Members

- Public Types inherited from inviwo::discretedata::DataChannel< T, N >
using value_type = T
 
template<typename VecNT >
using iterator = ChannelIterator< VecNT, T, N >
 
template<typename VecNT = T>
using const_iterator = ConstChannelIterator< DataChannel< T, N >, VecNT >
 
using DefaultVec = typename std::conditional<(N<=4), typename inviwo::util::glmtype< T, N >::type, std::array< T, N > >::type
 
- Static Public Attributes inherited from inviwo::discretedata::DataChannel< T, N >
static constexpr ind num_comp = N
 

Detailed Description

template<typename T, ind N = 1>
class inviwo::discretedata::BufferChannel< T, N >

Data channel as array data.

Data block with a size of NumDataPoints * NumComponents. The buffer is not constant, copy to change.

Author
Anke Friederici and Tino Weinkauf

Constructor & Destructor Documentation

◆ BufferChannel() [1/4]

template<typename T , ind N = 1>
inviwo::discretedata::BufferChannel< T, N >::BufferChannel ( ind  numElements,
const std::string &  name,
GridPrimitive  definedOn = GridPrimitive::Vertex 
)
inline

Direct construction, empty data.

Parameters
numElementsTotal number of indexed positions
nameName associated with the channel
definedOnGridPrimitive the data is defined on, default: 0D vertices

◆ BufferChannel() [2/4]

template<typename T , ind N = 1>
inviwo::discretedata::BufferChannel< T, N >::BufferChannel ( const std::vector< T > &  rawData,
const std::string &  name,
GridPrimitive  definedOn = GridPrimitive::Vertex 
)
inline

Direct construction.

Parameters
rawDataRaw data, copy values
nameName associated with the channel
definedOnGridPrimitive the data is defined on, default: 0D vertices

◆ BufferChannel() [3/4]

template<typename T , ind N = 1>
inviwo::discretedata::BufferChannel< T, N >::BufferChannel ( std::vector< T > &&  data,
const std::string &  name,
GridPrimitive  definedOn = GridPrimitive::Vertex 
)
inline

Direct construction.

Parameters
dataRaw data, move values
nameName associated with the channel
definedOnGridPrimitive the data is defined on, default: 0D vertices

◆ BufferChannel() [4/4]

template<typename T , ind N = 1>
inviwo::discretedata::BufferChannel< T, N >::BufferChannel ( T *const  data,
ind  numElements,
const std::string &  name,
GridPrimitive  definedOn = GridPrimitive::Vertex 
)
inline

Direct construction.

Parameters
dataPointer to data, copy numElements * numComponents
numElementsTotal number of indexed positions
nameName associated with the channel
definedOnGridPrimitive the data is defined on, default: 0D vertices

Member Function Documentation

◆ fillRaw()

template<typename T , ind N = 1>
virtual void inviwo::discretedata::BufferChannel< T, N >::fillRaw ( T *  dest,
ind  index 
) const
inlineoverrideprotectedvirtual

Indexed point access, constant.

Parameters
destPosition to write to, expect write of NumComponents many T
indexLinear point index

Implements inviwo::discretedata::BaseChannel< T, N >.

◆ get() [1/2]

template<typename T , ind N = 1>
template<typename VecNT = DefaultVec>
VecNT& inviwo::discretedata::BufferChannel< T, N >::get ( ind  index)
inline

Indexed point access.

Parameters
indexLinear point index
Returns
Reference to data

◆ get() [2/2]

template<typename T , ind N = 1>
template<typename VecNT = DefaultVec>
const VecNT& inviwo::discretedata::BufferChannel< T, N >::get ( ind  index) const
inline

Indexed point access.

Parameters
indexLinear point index
Returns
Reference to data

◆ operator[]() [1/2]

template<typename T , ind N = 1>
DefaultVec& inviwo::discretedata::BufferChannel< T, N >::operator[] ( ind  index)
inline

Indexed point access.

Parameters
indexLinear point index
Returns
Reference to data

◆ operator[]() [2/2]

template<typename T , ind N = 1>
const DefaultVec& inviwo::discretedata::BufferChannel< T, N >::operator[] ( ind  index) const
inline

Indexed point access.

Parameters
indexLinear point index
Returns
Reference to data

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