Field3D
Field.h File Reference
#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  FieldTraits< Data_T >
class  ResizableField< Data_T >
class  WritableField< Data_T >
class  WritableField< Data_T >::iterator

Namespaces

namespace  Exc
 

Namespace for Exception objects.


Defines

#define DEFINE_CHECK_RTTI_CALL
#define DEFINE_FIELD_RTTI_ABSTRACT_CLASS   DEFINE_MATCH_RTTI_CALL
#define DEFINE_FIELD_RTTI_CONCRETE_CLASS
#define DEFINE_MATCH_RTTI_CALL

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)
V3i contToDisc (const V3d &contCoord)
 Goes from continuous coords to discrete for a 3-vector.
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.
V3d discToCont (const V3i &discCoord)
 Goes from discrete coords to continuous 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.
template<class Field_T >
Field_T::Ptr field_dynamic_cast (FieldBase::Ptr field)
 Dynamic cast that uses string-comparison in order to be safe even after an object crosses a shared library boundary.
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.

Define Documentation

#define DEFINE_CHECK_RTTI_CALL
Value:
virtual bool checkRTTI(const std::string &typenameStr) \
  { return matchRTTI(typenameStr); } \

Definition at line 73 of file Field.h.

#define DEFINE_MATCH_RTTI_CALL
Value:
bool matchRTTI(const std::string &typenameStr) \
  { \
    if (typenameStr == typeid(class_type).name()) { \
      return true; \
    } \
    return base::matchRTTI(typenameStr); \
  }

Definition at line 77 of file Field.h.

#define DEFINE_FIELD_RTTI_CONCRETE_CLASS
Value:

Definition at line 86 of file Field.h.

#define DEFINE_FIELD_RTTI_ABSTRACT_CLASS   DEFINE_MATCH_RTTI_CALL

Definition at line 90 of file Field.h.


Function Documentation

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 973 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 993 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 1017 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 1026 of file Field.h.

Referenced by 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 1034 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 1042 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 1050 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 1059 of file Field.h.

References discToCont().

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