Field3D
Field.h File Reference

Contains Field, WritableField and ResizableField classes. More...

#include <cmath>
#include <vector>
#include <map>
#include <boost/intrusive_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include "Traits.h"
#include "Exception.h"
#include "FieldMapping.h"
#include "FieldMetadata.h"
#include "Log.h"
#include "RefCount.h"
#include "Types.h"
#include "ns.h"

Go to the source code of this file.

Classes

class  Field< Data_T >
 
class  Field< Data_T >::const_iterator
 
class  FieldBase
 
class  FieldRes
 
class  ResizableField< Data_T >
 
class  WritableField< Data_T >
 
class  WritableField< Data_T >::iterator
 

Namespaces

 Exc
 Namespace for Exception objects.
 

Macros

#define FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION(field)
 

Functions

template<class Iter_T >
void advance (Iter_T &iter, int num)
 
template<class Iter_T >
void advance (Iter_T &iter, int num, const Iter_T &end)
 
int contToDisc (double contCoord)
 Goes from continuous coordinates to discrete coordinates See Graphics Gems - What is a pixel. More...
 
V2i contToDisc (const V2d &contCoord)
 Goes from continuous coords to discrete for a 2-vector. More...
 
V3i contToDisc (const V3d &contCoord)
 Goes from continuous coords to discrete for a 3-vector. More...
 
double discToCont (int discCoord)
 Goes from discrete coordinates to continuous coordinates See Graphics Gems - What is a pixel. More...
 
V2d discToCont (const V2i &discCoord)
 Goes from discrete coords to continuous for a 2-vector. More...
 
V3d discToCont (const V3i &discCoord)
 Goes from discrete coords to continuous for a 3-vector. More...
 
 FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION (Field)
 
 FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION (WritableField)
 
 FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION (ResizableField)
 
template<class Data_T >
bool isIdentical (typename Field< Data_T >::Ptr a, typename Field< Data_T >::Ptr b)
 Checks whether the span and data in two different fields are identical. More...
 
template<class Data_T , class Data_T2 >
bool sameDefinition (typename Field< Data_T >::Ptr a, typename Field< Data_T2 >::Ptr b)
 Checks whether the mapping and resolution in two different fields are identical. More...
 

Detailed Description

Contains Field, WritableField and ResizableField classes.

Definition in file Field.h.

Macro Definition Documentation

◆ FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION

#define FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION (   field)
Value:
template <typename Data_T> \
TemplatedFieldType<field<Data_T> > field<Data_T>::ms_classType = \
TemplatedFieldType<field<Data_T> >(); \

Definition at line 460 of file Field.h.

Referenced by ResizableField< Data_T >::sizeChanged().

Function Documentation

◆ FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION() [1/3]

FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION ( Field  )

◆ FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION() [2/3]

FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION ( WritableField  )

◆ FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION() [3/3]

FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION ( ResizableField  )

◆ sameDefinition()

template<class Data_T , class Data_T2 >
bool sameDefinition ( typename Field< Data_T >::Ptr  a,
typename Field< Data_T2 >::Ptr  b 
)

Checks whether the mapping and resolution in two different fields are identical.

Definition at line 974 of file Field.h.

References FieldRes::dataWindow(), FieldRes::extents(), and FieldRes::mapping().

976 {
977  if (a->extents() != b->extents()) {
978  return false;
979  }
980  if (a->dataWindow() != b->dataWindow()) {
981  return false;
982  }
983  if (!a->mapping()->isIdentical(b->mapping())) {
984  return false;
985  }
986  return true;
987 }

◆ isIdentical()

template<class Data_T >
bool isIdentical ( typename Field< Data_T >::Ptr  a,
typename Field< Data_T >::Ptr  b 
)

Checks whether the span and data in two different fields are identical.

Todo:
This should also check the mapping

Definition at line 994 of file Field.h.

References Field< Data_T >::cbegin(), and Field< Data_T >::cend().

995 {
996  if (!sameDefinition<Data_T, Data_T>(a, b)) {
997  return false;
998  }
999  // If data window is the same, we can safely assume that the range of
1000  // both fields' iterators are the same.
1001  typename Field<Data_T>::const_iterator is1 = a->cbegin();
1002  typename Field<Data_T>::const_iterator is2 = b->cbegin();
1003  typename Field<Data_T>::const_iterator ie1 = a->cend();
1004  bool same = true;
1005  for (; is1 != ie1; ++is1, ++is2) {
1006  if (*is1 != *is2) {
1007  same = false;
1008  break;
1009  }
1010  }
1011  return same;
1012 }

◆ contToDisc() [1/3]

int contToDisc ( double  contCoord)
inline

Goes from continuous coordinates to discrete coordinates See Graphics Gems - What is a pixel.

Definition at line 1018 of file Field.h.

Referenced by contToDisc().

1019 {
1020  return static_cast<int>(std::floor(contCoord));
1021 }

◆ discToCont() [1/3]

double discToCont ( int  discCoord)
inline

Goes from discrete coordinates to continuous coordinates See Graphics Gems - What is a pixel.

Definition at line 1027 of file Field.h.

Referenced by FrustumFieldMapping::computeVoxelSize(), and discToCont().

1028 {
1029  return static_cast<double>(discCoord) + 0.5;
1030 }

◆ contToDisc() [2/3]

V2i contToDisc ( const V2d contCoord)
inline

Goes from continuous coords to discrete for a 2-vector.

Definition at line 1035 of file Field.h.

References contToDisc().

1036 {
1037  return V2i(contToDisc(contCoord.x), contToDisc(contCoord.y));
1038 }
Imath::V2i V2i
Definition: SpiMathLib.h:65
int contToDisc(double contCoord)
Goes from continuous coordinates to discrete coordinates See Graphics Gems - What is a pixel...
Definition: Field.h:1018

◆ discToCont() [2/3]

V2d discToCont ( const V2i discCoord)
inline

Goes from discrete coords to continuous for a 2-vector.

Definition at line 1043 of file Field.h.

References discToCont().

1044 {
1045  return V2d(discToCont(discCoord.x), discToCont(discCoord.y));
1046 }
Imath::V2d V2d
Definition: SpiMathLib.h:67
double discToCont(int discCoord)
Goes from discrete coordinates to continuous coordinates See Graphics Gems - What is a pixel...
Definition: Field.h:1027

◆ contToDisc() [3/3]

V3i contToDisc ( const V3d contCoord)
inline

Goes from continuous coords to discrete for a 3-vector.

Definition at line 1051 of file Field.h.

References contToDisc().

1052 {
1053  return V3i(contToDisc(contCoord.x), contToDisc(contCoord.y),
1054  contToDisc(contCoord.z));
1055 }
Imath::V3i V3i
Definition: SpiMathLib.h:71
int contToDisc(double contCoord)
Goes from continuous coordinates to discrete coordinates See Graphics Gems - What is a pixel...
Definition: Field.h:1018

◆ discToCont() [3/3]

V3d discToCont ( const V3i discCoord)
inline

Goes from discrete coords to continuous for a 3-vector.

Definition at line 1060 of file Field.h.

References discToCont().

1061 {
1062  return V3d(discToCont(discCoord.x), discToCont(discCoord.y),
1063  discToCont(discCoord.z));
1064 }
Imath::V3d V3d
Definition: SpiMathLib.h:74
double discToCont(int discCoord)
Goes from discrete coordinates to continuous coordinates See Graphics Gems - What is a pixel...
Definition: Field.h:1027