From df17dc23c6f96e8b1472425bd650284d0b85b5cc Mon Sep 17 00:00:00 2001 From: Sebastian Held Date: Thu, 20 May 2010 17:39:39 +0200 Subject: [PATCH] evil hack to get multithreading working again future: restructure the multithreading engine to only work on top the sse_compressed engine --- FDTD/engine.h | 6 ++++++ FDTD/engine_multithread.cpp | 6 +++--- FDTD/engine_multithread.h | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/FDTD/engine.h b/FDTD/engine.h index b0f52ac..6dd8c0d 100644 --- a/FDTD/engine.h +++ b/FDTD/engine.h @@ -21,6 +21,10 @@ #include #include "operator.h" +namespace NS_Engine_Multithread { + class thread; // evil hack to access numTS from multithreading context +} + class Engine_Extension; class Engine @@ -74,6 +78,8 @@ protected: vector m_Eng_exts; ofstream file_et; //excite signal dump file + + friend class NS_Engine_Multithread::thread; // evil hack to access numTS from multithreading context }; #endif // ENGINE_H diff --git a/FDTD/engine_multithread.cpp b/FDTD/engine_multithread.cpp index 1f93d67..b1995c0 100644 --- a/FDTD/engine_multithread.cpp +++ b/FDTD/engine_multithread.cpp @@ -243,7 +243,7 @@ void thread::operator()() // excitation finished if (m_threadID == 0) - ++m_enginePtr->numTS; // only the first thread increments numTS + ++m_enginePtr->m_RunEngine->numTS; // only the first thread increments numTS } m_enginePtr->m_stopBarrier->wait(); @@ -276,7 +276,7 @@ void thread_e_excitation::operator()() for (size_t n=0;nm_RunEngine->GetExtensionCount();++n) m_enginePtr->m_RunEngine->GetExtension(n)->Apply2Voltages(); - m_enginePtr->ApplyVoltageExcite(); + m_enginePtr->m_RunEngine->ApplyVoltageExcite(); m_enginePtr->m_barrier_VoltExcite->wait(); // continue NS_Engine_Multithread::thread @@ -286,7 +286,7 @@ void thread_e_excitation::operator()() for (size_t n=0;nm_RunEngine->GetExtensionCount();++n) m_enginePtr->m_RunEngine->GetExtension(n)->Apply2Current(); - m_enginePtr->ApplyCurrentExcite(); + m_enginePtr->m_RunEngine->ApplyCurrentExcite(); m_enginePtr->m_barrier_CurrExcite->wait(); // continue NS_Engine_Multithread::thread } diff --git a/FDTD/engine_multithread.h b/FDTD/engine_multithread.h index bd5afcb..c4dc7cf 100644 --- a/FDTD/engine_multithread.h +++ b/FDTD/engine_multithread.h @@ -92,6 +92,8 @@ public: virtual void Init(); virtual void Reset(); + virtual unsigned int GetNumberOfTimesteps() {return m_RunEngine->GetNumberOfTimesteps();} + //!Iterate a number of timesteps virtual bool IterateTS(unsigned int iterTS);