Field3D
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_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.
 

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.

485 : x(currentPos.x), y(currentPos.y), z(currentPos.z),
486 m_p(NULL), m_window(window), m_comp(comp),
487 m_field(field)
488 {
489 if (window.intersects(currentPos))
491 }
real_t * m_p
Pointer to current element.
Definition MACField.h:570
class_type & m_field
Reference to field being iterated over.
Definition MACField.h:576
MACComponent m_comp
Component to look up.
Definition MACField.h:574
int x
Current position.
Definition MACField.h:544
Box3i m_window
Window to traverse.
Definition MACField.h:572

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.

496 {
497 if (x == m_window.max.x) {
498 if (y == m_window.max.y) {
499 if (z == m_window.max.z) {
500 m_p = 0;
501 return *this;
502 } else {
503 x = m_window.min.x;
504 y = m_window.min.y;
505 ++z;
506 }
507 } else {
508 x = m_window.min.x;
509 ++y;
510 }
512 } else {
513 ++x;
514 ++m_p;
515 }
516 return *this;
517 }

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

521 {
522 return m_p == &(*rhs);
523 }

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

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

◆ operator*()

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

Definition at line 531 of file MACField.h.

532 {
533 return *m_p;
534 }

◆ operator->()

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

Definition at line 536 of file MACField.h.

537 {
538 return m_p;
539 }

◆ updatePointer()

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

Definition at line 550 of file MACField.h.

551 {
552 switch (m_comp) {
553 case MACCompU:
554 m_p = m_field.uPtr(x, y, z);
555 break;
556 case MACCompV:
557 m_p = m_field.vPtr(x, y, z);
558 break;
559 case MACCompW:
560 m_p = m_field.wPtr(x, y, z);
561 break;
562 default:
563 assert(false && "Illegal MACComponent in const_mac_comp_iterator");
564 }
565 }
@ MACCompV
Definition MACField.h:73
@ MACCompU
Definition MACField.h:72
@ MACCompW
Definition MACField.h:74
const real_t * uPtr(int i, int j, int k) const
Direct access to value on u-facing wall.
Definition MACField.h:920
const real_t * vPtr(int i, int j, int k) const
Direct access to value on v-facing wall.
Definition MACField.h:946
const real_t * wPtr(int i, int j, int k) const
Direct access to value on w-facing wall.
Definition MACField.h:972

References MACCompU, MACCompV, and MACCompW.

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.

◆ y

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

Definition at line 544 of file MACField.h.

◆ z

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

Definition at line 544 of file MACField.h.

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

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

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

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


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