OOF2: The Manual

Name

ScalarFieldIterator — Iterate over a the components of ScalarField.

C++ Synopsis

#include "engine/fieldindex.h"
class ScalarFieldIterator: , public ComponentIterator {
  ScalarFieldIterator(bool done= 0);
}

Source Files

  • SRC/engine/fieldindex.h: C++ header
  • SRC/engine/fieldindex.C: C++ source code

Description

ScalarFieldIterator is the ComponentIterator for ScalarFieldComponents. Dereferencing the iterator produces an IndexP wrapping a ScalarFieldIndex.

A ScalarFieldIterator is used when looping over the components of a ScalarField. A loop using a ScalarFieldIterator executes its body code just once.

This isn't as silly as it seems. It's used in generic code where the type of Field isn't known.

ScalarFieldIterators are created by the begin() and end() methods of ScalarFieldComponents, and are not directly accessible in Python. The constructor argument done indicates whether the iterator has already been iterated. ScalarFieldComponents::begin() sets done=0 and ScalarFieldComponents::end() sets done=1.