Printing of reactions

This commit is contained in:
Artur Meski
2018-03-28 18:58:59 +01:00
parent 99fbed638c
commit 753b217721
2 changed files with 25 additions and 6 deletions

26
rs.cc
View File

@@ -101,6 +101,16 @@ Process RctSys::getProcessID(std::string processName)
return processes_names[processName];
}
std::string RctSys::getProcessName(Process processID)
{
if (processID < processes_ids.size())
return processes_ids[processID];
else
{
FERROR("No such process ID: " << processID);
}
}
void RctSys::pushReactant(std::string entityName)
{
if (!hasEntity(entityName))
@@ -155,12 +165,20 @@ std::string RctSys::entitiesToStr(const Entities &entities)
void RctSys::showReactions(void)
{
cout << "# Reactions:" << endl;
for (auto r = reactions.begin(); r != reactions.end(); ++r)
for (unsigned int proc_id = 0; proc_id < processes_ids.size(); ++proc_id)
{
cout << " * (R={" << entitiesToStr(r->rctt) << "},"
<< "I={" << entitiesToStr(r->inhib) << "},"
<< "P={" << entitiesToStr(r->prod) << "})" << endl;
cout << endl;
cout << " . proc = \"" << getProcessName(proc_id) << "\":" << endl;
for (const auto &r : proc_reactions[proc_id])
{
cout << " * (R={" << entitiesToStr(r.rctt) << "},"
<< "I={" << entitiesToStr(r.inhib) << "},"
<< "P={" << entitiesToStr(r.prod) << "})" << endl;
}
}
cout << endl;
}
void RctSys::pushStateEntity(std::string entityName)

1
rs.hh
View File

@@ -43,6 +43,7 @@ class RctSys
void addProcess(std::string processName);
bool hasProcess(std::string processName);
Process getProcessID(std::string processName);
std::string getProcessName(Process processID);
void addReactionForCurrentProcess(Reaction reaction);