Phalanx  Development
 All Classes Functions Variables Typedefs Friends Pages
Classes | Public Types | Public Member Functions | List of all members
PHX::MDFieldIterator< T > Class Template Reference

Iterate over entries of an MDField<DataT>, a runtime MDField. More...

#include <Phalanx_MDField_Utilities.hpp>

Classes

class  Ptr
 

Public Types

typedef PHX::MDFieldTypeTraits
< typename MDField< T >
::array_type >::return_type 
reference_type
 Reference to an entry of the MDField.
 
typedef PHX::MDField< T >
::size_type 
size_type
 Index type.
 

Public Member Functions

 MDFieldIterator (const PHX::MDField< T > &a)
 User constructor.
 
MDFieldIterator< T > & operator++ ()
 Increment the iterator. Efficient.
 
MDFieldIterator< T > & operator++ (int)
 Like all postfix ++, this one is inefficient. Convenience only.
 
bool done () const
 Returns whether the iterator has reached the end.
 
reference_type ref () const
 Get a reference to the current value.
 
reference_type operator* () const
 Syntactic wrapper to ref().
 
Ptr operator-> () const
 Syntactic wrapper to (*it). .
 
size_type idx () const
 Get the index of the current value.
 

Detailed Description

template<typename T>
class PHX::MDFieldIterator< T >

Iterate over entries of an MDField<DataT>, a runtime MDField.

This iterator is one way to replace usage of the deprecated operator[]. Regardless of underlying implementation details, iteration proceeds so that in A(i,j,k), k is the fastest index and i is the slowest one.

Example usage:

int i = 0;
for (PHAL::MDFieldIterator<ScalarT> d(array); ! d.done() ; ++d, ++i)
*d = val[i];

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