From 0daf63e3be0468d7b1e0ee3e3d2e70000f394b20 Mon Sep 17 00:00:00 2001 From: chihebabid <chiheb.abid@fst.utm.tn> Date: Mon, 9 May 2022 22:07:55 +0100 Subject: [PATCH] Fixed some errors --- src/algorithm/CNDFS.cpp | 8 ++++---- src/algorithm/CNDFS.h | 15 ++++++++++----- src/main.cpp | 11 ++++++----- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/algorithm/CNDFS.cpp b/src/algorithm/CNDFS.cpp index 1da869c..c29ddcb 100644 --- a/src/algorithm/CNDFS.cpp +++ b/src/algorithm/CNDFS.cpp @@ -38,8 +38,8 @@ CNDFS::~CNDFS()=default; //structure qui represente le produit de 2 états - void CNDFS::DfsBlue(ModelCheckBaseMT &mcl,shared_ptr<spot::twa_graph> a) { - mMcl = &mcl; + void CNDFS::DfsBlue() { + //cout << "First state SOG from CNDFS " << mMcl->getInitialMetaState() << endl; //cout << "First state SOG from CNDFS " << typeid(m.getGraph()->getInitialAggregate()->getSuccessors()).name() << endl; //cout << "First state BA from CNDFS " << a->get_init_state()<<endl; @@ -47,7 +47,7 @@ CNDFS::~CNDFS()=default; //iterate succ of BA initial state //mtx.lock(); - spot::twa_succ_iterator* i = a->succ_iter(a->get_init_state()); + spot::twa_succ_iterator* i = mAa->succ_iter(mAa->get_init_state()); if (i->first()) do { @@ -56,7 +56,7 @@ CNDFS::~CNDFS()=default; << std::this_thread::get_id()<< endl; } while (i->next()); - a->release_iter(i); + mAa->release_iter(i); //mtx.unlock(); //iterate succ of SOG first state diff --git a/src/algorithm/CNDFS.h b/src/algorithm/CNDFS.h index c6022dd..8e18943 100644 --- a/src/algorithm/CNDFS.h +++ b/src/algorithm/CNDFS.h @@ -4,20 +4,25 @@ #ifndef PMC_SOG_CNDFS_H #define PMC_SOG_CNDFS_H -#include "ModelCheckBaseMT.h" -#include "SogKripkeTh.h" +#include "../ModelCheckBaseMT.h" + #include <spot/tl/apcollect.hh> class CNDFS { private: - static ModelCheckBaseMT *mMcl; + ModelCheckBaseMT *mMcl; shared_ptr<spot::twa_graph> mAa; + uint16_t mNbTh; public: //CNDFS(ModelCheckBaseMT *mMcl, const shared_ptr<spot::twa_graph> &mAa); - + CNDFS(ModelCheckBaseMT &mcl,shared_ptr<spot::twa_graph> af,const uint16_t& nbTh) { + mMcl=&mcl; + mAa=af; + mNbTh=nbTh; // nulber of threads to be created + } virtual ~CNDFS(); //static void DfsBlue(); - static void DfsBlue(ModelCheckBaseMT &mcl, shared_ptr<spot::twa_graph> af); + void DfsBlue(); // static void spawnThreads(int n, ModelCheckBaseMT &mcl, shared_ptr<spot::twa_graph> af); }; diff --git a/src/main.cpp b/src/main.cpp index 73a8fcf..7430056 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -527,13 +527,14 @@ int main(int argc, char **argv) // cout<<"pointeur sur sog "<< typeid(mcl).name() <<endl; // cout <<"pointeur sur BA "<< typeid(aa).name() <<endl; - CNDFS cndfs; + CNDFS cndfs(*mcl,aa,3); + + // You have now to call a non static method of object cndfs that will create threads and execute your dfs algorithm + // Your static method should be defined as private and called by a non static method + // try else you send me a request tomorrw if you have pbs //CNDFS cndfs(*mcl, aa); //cndfs.DfsBlue(*mcl, aa); - thread thread_1 (cndfs.DfsBlue,ref(*mcl),ref(aa)); - thread thread_2 (cndfs.DfsBlue,ref(*mcl),ref(aa)); - thread_1.join(); - thread_2.join(); + // n.spawnThreads(2,*mcl,aa); return(0); -- GitLab