本文整理汇总了C++中Species::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Species::getName方法的具体用法?C++ Species::getName怎么用?C++ Species::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Species
的用法示例。
在下文中一共展示了Species::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSpeceis
void VideoWindow::loadSpeceis()
{
Database db;
QList<Species> species = db.getAllSpecies();
QStringList completions;
for(int l = 0; l < species.size(); l++){
Species sp = species.at(l);
QString name = sp.getName().toString();
completions.push_back(name);
}
QCompleter *completer = new QCompleter(completions, this);
completer->setCompletionMode(QCompleter::PopupCompletion);
this->ui->species->setCompleter(completer);
}
示例2: insertSpecie
int Database::insertSpecie(Species s)
{
QVariant name = s.getName().toString().toLower();
if(!this->specieExist(name)){
this->query.prepare("INSERT INTO Species (name) VALUES (:name);");
this->query.bindValue(":name",name);
if(!this->query.exec()){
this->showError(this->query.lastError());
return -1;
}
return this->query.lastInsertId().toInt();
}
this->showError(QMessageBox::tr("Essa espécie já existe!"));
return 0;
}
示例3: editSpecies
int Database::editSpecies(Species s)
{
QVariant name = s.getName().toString().toLower();
if(this->specieExist(name) > 0){
this->showError(QMessageBox::tr("Esta espécie já existe"));
return 0;
}
if(this->specieExist(name) <= 0){
this->query.prepare("UPDATE Species SET name=? WHERE Species.id=?;");
this->query.addBindValue(name);
this->query.addBindValue(s.getId());
if(!this->query.exec()){
this->showError(this->query.lastError());
return -1;
}
return 1;
}
QMessageBox::information(0, QMessageBox::tr("Erro"),QMessageBox::tr("Espécie não encontrada!"));
return 0;
}
示例4: if
/* create MOLECULE */
const SbmlReader::sbmlStr_mooseId SbmlReader::createMolecule( map< string,Id > &comptSidMIdMap) {
Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() );
map< string, Id >molSidcmptMIdMap;
double transvalue = 0.0;
int num_species = model_->getNumSpecies();
if (num_species == 0) {
baseId = Id();
errorFlag_ = true;
return molSidcmptMIdMap;
}
for ( int sindex = 0; sindex < num_species; sindex++ ) {
Species* spe = model_->getSpecies(sindex);
if (!spe) {
continue;
}
std::string compt = "";
if ( spe->isSetCompartment() ) {
compt = spe->getCompartment();
}
if (compt.length()< 1) {
//cout << "compt is empty for species "<< sindex << endl;
continue;
}
string id = spe->getId();
if (id.length() < 1) {
continue;
}
std::string name = "";
if ( spe->isSetName() ) {
name = spe->getName();
name = nameString(name);
}
if (name.empty())
name = id;
double initvalue =0.0;
if ( spe->isSetInitialConcentration() )
initvalue = spe->getInitialConcentration();
else if ( spe->isSetInitialAmount() )
initvalue = spe->getInitialAmount() ;
else {
unsigned int nr = model_->getNumRules();
bool found = false;
for ( unsigned int r = 0; r < nr; r++ ) {
Rule * rule = model_->getRule(r);
bool assignRule = rule->isAssignment();
if ( assignRule ) {
string rule_variable = rule->getVariable();
if (rule_variable.compare(id) == 0) {
found = true;
break;
}
}
}
if (found == false) {
cout << "Invalid SBML: Either initialConcentration or initialAmount must be set or it should be found in assignmentRule but non happening for " << spe->getName() <<endl;
return molSidcmptMIdMap;
}
}
Id comptEl = comptSidMIdMap[compt];
Id meshEntry = Neutral::child( comptEl.eref(), "mesh" );
bool constant = spe->getConstant();
bool boundaryCondition = spe->getBoundaryCondition();
if (boundaryCondition == true)
cout << "Pools having BoundaryCondition true " << name <<endl;
Id pool;
//If constant is true then its equivalent to BuffPool in moose
if (constant == true)
//if( (boundaryCondition == true) && (constant==false))
pool = shell->doCreate("BufPool",comptEl,name,1);
else
pool = shell->doCreate("Pool", comptEl, name ,1);
molSidcmptMIdMap[id] = comptEl;
//Map to Molecule SBML id to Moose Id
molSidMIdMap_[id] = pool;
//shell->doAddMsg( "OneToOne",pool, "mesh", meshEntry, "mesh" );
bool bcondition = spe->getBoundaryCondition();
if ( constant == true && bcondition == false)
cout <<"The species "<< name << " should not appear in reactant or product as per sbml Rules"<< endl;
unsigned int spatialDimen =Field< unsigned int >::get( comptEl, "numDimensions");
UnitDefinition * ud = spe->getDerivedUnitDefinition();
assert(ud != NULL);
bool hasonlySubUnit = spe->getHasOnlySubstanceUnits();
//double v = Field< double >::get( comptEl.path(), "volume" );
transvalue = transformUnits(1,ud,"substance",hasonlySubUnit);
if (hasonlySubUnit) {
// In Moose, no. of molecules (nInit) and unit is "item"
if (spatialDimen > 0 && spe->isSetInitialAmount() ) {
//transvalue *= initvalue;
initvalue *=transvalue;
Field < double> :: set( pool, "nInit", initvalue);
}
} else {
//.........这里部分代码省略.........