Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Friends
gmx::internal::SelectionData Class Reference

#include <gromacs/selection/selection.h>

Description

Internal data for a single selection.

This class is internal to the selection module, but resides in a public header because of efficiency reasons: it allows frequently used access methods in Selection to be inlined.

Methods in this class do not throw unless otherwise specified.

Public Member Functions

 SelectionData (SelectionTreeElement *elem, const char *selstr)
 Creates a new selection object. More...
 
const char * name () const
 Returns the name for this selection.
 
const char * selectionText () const
 Returns the string that was parsed to produce this selection.
 
bool isDynamic () const
 Returns true if the size of the selection (posCount()) is dynamic.
 
e_index_t type () const
 Returns the type of positions in the selection.
 
bool hasOnlyAtoms () const
 Returns true if the selection only contains positions with a single atom each.
 
bool hasSortedAtomIndices () const
 Returns true if the atom indices in the selection are in ascending order.
 
int posCount () const
 Number of positions in the selection.
 
SelectionTreeElementrootElement ()
 Returns the root of the evaluation tree for this selection.
 
bool isCoveredFractionDynamic () const
 Returns whether the covered fraction can change between frames.
 
bool hasFlag (SelectionFlag flag) const
 Returns true if the given flag is set.
 
void setFlags (SelectionFlags flags)
 Sets the flags for this selection.
 
bool initCoveredFraction (e_coverfrac_t type)
 Initializes information about covered fractions. More...
 
void refreshName ()
 Updates the name of the selection if missing. More...
 
void initializeMassesAndCharges (const gmx_mtop_t *top)
 Computes total masses and charges for all selection positions. More...
 
void refreshMassesAndCharges (const gmx_mtop_t *top)
 Updates masses and charges after dynamic selection has been evaluated. More...
 
void updateCoveredFractionForFrame ()
 Updates the covered fraction after a selection has been evaluated. More...
 
void computeAverageCoveredFraction (int nframes)
 Computes average covered fraction after all frames have been evaluated. More...
 
void restoreOriginalPositions (const gmx_mtop_t *top)
 Restores position information to state it was in after compilation. More...
 

Friends

class gmx::Selection
 Needed to wrap access to information.
 
class gmx::SelectionPosition
 Needed for proper access to position information.
 

Constructor & Destructor Documentation

gmx::internal::SelectionData::SelectionData ( SelectionTreeElement elem,
const char *  selstr 
)

Creates a new selection object.

Parameters
[in]elemRoot of the evaluation tree for this selection.
[in]selstrString that was parsed to produce this selection.
Exceptions
std::bad_allocif out of memory.

Member Function Documentation

void gmx::internal::SelectionData::computeAverageCoveredFraction ( int  nframes)

Computes average covered fraction after all frames have been evaluated.

Parameters
[in]nframesNumber of frames that have been evaluated.

nframes should be equal to the number of calls to updateCoveredFractionForFrame(). Called by SelectionEvaluator::evaluateFinal().

bool gmx::internal::SelectionData::initCoveredFraction ( e_coverfrac_t  type)

Initializes information about covered fractions.

Parameters
[in]typeType of covered fraction required.
Returns
true if the covered fraction can be calculated for the selection.
void gmx::internal::SelectionData::initializeMassesAndCharges ( const gmx_mtop_t *  top)

Computes total masses and charges for all selection positions.

Parameters
[in]topTopology information.
Exceptions
std::bad_allocif out of memory.

For dynamic selections, the values need to be updated after each evaluation with refreshMassesAndCharges(). This is done by SelectionEvaluator.

This function is called by SelectionCompiler.

Strong exception safety guarantee.

void gmx::internal::SelectionData::refreshMassesAndCharges ( const gmx_mtop_t *  top)

Updates masses and charges after dynamic selection has been evaluated.

Parameters
[in]topTopology information.

Called by SelectionEvaluator.

void gmx::internal::SelectionData::refreshName ( )

Updates the name of the selection if missing.

Exceptions
std::bad_allocif out of memory.

If selections get their value from a group reference that cannot be resolved during parsing, the name is final only after group references have been resolved.

This function is called by SelectionCollection::setIndexGroups().

void gmx::internal::SelectionData::restoreOriginalPositions ( const gmx_mtop_t *  top)

Restores position information to state it was in after compilation.

Parameters
[in]topTopology information.

Depends on SelectionCompiler storing the original atoms in the rootElement_ object. Called by SelectionEvaluator::evaluateFinal().

void gmx::internal::SelectionData::updateCoveredFractionForFrame ( )

Updates the covered fraction after a selection has been evaluated.

Called by SelectionEvaluator.


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