Gromacs
2024.3
|
#include <gromacs/selection/selection.h>
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. | |
SelectionTreeElement & | rootElement () |
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. | |
SelectionFlags | flags () const |
Returns the current flags. | |
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. | |
gmx::internal::SelectionData::SelectionData | ( | SelectionTreeElement * | elem, |
const char * | selstr | ||
) |
Creates a new selection object.
[in] | elem | Root of the evaluation tree for this selection. |
[in] | selstr | String that was parsed to produce this selection. |
std::bad_alloc | if out of memory. |
void gmx::internal::SelectionData::computeAverageCoveredFraction | ( | int | nframes | ) |
Computes average covered fraction after all frames have been evaluated.
[in] | nframes | Number 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.
[in] | type | Type of covered fraction required. |
void gmx::internal::SelectionData::initializeMassesAndCharges | ( | const gmx_mtop_t * | top | ) |
Computes total masses and charges for all selection positions.
[in] | top | Topology information. |
std::bad_alloc | if 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.
[in] | top | Topology information. |
Called by SelectionEvaluator.
void gmx::internal::SelectionData::refreshName | ( | ) |
Updates the name of the selection if missing.
std::bad_alloc | if 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.
[in] | top | Topology 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.