Gromacs
2025-dev-20240913-b871546
|
Functions | |
bool | promptLine (TextInputStream *inputStream, TextWriter *statusWriter, std::string *line) |
Reads a single selection line from stdin. More... | |
int | runParserLoop (yyscan_t scanner, _gmx_sel_yypstate *parserState, bool bInteractive) |
Helper function for tokenizing the input and pushing them to the parser. More... | |
void | printCurrentStatus (TextWriter *writer, gmx_ana_selcollection_t *sc, gmx_ana_indexgrps_t *grps, size_t firstSelection, int maxCount, const std::string &context, bool bFirst) |
Print current status in response to empty line in interactive input. More... | |
void | printHelp (TextWriter *writer, gmx_ana_selcollection_t *sc, const std::string &line) |
Prints selection help in interactive selection input. More... | |
SelectionList | runParser (yyscan_t scanner, TextInputStream *inputStream, bool bInteractive, int maxnr, const std::string &context) |
Helper function that runs the parser once the tokenizer has been initialized. More... | |
void | checkExternalGroups (const SelectionTreeElementPointer &root, int natoms, ExceptionInitializer *errors) |
Checks that index groups have valid atom indices. More... | |
void | checkTopologyProperties (const gmx_mtop_t *top, const SelectionTopologyProperties &props) |
Checks whether the given topology properties are available. | |
std::unique_ptr< TextWriter > | initStatusWriter (TextOutputStream *statusStream) |
Helper function to initialize status writer for interactive selection parsing. | |
void gmx::anonymous_namespace{selectioncollection.cpp}::checkExternalGroups | ( | const SelectionTreeElementPointer & | root, |
int | natoms, | ||
ExceptionInitializer * | errors | ||
) |
Checks that index groups have valid atom indices.
[in] | root | Root of selection tree to process. |
[in] | natoms | Maximum number of atoms that the selections are set to evaluate. |
errors | Object for reporting any error messages. |
std::bad_alloc | if out of memory. |
Recursively checks the selection tree for index groups. Each found group is checked that it only contains atom indices that match the topology/maximum number of atoms set for the selection collection. Any issues are reported to errors
.
void gmx::anonymous_namespace{selectioncollection.cpp}::printCurrentStatus | ( | TextWriter * | writer, |
gmx_ana_selcollection_t * | sc, | ||
gmx_ana_indexgrps_t * | grps, | ||
size_t | firstSelection, | ||
int | maxCount, | ||
const std::string & | context, | ||
bool | bFirst | ||
) |
Print current status in response to empty line in interactive input.
[in] | writer | Writer to use for the output. |
[in] | sc | Selection collection data structure. |
[in] | grps | Available index groups. |
[in] | firstSelection | Index of first selection from this interactive session. |
[in] | maxCount | Maximum number of selections. |
[in] | context | Context to print for what the selections are for. |
[in] | bFirst | Whether this is the header that is printed before any user input. |
Prints the available index groups and currently provided selections.
void gmx::anonymous_namespace{selectioncollection.cpp}::printHelp | ( | TextWriter * | writer, |
gmx_ana_selcollection_t * | sc, | ||
const std::string & | line | ||
) |
Prints selection help in interactive selection input.
[in] | writer | Writer to use for the output. |
[in] | sc | Selection collection data structure. |
[in] | line | Line of user input requesting help (starting with help ). |
Initializes the selection help if not yet initialized, and finds the help topic based on words on the input line.
bool gmx::anonymous_namespace{selectioncollection.cpp}::promptLine | ( | TextInputStream * | inputStream, |
TextWriter * | statusWriter, | ||
std::string * | line | ||
) |
Reads a single selection line from stdin.
[in] | inputStream | Stream to read from (typically the StandardInputStream). |
[in] | statusWriter | Stream to print prompts to (if NULL, no output is done). |
[out] | line | The read line in stored here. |
Handles line continuation, reading also the continuing line(s) in one call.
SelectionList gmx::anonymous_namespace{selectioncollection.cpp}::runParser | ( | yyscan_t | scanner, |
TextInputStream * | inputStream, | ||
bool | bInteractive, | ||
int | maxnr, | ||
const std::string & | context | ||
) |
Helper function that runs the parser once the tokenizer has been initialized.
[in,out] | scanner | Scanner data structure. |
[in] | inputStream | Stream to use for input (currently only with bInteractive==true ). |
[in] | bInteractive | Whether to use a line-based reading algorithm designed for interactive input. |
[in] | maxnr | Maximum number of selections to parse (if -1, parse as many as provided by the user). |
[in] | context | Context to print for what the selections are for. |
std::bad_alloc | if out of memory. |
InvalidInputError | if there is a parsing error. |
Used internally to implement parseInteractive(), parseFromFile() and parseFromString().
int gmx::anonymous_namespace{selectioncollection.cpp}::runParserLoop | ( | yyscan_t | scanner, |
_gmx_sel_yypstate * | parserState, | ||
bool | bInteractive | ||
) |
Helper function for tokenizing the input and pushing them to the parser.
scanner | Tokenizer data structure. | |
parserState | Parser data structure. | |
[in] | bInteractive | Whether to operate in interactive mode. |
Repeatedly reads tokens using scanner
and pushes them to the parser with parserState
until there is no more input, or until enough input is given (only in interactive mode).