std::string LLUriTemplate::expandJoin(const std::string& delim, const std::string& var_list, const LLSD& vars) { std::ostringstream query; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep(","); tokenizer var_names(var_list, sep); tokenizer::const_iterator it = var_names.begin(); // First var does not need a delimiter if (it != var_names.end()) { const std::string& name = *it; if (vars.has(name)) { // URL encode the value before appending the name=value pair. query << name << "=" << escapeURL(vars[name].asString()); } } for (++it; it != var_names.end(); ++it) { const std::string& name = *it; if (vars.has(name)) { // URL encode the value before appending the name=value pair. query << delim << name << "=" << escapeURL(vars[name].asString()); } } return query.str(); }
SideValueSampler::SideValueSampler(const InputParameters & parameters) : SideVectorPostprocessor(parameters), SamplerBase(parameters, this, _communicator) { std::vector<std::string> var_names(_coupled_moose_vars.size()); _values.resize(_coupled_moose_vars.size()); for (unsigned int i = 0; i < _coupled_moose_vars.size(); i++) var_names[i] = _coupled_moose_vars[i]->name(); // Initialize the datastructions in SamplerBase SamplerBase::setupVariables(var_names); }
PointSamplerBase::PointSamplerBase(const InputParameters & parameters) : GeneralVectorPostprocessor(parameters), CoupleableMooseVariableDependencyIntermediateInterface(parameters, false), SamplerBase(parameters, this, _communicator), _mesh(_subproblem.mesh()), _point_vec(1) // Only going to evaluate one point at a time for now { std::vector<std::string> var_names(_coupled_moose_vars.size()); for (unsigned int i=0; i<_coupled_moose_vars.size(); i++) var_names[i] = _coupled_moose_vars[i]->name(); // Initialize the datastructions in SamplerBase SamplerBase::setupVariables(var_names); }
bool ModificationDefinitionsSet::isCompatible(const AASequence & peptide) const { set<String> var_names(getVariableModificationNames()), fixed_names(getFixedModificationNames()); // no modifications present and needed if (fixed_names.empty() && !peptide.isModified()) { return true; } // check whether the fixed modifications are fulfilled if (!fixed_names.empty()) { for (set<String>::const_iterator it1 = fixed_names.begin(); it1 != fixed_names.end(); ++it1) { String origin = ModificationsDB::getInstance()->getModification(*it1).getOrigin(); // only single 1lc amino acids are allowed if (origin.size() != 1) { continue; } for (AASequence::ConstIterator it2 = peptide.begin(); it2 != peptide.end(); ++it2) { if (origin == it2->getOneLetterCode()) { // check whether the residue is modified (has to be) if (!it2->isModified()) { return false; } // check whether the modification is the same if (ModificationsDB::getInstance()->getModification(*it1).getId() != it2->getModification()) { return false; } } } } } // check wether other modifications than the variable are present for (AASequence::ConstIterator it = peptide.begin(); it != peptide.end(); ++it) { if (it->isModified()) { String mod = ModificationsDB::getInstance()->getModification(it->getOneLetterCode(), it->getModification(), ResidueModification::ANYWHERE).getFullId(); if (var_names.find(mod) == var_names.end() && fixed_names.find(mod) == fixed_names.end()) { return false; } } } if (peptide.hasNTerminalModification()) { String mod = ModificationsDB::getInstance()->getTerminalModification(peptide.getNTerminalModification(), ResidueModification::N_TERM).getFullId(); if (var_names.find(mod) == var_names.end() && fixed_names.find(mod) == fixed_names.end()) { return false; } } if (peptide.hasCTerminalModification()) { String mod = ModificationsDB::getInstance()->getTerminalModification(peptide.getCTerminalModification(), ResidueModification::C_TERM).getFullId(); if (var_names.find(mod) == var_names.end() && fixed_names.find(mod) == fixed_names.end()) { return false; } } return true; }