Field3D
MACField::mac_comp_iterator Class Reference

#include <MACField.h>

List of all members.

Public Types

typedef MACField< Data_T > class_type
typedef MACField< Data_T >::real_t real_t

Public Member Functions

 mac_comp_iterator (MACComponent comp, class_type &field, const Box3i &window, const V3i &currentPos)
template<class Iter_T >
bool operator!= (const Iter_T &rhs) const
real_toperator* () const
mac_comp_iteratoroperator++ ()
real_toperator-> () const
template<class Iter_T >
bool operator== (const Iter_T &rhs) const

Public Attributes

int x
 Current position.
int y
int z

Private Member Functions

void updatePointer ()

Private Attributes

MACComponent m_comp
 Component to look up.
class_typem_field
 Reference to field being iterated over.
real_tm_p
 Pointer to current element.
Box3i m_window
 Window to traverse.

Member Typedef Documentation

Definition at line 473 of file MACField.h.

Definition at line 474 of file MACField.h.


Constructor & Destructor Documentation

MACField::mac_comp_iterator::mac_comp_iterator ( MACComponent  comp,
class_type field,
const Box3i window,
const V3i currentPos 
) [inline]

Definition at line 478 of file MACField.h.

    : x(currentPos.x), y(currentPos.y), z(currentPos.z), 
      m_p(NULL), m_window(window), m_comp(comp), 
      m_field(field)
  { 
    updatePointer();
  }

Member Function Documentation

mac_comp_iterator& MACField::mac_comp_iterator::operator++ ( ) [inline]

Definition at line 489 of file MACField.h.

References x.

  {
    if (x == m_window.max.x) {
      if (y == m_window.max.y) {
        x = m_window.min.x; 
        y = m_window.min.y; 
        ++z;
      } else {
        x = m_window.min.x; 
        ++y;
      }
      updatePointer();
    } else {
      ++x;
      ++m_p;
    }
    return *this;
  }
template<class Iter_T >
bool MACField::mac_comp_iterator::operator== ( const Iter_T &  rhs) const [inline]

Definition at line 509 of file MACField.h.

  {
    return m_p == &(*rhs);
  }
template<class Iter_T >
bool MACField::mac_comp_iterator::operator!= ( const Iter_T &  rhs) const [inline]

Definition at line 515 of file MACField.h.

  {
    return m_p != &(*rhs);
  }
real_t& MACField::mac_comp_iterator::operator* ( ) const [inline]

Definition at line 520 of file MACField.h.

  {
    return *m_p;
  }
real_t* MACField::mac_comp_iterator::operator-> ( ) const [inline]

Definition at line 525 of file MACField.h.

  {
    return m_p;
  }
void MACField::mac_comp_iterator::updatePointer ( ) [inline, private]

Definition at line 539 of file MACField.h.

References MACCompU, MACCompV, and MACCompW.

  {
    switch (m_comp) {
    case MACCompU:
      m_p = m_field.uPtr(x, y, z);
      break;
    case MACCompV:
      m_p = m_field.vPtr(x, y, z);
      break;
    case MACCompW:
      m_p = m_field.wPtr(x, y, z);
      break;
    default:
      assert(false && "Illegal MACComponent in const_mac_comp_iterator");
    }    
  }

Member Data Documentation

Current position.

Definition at line 533 of file MACField.h.

Referenced by operator++().

Definition at line 533 of file MACField.h.

Definition at line 533 of file MACField.h.

Pointer to current element.

Definition at line 559 of file MACField.h.

Window to traverse.

Definition at line 561 of file MACField.h.

Component to look up.

Definition at line 563 of file MACField.h.

Reference to field being iterated over.

Definition at line 565 of file MACField.h.


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