MACField< Data_T >::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

| 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_t & | operator* () const
mac_comp_iterator & | operator++ ()
real_t * | operator-> () 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_type & | m_field
| Reference to field being iterated over.
real_t * | m_p
| Pointer to current element.
Box3i | m_window
| Window to traverse.

## Detailed Description

template<class Data_T>
class MACField< Data_T >::mac_comp_iterator

Definition at line 472 of file MACField.h.

## Member Typedef Documentation

## class_type

template<class Data_T>

typedef MACField<Data_T> MACField< Data_T >::mac_comp_iterator::class_type

Definition at line 478 of file MACField.h.

## real_t

template<class Data_T>

typedef MACField<Data_T>::real_t MACField< Data_T >::mac_comp_iterator::real_t

Definition at line 479 of file MACField.h.

## Constructor & Destructor Documentation

## mac_comp_iterator()

template<class Data_T>

MACField< Data_T >::mac_comp_iterator::mac_comp_iterator | ( | MACComponent | comp,
|  | class_type & | field,
|  | const Box3i & | window,
|  | const V3i & | currentPos )

inline

Definition at line 483 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)
{
if (window.intersects(currentPos))
updatePointer();
}
MACField::mac_comp_iterator::m_p
real_t * m_p
Pointer to current element.
Definition MACField.h:570
MACField::mac_comp_iterator::z
int z
Definition MACField.h:544
MACField::mac_comp_iterator::m_field
class_type & m_field
Reference to field being iterated over.
Definition MACField.h:576
MACField::mac_comp_iterator::m_comp
MACComponent m_comp
Component to look up.
Definition MACField.h:574
MACField::mac_comp_iterator::updatePointer
void updatePointer()
Definition MACField.h:550
MACField::mac_comp_iterator::y
int y
Definition MACField.h:544
MACField::mac_comp_iterator::x
int x
Current position.
Definition MACField.h:544
MACField::mac_comp_iterator::m_window
Box3i m_window
Window to traverse.
Definition MACField.h:572
MACField
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>

mac_comp_iterator & MACField< Data_T >::mac_comp_iterator::operator++ | ( |  | ) |

inline

Definition at line 495 of file MACField.h.

{
if (x == m_window.max.x) {
if (y == m_window.max.y) {
if (z == m_window.max.z) {
m_p = 0;
return *this;
} else {
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;
}

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

## operator==()

template<class Data_T>
template<class Iter_T>

bool MACField< Data_T >::mac_comp_iterator::operator== | ( | const Iter_T & | rhs | ) | const

inline

Definition at line 520 of file MACField.h.

{
return m_p == &(*rhs);
}

References m_p.

## operator!=()

template<class Data_T>
template<class Iter_T>

bool MACField< Data_T >::mac_comp_iterator::operator!= | ( | const Iter_T & | rhs | ) | const

inline

Definition at line 526 of file MACField.h.

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

References m_p.

## operator*()

template<class Data_T>

real_t & MACField< Data_T >::mac_comp_iterator::operator* | ( |  | ) | const

inline

Definition at line 531 of file MACField.h.

{
return *m_p;
}

References m_p.

## operator->()

template<class Data_T>

real_t * MACField< Data_T >::mac_comp_iterator::operator-> | ( |  | ) | const

inline

Definition at line 536 of file MACField.h.

{
return m_p;
}

References m_p.

## updatePointer()

template<class Data_T>

void MACField< Data_T >::mac_comp_iterator::updatePointer | ( |  | ) |

inline private

Definition at line 550 of file MACField.h.

{
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");
}
}

References m_comp, m_field, m_p, MACCompU, MACCompV, MACCompW, x, y, and z.

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

## Member Data Documentation

## x

template<class Data_T>

int MACField< Data_T >::mac_comp_iterator::x

Current position.

Definition at line 544 of file MACField.h.

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

## y

template<class Data_T>

int MACField< Data_T >::mac_comp_iterator::y

Definition at line 544 of file MACField.h.

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

## z

template<class Data_T>

int MACField< Data_T >::mac_comp_iterator::z

Definition at line 544 of file MACField.h.

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

## m_p

template<class Data_T>

real_t* MACField< Data_T >::mac_comp_iterator::m_p

private

Pointer to current element.

Definition at line 570 of file MACField.h.

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

## m_window

template<class Data_T>

Box3i MACField< Data_T >::mac_comp_iterator::m_window

private

Window to traverse.

Definition at line 572 of file MACField.h.

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

## m_comp

template<class Data_T>

MACComponent MACField< Data_T >::mac_comp_iterator::m_comp

private

Component to look up.

Definition at line 574 of file MACField.h.

Referenced by mac_comp_iterator(), and updatePointer().

## m_field

template<class Data_T>

class_type& MACField< Data_T >::mac_comp_iterator::m_field

private

Reference to field being iterated over.

Definition at line 576 of file MACField.h.

Referenced by mac_comp_iterator(), and updatePointer().

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

- export/MACField.h