new extension priority system
parent
832792eb8e
commit
af922a10bc
|
@ -56,6 +56,7 @@ void Engine::Init()
|
|||
file_ht.open( "ht" );
|
||||
|
||||
InitExtensions();
|
||||
SortExtensionByPriority();
|
||||
}
|
||||
|
||||
void Engine::InitExtensions()
|
||||
|
@ -79,6 +80,17 @@ void Engine::ClearExtensions()
|
|||
m_Eng_exts.clear();
|
||||
}
|
||||
|
||||
bool CompareExtensions(Engine_Extension* i, Engine_Extension* j)
|
||||
{
|
||||
return (*i<*j);
|
||||
}
|
||||
|
||||
void Engine::SortExtensionByPriority()
|
||||
{
|
||||
stable_sort(m_Eng_exts.begin(),m_Eng_exts.end(), CompareExtensions);
|
||||
reverse(m_Eng_exts.begin(),m_Eng_exts.end());
|
||||
}
|
||||
|
||||
void Engine::Reset()
|
||||
{
|
||||
Delete_N_3DArray(volt,numLines);
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
|
||||
inline size_t GetExtensionCount() {return m_Eng_exts.size();}
|
||||
inline Engine_Extension* GetExtension(size_t nr) {return m_Eng_exts.at(nr);}
|
||||
virtual void SortExtensionByPriority();
|
||||
|
||||
EngineType GetType() const {return m_type;}
|
||||
|
||||
|
|
|
@ -100,6 +100,9 @@ void Engine_CylinderMultiGrid::Init()
|
|||
|
||||
t = new boost::thread( Engine_CylinderMultiGrid_Thread(m_InnerEngine,m_startBarrier,m_stopBarrier,&m_Thread_NumTS, false) );
|
||||
m_IteratorThread_Group.add_thread( t );
|
||||
|
||||
m_InnerEngine->SortExtensionByPriority();
|
||||
SortExtensionByPriority();
|
||||
}
|
||||
|
||||
bool Engine_CylinderMultiGrid::IterateTS(unsigned int iterTS)
|
||||
|
|
|
@ -28,6 +28,9 @@ Engine_Ext_Cylinder::Engine_Ext_Cylinder(Operator_Ext_Cylinder* op_ext) : Engine
|
|||
|
||||
for (int n=0;n<3;++n)
|
||||
numLines[n] = op_ext->m_Op->GetOriginalNumLines(n);
|
||||
|
||||
//this cylindrical extension should be executed first?
|
||||
m_Priority = 2000;
|
||||
}
|
||||
|
||||
void Engine_Ext_Cylinder::Apply2Voltages()
|
||||
|
|
|
@ -23,6 +23,9 @@ Engine_Ext_CylinderMultiGrid::Engine_Ext_CylinderMultiGrid(Operator_Extension* o
|
|||
{
|
||||
m_IsBase = isBase;
|
||||
m_Eng_MG = NULL;
|
||||
|
||||
// the multi-grid should be applies last?
|
||||
m_Priority = -1000;
|
||||
}
|
||||
|
||||
Engine_Ext_CylinderMultiGrid::~Engine_Ext_CylinderMultiGrid()
|
||||
|
|
|
@ -23,8 +23,14 @@ Engine_Extension::Engine_Extension(Operator_Extension* op_ext)
|
|||
{
|
||||
m_Op_ext = op_ext;
|
||||
m_Eng = NULL;
|
||||
m_Priority = 0;
|
||||
}
|
||||
|
||||
Engine_Extension::~Engine_Extension()
|
||||
{
|
||||
}
|
||||
|
||||
bool Engine_Extension::operator< (const Engine_Extension& other)
|
||||
{
|
||||
return (GetPriority()<other.GetPriority());
|
||||
}
|
||||
|
|
|
@ -43,11 +43,22 @@ public:
|
|||
|
||||
//! Set the Engine to this extention. This will usually done automatically by Engine::AddExtension
|
||||
virtual void SetEngine(Engine* eng) {m_Eng=eng;}
|
||||
|
||||
//! Get the priority for this extension
|
||||
virtual int GetPriority() const {return m_Priority;}
|
||||
|
||||
//! Set the priority for this extension
|
||||
virtual void SetPriority(int val) {m_Priority=val;}
|
||||
|
||||
virtual bool operator< (const Engine_Extension& other);
|
||||
|
||||
protected:
|
||||
Engine_Extension(Operator_Extension* op_ext);
|
||||
|
||||
Operator_Extension* m_Op_ext;
|
||||
Engine* m_Eng;
|
||||
|
||||
int m_Priority;
|
||||
};
|
||||
|
||||
#endif // ENGINE_EXTENSION_H
|
||||
|
|
Loading…
Reference in New Issue