Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::LinearArray< Value > Class Template Reference

Linear (i.e. non-blocked) generic 2D array data type. More...

#include <mitsuba/core/barray.h>

Public Member Functions

 LinearArray ()
 Create an unitialized linear array. More...
 
 LinearArray (const Vector2i &size)
 Allocate memory for a new linear array of the specified width and height. More...
 
void alloc (const Vector2i &size)
 Allocate memory for a linear array of the specified width and height. More...
 
void map (void *ptr, const Vector2i &size)
 
template<typename AltValue >
void init (const AltValue *data)
 Initialize the contents of the linear array with values from a non-blocked source in row-major order. More...
 
template<typename AltValue >
void init (const AltValue *data, AltValue &min_, AltValue &max_, AltValue &avg_)
 Initialize the contents of the linear array with values from a non-blocked source in row-major order and collect component-wise minimum, maximum, and average information. More...
 
template<typename AltValue >
void copyTo (AltValue *data) const
 Copy the contents of the linear array to a non-blocked destination buffer in row-major order. More...
 
void cleanup ()
 Zero out unused memory portions. More...
 
const Vector2igetSize () const
 Return the size of the array. More...
 
size_t getBufferSize () const
 Return the size of the allocated buffer. More...
 
int getWidth () const
 Return the width of the array. More...
 
int getHeight () const
 Return the height of the array. More...
 
 ~LinearArray ()
 Release all memory. More...
 
Value & operator() (int x, int y)
 Access the specified entry. More...
 
const Value & operator() (int x, int y) const
 Access the specified entry (const version) More...
 
Value * getData ()
 Return a pointer to the internal representation. More...
 
const Value * getData () const
 Return a pointer to the internal representation (const version) More...
 

Static Public Member Functions

static size_t bufferSize (const Vector2i &size)
 Return the hypothetical heap memory requirements of a blocked array for the given size. More...
 

Detailed Description

template<typename Value>
class mitsuba::LinearArray< Value >

Linear (i.e. non-blocked) generic 2D array data type.

This class implements a linearly stored 2D array. It is mainly meant as a drop-in replacement for BlockedArray so that the performance tradeoffs can be benchmarked.

Constructor & Destructor Documentation

template<typename Value >
mitsuba::LinearArray< Value >::LinearArray ( )
inline

Create an unitialized linear array.

template<typename Value >
mitsuba::LinearArray< Value >::LinearArray ( const Vector2i size)
inline

Allocate memory for a new linear array of the specified width and height.

template<typename Value >
mitsuba::LinearArray< Value >::~LinearArray ( )
inline

Release all memory.

Member Function Documentation

template<typename Value >
void mitsuba::LinearArray< Value >::alloc ( const Vector2i size)
inline

Allocate memory for a linear array of the specified width and height.

template<typename Value >
static size_t mitsuba::LinearArray< Value >::bufferSize ( const Vector2i size)
inlinestatic

Return the hypothetical heap memory requirements of a blocked array for the given size.

template<typename Value >
void mitsuba::LinearArray< Value >::cleanup ( )
inline

Zero out unused memory portions.

Since this is a non-blocked array, this function does nothing

template<typename Value >
template<typename AltValue >
void mitsuba::LinearArray< Value >::copyTo ( AltValue *  data) const
inline

Copy the contents of the linear array to a non-blocked destination buffer in row-major order.

This is effectively the opposite of init().

Remarks
This function performs type casts when Value != AltValue
template<typename Value >
size_t mitsuba::LinearArray< Value >::getBufferSize ( ) const
inline

Return the size of the allocated buffer.

template<typename Value >
Value* mitsuba::LinearArray< Value >::getData ( )
inline

Return a pointer to the internal representation.

template<typename Value >
const Value* mitsuba::LinearArray< Value >::getData ( ) const
inline

Return a pointer to the internal representation (const version)

template<typename Value >
int mitsuba::LinearArray< Value >::getHeight ( ) const
inline

Return the height of the array.

template<typename Value >
const Vector2i& mitsuba::LinearArray< Value >::getSize ( ) const
inline

Return the size of the array.

template<typename Value >
int mitsuba::LinearArray< Value >::getWidth ( ) const
inline

Return the width of the array.

template<typename Value >
template<typename AltValue >
void mitsuba::LinearArray< Value >::init ( const AltValue *  data)
inline

Initialize the contents of the linear array with values from a non-blocked source in row-major order.

Remarks
This function performs type casts when Value != AltValue
template<typename Value >
template<typename AltValue >
void mitsuba::LinearArray< Value >::init ( const AltValue *  data,
AltValue &  min_,
AltValue &  max_,
AltValue &  avg_ 
)
inline

Initialize the contents of the linear array with values from a non-blocked source in row-major order and collect component-wise minimum, maximum, and average information.

Assumes that AltValue is some kind of TVector or TSpectrum instance.

Remarks
This function performs type casts when Value != AltValue
template<typename Value >
void mitsuba::LinearArray< Value >::map ( void *  ptr,
const Vector2i size 
)
inline
template<typename Value >
Value& mitsuba::LinearArray< Value >::operator() ( int  x,
int  y 
)
inline

Access the specified entry.

template<typename Value >
const Value& mitsuba::LinearArray< Value >::operator() ( int  x,
int  y 
) const
inline

Access the specified entry (const version)


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