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

namespace  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.
 
V2i contToDisc (const V2d &contCoord)
 Goes from continuous coords to discrete for a 2-vector.
 
V3i contToDisc (const V3d &contCoord)
 Goes from continuous coords to discrete for a 3-vector.
 
double discToCont (int discCoord)
 Goes from discrete coordinates to continuous coordinates See Graphics Gems - What is a pixel.
 
V2d discToCont (const V2i &discCoord)
 Goes from discrete coords to continuous for a 2-vector.
 
V3d discToCont (const V3i &discCoord)
 Goes from discrete coords to continuous for a 3-vector.
 
 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.
 
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.
 

Detailed Description

Contains Field, WritableField and ResizableField classes.

Definition in file Field.h.

Macro Definition Documentation

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

Definition at line 460 of file Field.h.

Function Documentation

FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION ( Field  )
FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION ( WritableField  )
FIELD3D_CLASSTYPE_TEMPL_INSTANTIATION ( ResizableField  )
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().

{
if (a->extents() != b->extents()) {
return false;
}
if (a->dataWindow() != b->dataWindow()) {
return false;
}
if (!a->mapping()->isIdentical(b->mapping())) {
return false;
}
return true;
}
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().

{
if (!sameDefinition<Data_T, Data_T>(a, b)) {
return false;
}
// If data window is the same, we can safely assume that the range of
// both fields' iterators are the same.
typename Field<Data_T>::const_iterator is1 = a->cbegin();
typename Field<Data_T>::const_iterator is2 = b->cbegin();
typename Field<Data_T>::const_iterator ie1 = a->cend();
bool same = true;
for (; is1 != ie1; ++is1, ++is2) {
if (*is1 != *is2) {
same = false;
break;
}
}
return same;
}
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().

{
return static_cast<int>(std::floor(contCoord));
}
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().

{
return static_cast<double>(discCoord) + 0.5;
}
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().

{
return V2i(contToDisc(contCoord.x), contToDisc(contCoord.y));
}
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().

{
return V2d(discToCont(discCoord.x), discToCont(discCoord.y));
}
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().

{
return V3i(contToDisc(contCoord.x), contToDisc(contCoord.y),
contToDisc(contCoord.z));
}
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().

{
return V3d(discToCont(discCoord.x), discToCont(discCoord.y),
discToCont(discCoord.z));
}