2010-04-25 19:59:05 +00:00
/*
* Copyright ( C ) 2010 Thorsten Liebig ( Thorsten . Liebig @ gmx . de )
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef ENGINE_EXTENSION_H
# define ENGINE_EXTENSION_H
2011-03-16 15:26:01 +00:00
# define ENG_EXT_PRIO_DEFAULT 0 //default engine extension priority
// priority definitions for some important extensions
2011-03-17 09:29:48 +00:00
# define ENG_EXT_PRIO_UPML +1e6 //unaxial pml extension priority
2012-06-06 08:28:06 +00:00
# define ENG_EXT_PRIO_CYLINDER +1e5 //cylindrial extension priority
2011-03-17 09:29:48 +00:00
# define ENG_EXT_PRIO_EXCITATION -1000 //excitation priority
# define ENG_EXT_PRIO_CYLINDERMULTIGRID -3000 //cylindrial multi-grid extension priority
2011-03-16 15:26:01 +00:00
# include <string>
2010-04-25 19:59:05 +00:00
class Operator_Extension ;
class Engine ;
//! Abstract base-class for all engine extensions
class Engine_Extension
{
public :
2010-07-15 10:11:48 +00:00
virtual ~ Engine_Extension ( ) ;
2010-10-06 08:30:55 +00:00
virtual void SetNumberOfThreads ( int nrThread ) ;
2010-04-25 19:59:05 +00:00
//! This methode will be called __before__ the main engine does the usual voltage updates. This methode may __not__ change the engine voltages!!!
virtual void DoPreVoltageUpdates ( ) { }
2010-10-06 08:30:55 +00:00
virtual void DoPreVoltageUpdates ( int threadID ) ;
2010-04-25 19:59:05 +00:00
//! This methode will be called __after__ the main engine does the usual voltage updates. This methode may __not__ change the engine voltages!!!
virtual void DoPostVoltageUpdates ( ) { }
2010-10-06 08:30:55 +00:00
virtual void DoPostVoltageUpdates ( int threadID ) ;
2010-04-27 21:06:42 +00:00
//! This methode will be called __after__ all updates to the voltages and extensions and may add/set its results to the engine voltages, but may __not__ rely on the current value of the engine voltages!!!
2010-04-25 19:59:05 +00:00
virtual void Apply2Voltages ( ) { }
2010-10-06 08:30:55 +00:00
virtual void Apply2Voltages ( int threadID ) ;
2010-04-25 19:59:05 +00:00
//! This methode will be called __before__ the main engine does the usual current updates. This methode may __not__ change the engine current!!!
virtual void DoPreCurrentUpdates ( ) { }
2010-10-06 08:30:55 +00:00
virtual void DoPreCurrentUpdates ( int threadID ) ;
2010-04-25 19:59:05 +00:00
//! This methode will be called __after__ the main engine does the usual current updates. This methode may __not__ change the engine current!!!
virtual void DoPostCurrentUpdates ( ) { }
2010-10-06 08:30:55 +00:00
virtual void DoPostCurrentUpdates ( int threadID ) ;
2010-04-27 21:06:42 +00:00
//! This methode will be called __after__ all updates to the current and extensions and may add/set its results to the engine current, but may __not__ rely on the current value of the engine current!!!
2010-04-25 19:59:05 +00:00
virtual void Apply2Current ( ) { }
2010-10-06 08:30:55 +00:00
virtual void Apply2Current ( int threadID ) ;
2010-04-25 19:59:05 +00:00
2010-04-27 21:06:42 +00:00
//! Set the Engine to this extention. This will usually done automatically by Engine::AddExtension
virtual void SetEngine ( Engine * eng ) { m_Eng = eng ; }
2010-09-25 17:23:53 +00:00
//! 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 ) ;
2011-03-16 15:26:01 +00:00
virtual std : : string GetExtensionName ( ) const ;
2010-04-25 19:59:05 +00:00
protected :
2010-04-27 21:06:42 +00:00
Engine_Extension ( Operator_Extension * op_ext ) ;
2010-04-25 19:59:05 +00:00
Operator_Extension * m_Op_ext ;
Engine * m_Eng ;
2010-09-25 17:23:53 +00:00
int m_Priority ;
2010-10-06 08:30:55 +00:00
int m_NrThreads ;
2010-04-25 19:59:05 +00:00
} ;
# endif // ENGINE_EXTENSION_H