From c89e33686255597266837f3989e82dca6b993a2a Mon Sep 17 00:00:00 2001 From: Artur Meski Date: Fri, 30 Mar 2018 18:30:08 +0100 Subject: [PATCH] Printing of entities per proc --- rs.cc | 14 ++++++++++++++ rs.hh | 2 ++ symrs.cc | 19 ++++--------------- symrs.hh | 5 ++--- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/rs.cc b/rs.cc index 99b85d8..4070708 100644 --- a/rs.cc +++ b/rs.cc @@ -119,6 +119,20 @@ std::string RctSys::getProcessName(Process processID) } } +void RctSys::printEntitiesPerProc(const EntitiesForProc &proc_entities) +{ + for (const auto &pe : proc_entities) { + std::string proc_name = getProcessName(pe.first); + cout << proc_name << ": "; + + for (const auto &ent : pe.second) { + cout << getEntityName(ent) << " "; + } + + cout << endl; + } +} + void RctSys::pushReactant(std::string entityName) { if (!hasEntity(entityName)) { diff --git a/rs.hh b/rs.hh index 0247a24..e50efec 100644 --- a/rs.hh +++ b/rs.hh @@ -49,6 +49,8 @@ class RctSys Process getProcessID(std::string processName); std::string getProcessName(Process processID); + void printEntitiesPerProc(const EntitiesForProc &proc_entities); + void addReactionForCurrentProcess(Reaction reaction); void pushReactant(std::string entityName); diff --git a/symrs.cc b/symrs.cc index 3044b3a..1c35d7e 100644 --- a/symrs.cc +++ b/symrs.cc @@ -74,30 +74,19 @@ void SymRS::mapProcEntities(void) // collect entities that can be produced // locally by the process with proc_id - SET_ADD(usedEntities[proc_id], rct.prod); + SET_ADD(usedProducts[proc_id], rct.prod); } } // Context automaton - // for () - printUsedEntitiesPerProc(); + // for (const ) + // usedCtxEntities + rs->printEntitiesPerProc(usedProducts); } -void SymRS::printUsedEntitiesPerProc(void) -{ - for (const auto &proc_entities : usedEntities) { - std::string proc_name = rs->getProcessName(proc_entities.first); - cout << proc_name << ": "; - for (const auto &ent : proc_entities.second) { - cout << rs->getEntityName(ent) << " "; - } - - cout << endl; - } -} BDD SymRS::encEntity_raw(Entity entity, bool succ) const { diff --git a/symrs.hh b/symrs.hh index 63d6fd1..7cdeb6b 100644 --- a/symrs.hh +++ b/symrs.hh @@ -235,7 +235,8 @@ class SymRS unsigned int totalActions; unsigned int totalCtxAutStateVars; - EntitiesForProc usedEntities; + EntitiesForProc usedProducts; + EntitiesForProc usedCtxEntities; BDD encEntity_raw(Entity entity, bool succ) const; BDD encEntity(Entity entity) const @@ -298,8 +299,6 @@ class SymRS void mapProcEntities(void); void encode(void); - void printUsedEntitiesPerProc(void); - int getMappedStateToActID(int stateID) const { assert(stateID < static_cast(totalRctSysStateVars));