Gromacs  2026.0-dev-20241121-c76fa1e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::analysismodules::anonymous_namespace{angle.cpp}::AnglePositionIterator Class Reference

Description

Helper to encapsulate logic for looping over input selections.

This class provides two-dimensional iteration:

This class isn't perferctly self-contained and requires the caller to know some of the internals to use it properly, but it serves its purpose for this single analysis tool by simplifying the loops. Some methods have also been tailored to allow the caller to use it a bit more easily.

Public Member Functions

 AnglePositionIterator (const SelectionList &selections, int posCountPerValue)
 Creates an iterator to loop over input selection positions. More...
 
void nextGroup ()
 Advances the iterator to the next group of angles.
 
void nextValue ()
 Advances the iterator to the next angle in the current group.
 
bool hasValue () const
 Returns whether this iterator represents any values. More...
 
bool hasSingleValue () const
 Returns whether the current selection only contains a single value. More...
 
bool isDynamic () const
 Returns whether the current selection is dynamic.
 
bool allValuesConsistentlySelected () const
 Returns whether positions in the current value are either all selected or all unselected.
 
bool currentValuesSelected () const
 Returns whether positions in the current value are selected. More...
 
const SelectioncurrentSelection () const
 Returns the currently active selection.
 
SelectionPosition currentPosition (int i) const
 Returns the ith position for the current value.
 
void getCurrentPositions (rvec x[]) const
 Extracts all coordinates corresponding to the current value. More...
 

Constructor & Destructor Documentation

gmx::analysismodules::anonymous_namespace{angle.cpp}::AnglePositionIterator::AnglePositionIterator ( const SelectionList selections,
int  posCountPerValue 
)
inline

Creates an iterator to loop over input selection positions.

Parameters
[in]selectionsList of selections.
[in]posCountPerValueNumber of selection positions that constitute a single value for the iteration.

If selections is empty, and/or posCountPerValue is zero, the iterator can still be advanced and hasValue()/hasSingleValue() called, but values cannot be accessed.

Member Function Documentation

bool gmx::analysismodules::anonymous_namespace{angle.cpp}::AnglePositionIterator::currentValuesSelected ( ) const
inline

Returns whether positions in the current value are selected.

Only works reliably if allValuesConsistentlySelected() returns true.

void gmx::analysismodules::anonymous_namespace{angle.cpp}::AnglePositionIterator::getCurrentPositions ( rvec  x[]) const
inline

Extracts all coordinates corresponding to the current value.

Parameters
[out]xArray to which the positions are extracted.

x should contain at minimum the number of positions per value passed to the constructor.

bool gmx::analysismodules::anonymous_namespace{angle.cpp}::AnglePositionIterator::hasSingleValue ( ) const
inline

Returns whether the current selection only contains a single value.

Returns false if hasValue() returns false, which allows cutting some corners in consistency checks.

bool gmx::analysismodules::anonymous_namespace{angle.cpp}::AnglePositionIterator::hasValue ( ) const
inline

Returns whether this iterator represents any values.

If the return value is false, only nextGroup(), nextValue() and hasSingleValue() are allowed to be called.


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