void SelectionCollection::compile() { if (_impl->_sc.top == NULL && requiresTopology()) { GMX_THROW(InconsistentInputError("Selection requires topology information, but none provided")); } if (!_impl->hasFlag(Impl::efExternalGroupsSet)) { setIndexGroups(NULL); } if (_impl->_debugLevel >= 1) { printTree(stderr, false); } SelectionCompiler compiler; compiler.compile(this); if (_impl->hasFlag(Impl::efOwnPositionCollection)) { if (_impl->_debugLevel >= 1) { std::fprintf(stderr, "\n"); printTree(stderr, false); std::fprintf(stderr, "\n"); gmx_ana_poscalc_coll_print_tree(stderr, _impl->_sc.pcc); std::fprintf(stderr, "\n"); } gmx_ana_poscalc_init_eval(_impl->_sc.pcc); if (_impl->_debugLevel >= 1) { gmx_ana_poscalc_coll_print_tree(stderr, _impl->_sc.pcc); std::fprintf(stderr, "\n"); } } }
void SelectionCollection::compile() { if (impl_->sc_.top == NULL && requiresTopology()) { GMX_THROW(InconsistentInputError("Selection requires topology information, but none provided")); } if (!impl_->bExternalGroupsSet_) { setIndexGroups(NULL); } if (impl_->debugLevel_ >= 1) { printTree(stderr, false); } SelectionCompiler compiler; compiler.compile(this); if (impl_->debugLevel_ >= 1) { std::fprintf(stderr, "\n"); printTree(stderr, false); std::fprintf(stderr, "\n"); impl_->sc_.pcc.printTree(stderr); std::fprintf(stderr, "\n"); } impl_->sc_.pcc.initEvaluation(); if (impl_->debugLevel_ >= 1) { impl_->sc_.pcc.printTree(stderr); std::fprintf(stderr, "\n"); } // TODO: It would be nicer to associate the name of the selection option // (if available) to the error message. SelectionDataList::const_iterator iter; for (iter = impl_->sc_.sel.begin(); iter != impl_->sc_.sel.end(); ++iter) { const internal::SelectionData &sel = **iter; if (sel.hasFlag(efSelection_OnlyAtoms)) { if (!sel.hasOnlyAtoms()) { std::string message = formatString( "Selection '%s' does not evaluate to individual atoms. " "This is not allowed in this context.", sel.selectionText()); GMX_THROW(InvalidInputError(message)); } } if (sel.hasFlag(efSelection_DisallowEmpty)) { if (sel.posCount() == 0) { std::string message = formatString( "Selection '%s' never matches any atoms.", sel.selectionText()); GMX_THROW(InvalidInputError(message)); } } } }