Field3D
MACField< Data_T >::const_mac_comp_iterator Class Reference

#include <MACField.h>

Public Types

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

Public Member Functions

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

Public Attributes

int x
 Current position. More...
 
int y
 
int z
 

Private Member Functions

void updatePointer ()
 

Private Attributes

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

Detailed Description

template<class Data_T>
class MACField< Data_T >::const_mac_comp_iterator

Definition at line 359 of file MACField.h.

Member Typedef Documentation

◆ class_type

template<class Data_T >
typedef MACField<Data_T> MACField< Data_T >::const_mac_comp_iterator::class_type

Definition at line 365 of file MACField.h.

◆ real_t

template<class Data_T >
typedef MACField<Data_T>::real_t MACField< Data_T >::const_mac_comp_iterator::real_t

Definition at line 366 of file MACField.h.

Constructor & Destructor Documentation

◆ const_mac_comp_iterator()

template<class Data_T >
MACField< Data_T >::const_mac_comp_iterator::const_mac_comp_iterator ( MACComponent  comp,
const class_type field,
const Box3i window,
const V3i currentPos 
)
inline

Definition at line 370 of file MACField.h.

374  : x(currentPos.x), y(currentPos.y), z(currentPos.z),
375  m_p(NULL), m_window(window), m_comp(comp),
376  m_field(field)
377  {
378  if (window.intersects(currentPos))
379  updatePointer();
380  }

Member Function Documentation

◆ operator++()

template<class Data_T >
const const_mac_comp_iterator& MACField< Data_T >::const_mac_comp_iterator::operator++ ( )
inline

Definition at line 384 of file MACField.h.

385  {
386  if (x == m_window.max.x) {
387  if (y == m_window.max.y) {
388  if (z == m_window.max.z) {
389  m_p = 0;
390  return *this;
391  } else {
392  x = m_window.min.x;
393  y = m_window.min.y;
394  ++z;
395  }
396  } else {
397  x = m_window.min.x;
398  ++y;
399  }
400  updatePointer();
401  } else {
402  ++x;
403  ++m_p;
404  }
405  return *this;
406  }

References MACField< Data_T >::const_mac_comp_iterator::x.

◆ operator==()

template<class Data_T >
template<class Iter_T >
bool MACField< Data_T >::const_mac_comp_iterator::operator== ( const Iter_T &  rhs) const
inline

Definition at line 409 of file MACField.h.

410  {
411  return m_p == &(*rhs);
412  }

◆ operator!=()

template<class Data_T >
template<class Iter_T >
bool MACField< Data_T >::const_mac_comp_iterator::operator!= ( const Iter_T &  rhs) const
inline

Definition at line 415 of file MACField.h.

416  {
417  return m_p != &(*rhs);
418  }

◆ operator*()

template<class Data_T >
const real_t& MACField< Data_T >::const_mac_comp_iterator::operator* ( ) const
inline

Definition at line 420 of file MACField.h.

421  {
422  return *m_p;
423  }

◆ operator->()

template<class Data_T >
const real_t* MACField< Data_T >::const_mac_comp_iterator::operator-> ( ) const
inline

Definition at line 425 of file MACField.h.

426  {
427  return m_p;
428  }

◆ updatePointer()

template<class Data_T >
void MACField< Data_T >::const_mac_comp_iterator::updatePointer ( )
inlineprivate

Definition at line 439 of file MACField.h.

440  {
441  switch (m_comp) {
442  case MACCompU:
443  m_p = m_field.uPtr(x, y, z);
444  break;
445  case MACCompV:
446  m_p = m_field.vPtr(x, y, z);
447  break;
448  case MACCompW:
449  m_p = m_field.wPtr(x, y, z);
450  break;
451  default:
452  assert(false && "Illegal MACComponent in const_mac_comp_iterator");
453  }
454  }

References MACCompU, MACCompV, and MACCompW.

Member Data Documentation

◆ x

template<class Data_T >
int MACField< Data_T >::const_mac_comp_iterator::x

Current position.

Definition at line 433 of file MACField.h.

Referenced by MACField< Data_T >::const_mac_comp_iterator::operator++().

◆ y

template<class Data_T >
int MACField< Data_T >::const_mac_comp_iterator::y

Definition at line 433 of file MACField.h.

◆ z

template<class Data_T >
int MACField< Data_T >::const_mac_comp_iterator::z

Definition at line 433 of file MACField.h.

◆ m_p

template<class Data_T >
const real_t* MACField< Data_T >::const_mac_comp_iterator::m_p
private

Pointer to current element.

Definition at line 459 of file MACField.h.

◆ m_window

template<class Data_T >
Box3i MACField< Data_T >::const_mac_comp_iterator::m_window
private

Window to traverse.

Definition at line 461 of file MACField.h.

◆ m_comp

template<class Data_T >
MACComponent MACField< Data_T >::const_mac_comp_iterator::m_comp
private

Component to look up.

Definition at line 463 of file MACField.h.

◆ m_field

template<class Data_T >
const class_type& MACField< Data_T >::const_mac_comp_iterator::m_field
private

Reference to field being iterated over.

Definition at line 465 of file MACField.h.


The documentation for this class was generated from the following file:
MACField::wPtr
const real_t * wPtr(int i, int j, int k) const
Direct access to value on w-facing wall.
Definition: MACField.h:972
MACCompV
@ MACCompV
Definition: MACField.h:73
MACField::const_mac_comp_iterator::x
int x
Current position.
Definition: MACField.h:433
MACField::uPtr
const real_t * uPtr(int i, int j, int k) const
Direct access to value on u-facing wall.
Definition: MACField.h:920
MACField::const_mac_comp_iterator::updatePointer
void updatePointer()
Definition: MACField.h:439
MACField::const_mac_comp_iterator::m_field
const class_type & m_field
Reference to field being iterated over.
Definition: MACField.h:465
MACCompW
@ MACCompW
Definition: MACField.h:74
MACField::const_mac_comp_iterator::m_window
Box3i m_window
Window to traverse.
Definition: MACField.h:461
MACField::const_mac_comp_iterator::m_p
const real_t * m_p
Pointer to current element.
Definition: MACField.h:459
MACField::const_mac_comp_iterator::m_comp
MACComponent m_comp
Component to look up.
Definition: MACField.h:463
MACCompU
@ MACCompU
Definition: MACField.h:72
MACField::const_mac_comp_iterator::z
int z
Definition: MACField.h:433
MACField::const_mac_comp_iterator::y
int y
Definition: MACField.h:433
MACField::vPtr
const real_t * vPtr(int i, int j, int k) const
Direct access to value on v-facing wall.
Definition: MACField.h:946