OOF2: The Manual
Name
IndexP — Generic wrapper for index objects
Synopses
C++ Synopsis
#include "engine/fieldindex.h"
class IndexP {IndexP(FieldIndex* index);IndexP(const IndexP& other);IndexP(IndexP&& other);int integer() const;bool in_plane() const;operator const FieldIndex&() const;operator const FieldIndex*() const;
}
Description
IndexP is a wrapper for the various
FieldIndex
classes, which are used to refer to components of various kinds
of Fields, Fluxes, Equations, and OutputVals. The
wrapper is a light-weight object that allows a FieldIndex to
be used in a generic fashion, while at the same time handling
allocation and deallocation of the FieldIndex object.
All of the public FieldIndex methods are available in
IndexP, so an
IndexP can be treated just like a
FieldIndex. An
IndexP can be implicitly converted to a
const FieldIndex* or const
FieldIndex&, so any C++ function expecting a
FieldIndex argument can also operate on an
IndexP.
Note that IndexP does
not do reference counting. It's not a smart
pointer class. It's main purpose is to deallocate the
FieldIndex pointer that it holds and to access the
FieldIndex virtual functions.
![]() |
Note |
|---|---|
|
In Python there is no need for the
|
Methods
IndexP(FieldIndex *index)
The IndexP constructor has a single
argument, which must be a pointer to a newly constructed
instance of a FieldIndex subclass. The
IndexP takes over ownership of the
FieldIndex and will delete it when necessary.
IndexP(const IndexP& other)
The copy constructor creates a new
IndexP wrapping a pointer to a
copy of the underlying FieldIndex
object.
IndexP(const IndexP&& other)
The move constructor creates a new
IndexP that takes ownership of the old
IndexP's FieldIndex pointer. The
FieldIndex will be deleted when the new
IndexP is destroyed. The old
IndexP is invalidated.
operator const FieldIndex&() const and
operator const FieldIndex*() const
These operators convert an IndexP to a
const FieldIndex reference or pointer, allowing
it to be passed to functions expecting a FieldIndex argument.


![[Note]](IMAGES/note.png)

