T3DDatafield< T > Class Template Reference
Basic data strctures and functions

A templated class of a 3D data field. More...

`#include <mia/3d/datafield.hh>`

Inheritance diagram for T3DDatafield< T >:
[legend]

## Data Structures

class | ConstRange
class | Range
| a shortcut data type More...

## Public Member Functions

iterator | begin ()
const_iterator | begin () const
iterator | begin_at (size_t x, size_t y, size_t z)
const_iterator | begin_at (size_t x, size_t y, size_t z) const
range_iterator | begin_range (const C3DBounds &begin, const C3DBounds &end)
const_range_iterator | begin_range (const C3DBounds &begin, const C3DBounds &end) const
range_iterator_with_boundary_flag | begin_range_with_boundary_flags (const C3DBounds &begin, const C3DBounds &end)
const_range_iterator_with_boundary_flag | begin_range_with_boundary_flags (const C3DBounds &begin, const C3DBounds &end) const
void | clear ()
iterator | end ()
const_iterator | end () const
range_iterator | end_range (const C3DBounds &begin, const C3DBounds &end)
const_range_iterator | end_range (const C3DBounds &begin, const C3DBounds &end) const
range_iterator_with_boundary_flag | end_range_with_boundary_flags (const C3DBounds &begin, const C3DBounds &end)
const_range_iterator_with_boundary_flag | end_range_with_boundary_flags (const C3DBounds &begin, const C3DBounds &end) const
value_type | get_avg ()
value_type | get_block_avrg (const C3DBounds &Start, const C3DBounds &BlockSize) const
void | get_data_line_x (int y, int z, std::vector< T > &buffer) const
void | get_data_line_y (int x, int z, std::vector< T > &buffer) const
void | get_data_line_z (int x, int y, std::vector< T > &buffer) const
T2DDatafield< T > | get_data_plane_xy (size_t z) const
T2DDatafield< T > | get_data_plane_xz (size_t y) const
T2DDatafield< T > | get_data_plane_yz (size_t x) const
template<typename Out>
T3DVector< Out > | get_gradient (const T3DVector< float > &p) const
T3DVector< Out > | get_gradient (int hardcode) const
template<typename Out>
T3DVector< Out > | get_gradient (int index) const
template<typename Out>
T3DVector< Out > | get_gradient (size_t x, size_t y, size_t z) const
value_type | get_interpol_val_at (const T3DVector< float > &p) const __attribute__((deprecated))
size_t | get_plane_size_xy () const
Range | get_range (const C3DBounds &start, const C3DBounds &end)
ConstRange | get_range (const C3DBounds &start, const C3DBounds &end) const
const C3DBounds & | get_size () const
bool | holds_unique_data () const __attribute__((deprecated))
void | make_single_ref () __attribute__((deprecated))
template<class TMask>
void | mask (const TMask &m)
reference | operator() (const C3DBounds &l)
const_reference | operator() (const C3DBounds &l) const
reference | operator() (size_t x, size_t y, size_t z)
const_reference | operator() (size_t x, size_t y, size_t z) const
T3DDatafield & | operator= (const T3DDatafield &org)
T3DDatafield & | operator= (T3DDatafield &&org)
| Moave asignment.
reference | operator[] (int i)
const_reference | operator[] (int i) const
void | put_data_line_x (int y, int z, const std::vector< T > &buffer)
void | put_data_line_y (int x, int z, const std::vector< T > &buffer)
void | put_data_line_z (int x, int y, const std::vector< T > &buffer)
void | put_data_plane_xy (size_t z, const T2DDatafield< T > &p)
void | put_data_plane_xz (size_t y, const T2DDatafield< T > &p)
void | put_data_plane_yz (size_t x, const T2DDatafield< T > &p)
void | read_xslice_flat (size_t x, std::vector< atomic_type > &buffer) const
void | read_yslice_flat (size_t y, std::vector< atomic_type > &buffer) const
void | read_zslice_flat (size_t z, std::vector< atomic_type > &buffer) const
size_type | size () const
value_type | strip_avg ()
void | swap (T3DDatafield &other)
| swap the data ofthis 3DDatafield with another one
| T3DDatafield ()
| T3DDatafield (const C3DBounds &_Size)
| T3DDatafield (const C3DBounds &size, const data_array &data)
| T3DDatafield (const C3DBounds &size, const T *data)
| T3DDatafield (const T3DDatafield< T > &org)
| T3DDatafield (T3DDatafield< T > &&org)
void | write_xslice_flat (size_t x, const std::vector< atomic_type > &buffer)
void | write_yslice_flat (size_t y, const std::vector< atomic_type > &buffer)
void | write_zslice_flat (size_t z, const std::vector< atomic_type > &buffer)
virtual | ~T3DDatafield ()
| make sure the destructor is virtual

## Detailed Description

template<class T>
class T3DDatafield< T >

A templated class of a 3D data field.

Definition at line 82 of file 3d/datafield.hh.

## Constructor & Destructor Documentation

## T3DDatafield() [1/6]

template<class T>

T3DDatafield< T >::T3DDatafield | ( |  | ) |

Referenced by T3DDatafield< T >::ConstRange::end(), T3DDatafield< T >::Range::end(), T3DVectorfield< C3DDVector >::T3DVectorfield(), T3DVectorfield< C3DDVector >::T3DVectorfield(), T3DVectorfield< C3DDVector >::T3DVectorfield(), and T3DVectorfield< C3DDVector >::T3DVectorfield().

## T3DDatafield() [2/6]

template<class T>

T3DDatafield< T >::T3DDatafield | ( | const C3DBounds & | _Size | ) |

explicit

Constructor to create empty Datafield if given size

## T3DDatafield() [3/6]

template<class T>

T3DDatafield< T >::T3DDatafield | ( | const C3DBounds & | size,
|  | const T * | data )

Constructor to create Datafield if given size and with initialization data

Parameters

  size | the size of the 3D-field
  data | to use for initialization

## T3DDatafield() [4/6]

template<class T>

T3DDatafield< T >::T3DDatafield | ( | const C3DBounds & | size,
|  | const data_array & | data )

Constructor to create Datafield if given size and with initialization data

Parameters

  size | the size of the 3D-field
  data | to use for initialization

## T3DDatafield() [5/6]

template<class T>

T3DDatafield< T >::T3DDatafield | ( | const T3DDatafield< T > & | org | ) |

copy - Constructor

## T3DDatafield() [6/6]

template<class T>

T3DDatafield< T >::T3DDatafield | ( | T3DDatafield< T > && | org | ) |

move constructor

## ~T3DDatafield()

template<class T>

virtual T3DDatafield< T >::~T3DDatafield | ( |  | ) |

virtual

make sure the destructor is virtual

## Member Function Documentation

## begin() [1/2]

template<class T>

iterator T3DDatafield< T >::begin | ( |  | ) |

inline

Returns
  an read/write random access iterator over the whole data field pointing at the beginning of the data. The functions ensures, that the field uses a single referenced datafield

Definition at line 446 of file 3d/datafield.hh.

## begin() [2/2]

template<class T>

const_iterator T3DDatafield< T >::begin | ( |  | ) | const

inline

Returns
  an read only forward iterator over the whole data field

Definition at line 421 of file 3d/datafield.hh.

## begin_at() [1/2]

template<class T>

iterator T3DDatafield< T >::begin_at | ( | size_t | x,
|  | size_t | y,
|  | size_t | z )

inline

Obtain an iterator at position (x,y,z) The functions ensures, that the field uses a single referenced datafield

Parameters

  x |
  y |
  z |

Returns
  the iterator

Definition at line 493 of file 3d/datafield.hh.

## begin_at() [2/2]

template<class T>

const_iterator T3DDatafield< T >::begin_at | ( | size_t | x,
|  | size_t | y,
|  | size_t | z ) const

inline

Returns
  an read only forward iterator over data field starting at (x,y,z)

Definition at line 429 of file 3d/datafield.hh.

## begin_range() [1/2]

template<class T>

range_iterator T3DDatafield< T >::begin_range | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end )

Returns
  an read/write forward iterator over a subset of the data. The functions ensures, that the field uses a single referenced datafield

## begin_range() [2/2]

template<class T>

const_range_iterator T3DDatafield< T >::begin_range | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end ) const

Returns
  an read/write forward iterator over a subset of the data. The functions ensures, that the field uses a single referenced datafield

## begin_range_with_boundary_flags() [1/2]

template<class T>

range_iterator_with_boundary_flag T3DDatafield< T >::begin_range_with_boundary_flags | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end )

Returns
  an read/write forward iterator over a subset of the data with indicator for the boundaries.

## begin_range_with_boundary_flags() [2/2]

template<class T>

const_range_iterator_with_boundary_flag T3DDatafield< T >::begin_range_with_boundary_flags | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end ) const

Returns
  an read/write forward iterator over a subset of the data with indicator for the boundaries.

## clear()

template<class T>

void T3DDatafield< T >::clear | ( |  | ) |

Set alle elements of the field to T() == Zero

## end() [1/2]

template<class T>

iterator T3DDatafield< T >::end | ( |  | ) |

inline

Returns
  an read/write random access iterator over the whole data field pointing at the end of the data. The functions ensures, that the field uses a single referenced datafield

Definition at line 501 of file 3d/datafield.hh.

## end() [2/2]

template<class T>

const_iterator T3DDatafield< T >::end | ( |  | ) | const

inline

Returns
  the end iterator to the 3D data field

Definition at line 438 of file 3d/datafield.hh.

## end_range() [1/2]

template<class T>

range_iterator T3DDatafield< T >::end_range | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end )

Returns
  the end of a read/write forward iterator over a subset of the data.

## end_range() [2/2]

template<class T>

const_range_iterator T3DDatafield< T >::end_range | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end ) const

Returns
  the end of a read/write forward iterator over a subset of the data.

## end_range_with_boundary_flags() [1/2]

template<class T>

range_iterator_with_boundary_flag T3DDatafield< T >::end_range_with_boundary_flags | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end )

Returns
  the end of a read/write forward iterator over a subset of the data with indicator for the boundaries.

## end_range_with_boundary_flags() [2/2]

template<class T>

const_range_iterator_with_boundary_flag T3DDatafield< T >::end_range_with_boundary_flags | ( | const C3DBounds & | begin,
|  | const C3DBounds & | end ) const

Returns
  the end of a read/write forward iterator over a subset of the data with indicator for the boundaries.

## get_avg()

template<class T>

value_type T3DDatafield< T >::get_avg | ( |  | ) |

Returns
  the average over the whole datafield

## get_block_avrg()

template<class T>

value_type T3DDatafield< T >::get_block_avrg | ( | const C3DBounds & | Start,
|  | const C3DBounds & | BlockSize ) const

Get the average over a given Block Attn: Type T must be able to hold the Sum of all Elements in Block

## get_data_line_x()

template<class T>

void T3DDatafield< T >::get_data_line_x | ( | int | y,
|  | int | z,
|  | std::vector< T > & | buffer ) const

Get some Data along some line parallel to X axis

## get_data_line_y()

template<class T>

void T3DDatafield< T >::get_data_line_y | ( | int | x,
|  | int | z,
|  | std::vector< T > & | buffer ) const

Get some Data along some line parallel to Y axis

## get_data_line_z()

template<class T>

void T3DDatafield< T >::get_data_line_z | ( | int | x,
|  | int | y,
|  | std::vector< T > & | buffer ) const

Get some Data along some line parallel to Z axis

## get_data_plane_xy()

template<class T>

T2DDatafield< T > T3DDatafield< T >::get_data_plane_xy | ( | size_t | z | ) | const

Read a z-plane from the 3D data set.

Parameters

  z |

Returns
  the copied data in a 2D data field

## get_data_plane_xz()

template<class T>

T2DDatafield< T > T3DDatafield< T >::get_data_plane_xz | ( | size_t | y | ) | const

Read a y-plane from the 3D data set.

Parameters

  y |

Returns
  the copied data in a 2D data field

## get_data_plane_yz()

template<class T>

T2DDatafield< T > T3DDatafield< T >::get_data_plane_yz | ( | size_t | x | ) | const

Read a x-plane from the 3D data set.

Parameters

  x |

Returns
  the copied data in a 2D data field

## get_gradient() [1/4]

template<class T>
template<typename Out>

T3DVector< Out > T3DDatafield< T >::get_gradient | ( | const T3DVector< float > & | p | ) | const

Gradient calculation using tri-linear interpolation

Parameters

  p | position where to evaluate the gradient

Definition at line 639 of file 3d/datafield.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

## get_gradient() [2/4]

T3DVector< Out > T3DDatafield< bool >::get_gradient | ( | int | hardcode | ) | const

Specialization to handle the wired std::vector<bool> implementation

Definition at line 629 of file 3d/datafield.hh.

## get_gradient() [3/4]

template<class T>
template<typename Out>

T3DVector< Out > T3DDatafield< T >::get_gradient | ( | int | index | ) | const

calculate the gradient at a grid point given by a linear location

Definition at line 613 of file 3d/datafield.hh.

References T3DVector< T >::x.

## get_gradient() [4/4]

template<class T>
template<typename Out>

T3DVector< Out > T3DDatafield< T >::get_gradient | ( | size_t | x,
|  | size_t | y,
|  | size_t | z ) const

calculate gradient of data field at a grid point

Definition at line 594 of file 3d/datafield.hh.

References T3DVector< T >::x.

## get_interpol_val_at()

template<class T>

value_type T3DDatafield< T >::get_interpol_val_at | ( | const T3DVector< float > & | p | ) | const

Interpolate the value of Field at p default uses tri-linear interpolation

## get_plane_size_xy()

template<class T>

size_t T3DDatafield< T >::get_plane_size_xy | ( |  | ) | const

inline

Returns
  the element count of one z slice

Definition at line 522 of file 3d/datafield.hh.

## get_range() [1/2]

template<class T>

Range T3DDatafield< T >::get_range | ( | const C3DBounds & | start,
|  | const C3DBounds & | end )

## get_range() [2/2]

template<class T>

ConstRange T3DDatafield< T >::get_range | ( | const C3DBounds & | start,
|  | const C3DBounds & | end ) const

## get_size()

template<class T>

const C3DBounds & T3DDatafield< T >::get_size | ( |  | ) | const

inline

Returns
  the 3D-size of the data field

Definition at line 235 of file 3d/datafield.hh.

## holds_unique_data()

template<class T>

bool T3DDatafield< T >::holds_unique_data | ( |  | ) | const

inline

Checks whether the data hold by the data field is unique.

Returns
  true if it is

Definition at line 98 of file 3d/datafield.hh.

## make_single_ref()

template<class T>

void T3DDatafield< T >::make_single_ref | ( |  | ) |

makes a single reference of the data, after calling this, it is save to write to the data field

## mask()

template<class T>
template<class TMask>

void T3DDatafield< T >::mask | ( | const TMask & | m | ) |

Mask the data field with a given mask

## operator()() [1/4]

template<class T>

reference T3DDatafield< T >::operator() | ( | const C3DBounds & | l | ) |

inline

Alternate index operator witch gives write access

Definition at line 289 of file 3d/datafield.hh.

## operator()() [2/4]

template<class T>

const_reference T3DDatafield< T >::operator() | ( | const C3DBounds & | l | ) | const

inline

alternate read-only indx operator

Definition at line 272 of file 3d/datafield.hh.

## operator()() [3/4]

template<class T>

reference T3DDatafield< T >::operator() | ( | size_t | x,
|  | size_t | y,
|  | size_t | z )

inline

Index operator witch gives write access

Definition at line 278 of file 3d/datafield.hh.

## operator()() [4/4]

template<class T>

const_reference T3DDatafield< T >::operator() | ( | size_t | x,
|  | size_t | y,
|  | size_t | z ) const

inline

read-only indx operator

Definition at line 260 of file 3d/datafield.hh.

## operator=() [1/2]

template<class T>

T3DDatafield & T3DDatafield< T >::operator= | ( | const T3DDatafield< T > & | org | ) |

Assignment operator -

Remarks
  it just copys a pointer to the data and increases its reference count, before writing it is necesary to call make_single_ref

## operator=() [2/2]

template<class T>

T3DDatafield & T3DDatafield< T >::operator= | ( | T3DDatafield< T > && | org | ) |

Moave asignment.

## operator[]() [1/2]

template<class T>

reference T3DDatafield< T >::operator[] | ( | int | i | ) |

inline

A linear read/write access operator. The refcount of Data must be 1, else the program will abort with a failed assertion (if assert is enabled)

Definition at line 515 of file 3d/datafield.hh.

## operator[]() [2/2]

template<class T>

const_reference T3DDatafield< T >::operator[] | ( | int | i | ) | const

inline

a linear read only access operator

Definition at line 507 of file 3d/datafield.hh.

## put_data_line_x()

template<class T>

void T3DDatafield< T >::put_data_line_x | ( | int | y,
|  | int | z,
|  | const std::vector< T > & | buffer )

Put some Data along some line parallel to X axis

## put_data_line_y()

template<class T>

void T3DDatafield< T >::put_data_line_y | ( | int | x,
|  | int | z,
|  | const std::vector< T > & | buffer )

Put some Data along some line parallel to Y axis

## put_data_line_z()

template<class T>

void T3DDatafield< T >::put_data_line_z | ( | int | x,
|  | int | y,
|  | const std::vector< T > & | buffer )

Put some Data along some line parallel to Z axis

## put_data_plane_xy()

template<class T>

void T3DDatafield< T >::put_data_plane_xy | ( | size_t | z,
|  | const T2DDatafield< T > & | p )

write a z-plane to the 3D data set.

Parameters

  z |
  p | plane data, must be of dimensions (size.x, size.y)

## put_data_plane_xz()

template<class T>

void T3DDatafield< T >::put_data_plane_xz | ( | size_t | y,
|  | const T2DDatafield< T > & | p )

write a y-plane to the 3D data set.

Parameters

  y |
  p | plane data, must be of dimensions (size.x, size.z)

## put_data_plane_yz()

template<class T>

void T3DDatafield< T >::put_data_plane_yz | ( | size_t | x,
|  | const T2DDatafield< T > & | p )

write a x-plane to the 3D data set.

Parameters

  x |
  p | plane data, must be of dimensions (size.y, size.z)

## read_xslice_flat()

template<class T>

void T3DDatafield< T >::read_xslice_flat | ( | size_t | x,
|  | std::vector< atomic_type > & | buffer ) const

Read the a x-slice of the data field into a flat buffer - i.e. the information about multi-dimensionality of the elements is lost. For this to work, T has to be a POD-like data type, i.e., it has no hidden elements like a virtual methods table, and, if T is a type of more then one element, all these elements have to be of the same type. Specifically, a specialization of the trait atomic_data for T must exists.

Parameters

  | x | slice to be read
  [out] | buffer | Buffer where the data will be written to. It must large enough to hold size.y * size.z * number of elements

## read_yslice_flat()

template<class T>

void T3DDatafield< T >::read_yslice_flat | ( | size_t | y,
|  | std::vector< atomic_type > & | buffer ) const

Read the a y-slice of the data field into a flat buffer - i.e. the information about multi-dimensionality of the elements is lost. For this to work, T has to be a POD-like data type, i.e., it has no hidden elements like a virtual methods table, and, if T is a type of more then one element, all these elements have to be of the same type. Specifically, a specialization of the trait atomic_data for T must exists.

Parameters

  | y | slice to be read
  [out] | buffer | Buffer where the data will be written to. It must large enough to hold size.x * size.z * number of elements

## read_zslice_flat()

template<class T>

void T3DDatafield< T >::read_zslice_flat | ( | size_t | z,
|  | std::vector< atomic_type > & | buffer ) const

Read the a z-slice of the data field into a flat buffer - i.e. the information about multi-dimensionality of the elements is lost. For this to work, T has to be a POD-like data type, i.e., it has no hidden elements like a virtual methods table, and, if T is a type of more then one element, all these elements have to be of the same type. Specifically, a specialization of the trait atomic_data for T must exists.

Parameters

  | z | slice to be read
  [out] | buffer | Buffer where the data will be written to. It must large enough to hold size.x * size.y * number of elements

## size()

template<class T>

size_type T3DDatafield< T >::size | ( |  | ) | const

inline

Returns
  the number of elements in the datafield

Definition at line 244 of file 3d/datafield.hh.

Referenced by T3DVectorfield< C3DDVector >::T3DVectorfield(), T3DVectorfield< C3DDVector >::T3DVectorfield(), and T3DVectorfield< C3DDVector >::T3DVectorfield().

## strip_avg()

template<class T>

value_type T3DDatafield< T >::strip_avg | ( |  | ) |

Strip average from data

Returns
  the stripped average

## swap()

template<class T>

void T3DDatafield< T >::swap | ( | T3DDatafield< T > & | other | ) |

swap the data ofthis 3DDatafield with another one

## write_xslice_flat()

template<class T>

void T3DDatafield< T >::write_xslice_flat | ( | size_t | x,
|  | const std::vector< atomic_type > & | buffer )

Write a x-slice from a flat buffer to the 3D data field. For details see void read_yslice_flat(size_t x, std::vector<atomic_type>& buffer) const;

## write_yslice_flat()

template<class T>

void T3DDatafield< T >::write_yslice_flat | ( | size_t | y,
|  | const std::vector< atomic_type > & | buffer )

Write a y-slice from a flat buffer to the 3D data field. For details see void read_yslice_flat(size_t y, std::vector<atomic_type>& buffer) const;

## write_zslice_flat()

template<class T>

void T3DDatafield< T >::write_zslice_flat | ( | size_t | z,
|  | const std::vector< atomic_type > & | buffer )

Write a z-slice from a flat buffer to the 3D data field. For details see void read_zslice_flat(size_t z, std::vector<atomic_type>& buffer) const;

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

- 3d/datafield.hh