evil hack to get multithreading working again

future: restructure the multithreading engine to only work on top the sse_compressed engine
pull/1/head
Sebastian Held 2010-05-20 17:39:39 +02:00
parent c71b0154a1
commit df17dc23c6
3 changed files with 11 additions and 3 deletions

View File

@ -21,6 +21,10 @@
#include <fstream>
#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<Engine_Extension*> 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

View File

@ -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;n<m_enginePtr->m_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;n<m_enginePtr->m_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
}

View File

@ -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);