inline Token Lexer::slash() { // We've already consumed the character, // while trying to parse for a comment start. return symbol0(); }
inline Token Lexer::rangle() { assert(peek() == '>'); get(); if (peek() == '=') return symbol1(); else return symbol0(); }
// Lex one of '=' or '=='. inline Token Lexer::equal() { assert(peek() == '='); get(); if (peek() == '=') return symbol1(); else return symbol0(); }
// Lex one of '-' or '->'. inline Token Lexer::minus() { assert(peek() == '-'); get(); if (peek() == '>') return symbol1(); else return symbol0(); }
void StabilizeStepper::initialize_neighbor_list_managers() { const std::size_t num_beads(_space->num_beads()); PairList bond_pair(num_beads); std::list<std::pair<std::size_t, std::size_t> > bonds(_model->list_bonds()); for (auto itr(bonds.begin()); itr != bonds.end(); itr++) { bond_pair.add_pair(*itr); bond_pair.add_pair(std::make_pair((*itr).second, (*itr).first)); } PairList excludes(num_beads); for (std::size_t i(0); i < num_beads; ++i) { for (auto itr(bond_pair.begin(i)); itr != bond_pair.end(i); ++itr) { excludes.add_pair(std::make_pair(i, *itr)); for (auto jtr(bond_pair.begin(*itr)); jtr != bond_pair.end(*itr); ++jtr) { excludes.add_pair(std::make_pair(i, *jtr)); } } } Model::inter_potential_container inter_potentials(_model->list_inter_potentials()); for (auto itr(inter_potentials.begin()); itr != inter_potentials.end(); ++itr) { const double r_c((*itr)->get_cutoff_radius()); NeighborListManager manager(num_beads, r_c, r_c*3, std::numeric_limits<double>::infinity()); // TODO parameter fitting (*itr)->set_neighbor_list(manager.get_neighbor_list()); for (std::size_t i(0); i < num_beads-1; ++i) { std::string symbol0(_space->symbol(i)); for (std::size_t j(i+1); j < num_beads; j++) { std::string symbol1(_space->symbol(j)); if ((*itr)->is_valid_pair(symbol0, symbol1)) { bool is_exclude(false); for (auto itr2(excludes.begin(i)); itr2 != excludes.end(i); ++itr2) if (j == *itr2) { is_exclude = true; break; } if (!is_exclude) manager.add_candidate(std::make_pair(i,j)); } } } manager.update(*(_space.get())); _neighbor_list_managers.push_back(manager); } }