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.
int y
int z

Private Member Functions

void updatePointer ()

Private Attributes

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

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),
377 {
378 if (window.intersects(currentPos))
380 }
MACComponent m_comp
Component to look up.
Definition MACField.h:463
const real_t * m_p
Pointer to current element.
Definition MACField.h:459
Box3i m_window
Window to traverse.
Definition MACField.h:461
const class_type & m_field
Reference to field being iterated over.
Definition MACField.h:465
This subclass of Field implements a standard MAC field. Refer to your favorite fluid simulations book...
Definition MACField.h:96

References m_comp, m_field, m_p, m_window, updatePointer(), x, y, and z.

Referenced by operator++().

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 }
401 } else {
402 ++x;
403 ++m_p;
404 }
405 return *this;
406 }

References const_mac_comp_iterator(), m_p, m_window, updatePointer(), x, y, and z.

◆ 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 }

References m_p.

◆ 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 }

References m_p.

◆ 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 }

References m_p.

◆ 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 }

References m_p.

◆ 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 m_comp, m_field, m_p, MACCompU, MACCompV, MACCompW, x, y, and z.

Referenced by const_mac_comp_iterator(), and operator++().

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 const_mac_comp_iterator(), operator++(), and updatePointer().

◆ y

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

Definition at line 433 of file MACField.h.

Referenced by const_mac_comp_iterator(), operator++(), and updatePointer().

◆ z

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

Definition at line 433 of file MACField.h.

Referenced by const_mac_comp_iterator(), operator++(), and updatePointer().

◆ 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.

Referenced by const_mac_comp_iterator(), operator!=(), operator*(), operator++(), operator->(), operator==(), and updatePointer().

◆ 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.

Referenced by const_mac_comp_iterator(), and operator++().

◆ 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.

Referenced by const_mac_comp_iterator(), and updatePointer().

◆ 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.

Referenced by const_mac_comp_iterator(), and updatePointer().


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