Operator: new method to get corresponding engine

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/12/head
Thorsten Liebig 2014-01-06 15:40:39 +01:00
parent 3d66de64d8
commit 6353c70ae5
10 changed files with 25 additions and 20 deletions

View File

@ -61,15 +61,16 @@ Operator::~Operator()
Delete(); Delete();
} }
Engine* Operator::CreateEngine() const Engine* Operator::CreateEngine()
{ {
Engine* eng = Engine::New(this); m_Engine = Engine::New(this);
return eng; return m_Engine;
} }
void Operator::Init() void Operator::Init()
{ {
CSX = NULL; CSX = NULL;
m_Engine = NULL;
Operator_Base::Init(); Operator_Base::Init();

View File

@ -48,7 +48,8 @@ public:
static Operator* New(); static Operator* New();
virtual ~Operator(); virtual ~Operator();
virtual Engine* CreateEngine() const; virtual Engine* CreateEngine();
virtual Engine* GetEngine() const {return m_Engine;}
virtual bool SetGeometryCSX(ContinuousStructure* geo); virtual bool SetGeometryCSX(ContinuousStructure* geo);
@ -262,6 +263,8 @@ protected:
vector<Operator_Extension*> m_Op_exts; vector<Operator_Extension*> m_Op_exts;
Engine* m_Engine;
// excitation classes // excitation classes
Excitation* m_Exc; // excitation time signal class Excitation* m_Exc; // excitation time signal class
// Operator_Ext_Excitation* m_Op_Ext_Exc; // excitation extension // Operator_Ext_Excitation* m_Op_Ext_Exc; // excitation extension

View File

@ -43,11 +43,11 @@ Operator_Cylinder::~Operator_Cylinder()
} }
Engine* Operator_Cylinder::CreateEngine() const Engine* Operator_Cylinder::CreateEngine()
{ {
//! create a special cylindrical-engine //! create a special cylindrical-engine
Engine_Cylinder* eng = Engine_Cylinder::New(this, m_numThreads); m_Engine = Engine_Cylinder::New(this, m_numThreads);
return eng; return m_Engine;
} }
void Operator_Cylinder::Init() void Operator_Cylinder::Init()

View File

@ -90,7 +90,7 @@ public:
virtual void AddExtension(Operator_Extension* op_ext); virtual void AddExtension(Operator_Extension* op_ext);
virtual Engine* CreateEngine() const; virtual Engine* CreateEngine();
protected: protected:
Operator_Cylinder(); Operator_Cylinder();

View File

@ -49,10 +49,10 @@ Operator_CylinderMultiGrid* Operator_CylinderMultiGrid::New(vector<double> Split
return op; return op;
} }
Engine* Operator_CylinderMultiGrid::CreateEngine() const Engine* Operator_CylinderMultiGrid::CreateEngine()
{ {
Engine_CylinderMultiGrid* eng = Engine_CylinderMultiGrid::New(this,m_numThreads); m_Engine = Engine_CylinderMultiGrid::New(this,m_numThreads);
return eng; return m_Engine;
} }
double Operator_CylinderMultiGrid::GetNumberCells() const double Operator_CylinderMultiGrid::GetNumberCells() const

View File

@ -37,7 +37,7 @@ public:
virtual double GetNumberCells() const; virtual double GetNumberCells() const;
virtual Engine* CreateEngine() const; virtual Engine* CreateEngine();
virtual bool SetGeometryCSX(ContinuousStructure* geo); virtual bool SetGeometryCSX(ContinuousStructure* geo);

View File

@ -77,12 +77,13 @@ void Operator_MPI::SetBoundaryCondition(int* BCs)
Operator_SSE_Compressed::SetBoundaryCondition(BCs); Operator_SSE_Compressed::SetBoundaryCondition(BCs);
} }
Engine* Operator_MPI::CreateEngine() const Engine* Operator_MPI::CreateEngine()
{ {
if (m_MPI_Enabled) if (m_MPI_Enabled)
return Engine_MPI::New(this); m_Engine = Engine_MPI::New(this);
else else
return Engine_SSE_Compressed::New(this); m_Engine = Engine_SSE_Compressed::New(this);
return m_Engine;
} }
void Operator_MPI::SetNeighborUp(int ny, int id) void Operator_MPI::SetNeighborUp(int ny, int id)

View File

@ -32,7 +32,7 @@ public:
virtual void SetBoundaryCondition(int* BCs); virtual void SetBoundaryCondition(int* BCs);
virtual Engine* CreateEngine() const; virtual Engine* CreateEngine();
virtual void SetTag(int tag) {m_MyTag=tag;} virtual void SetTag(int tag) {m_MyTag=tag;}

View File

@ -38,10 +38,10 @@ void Operator_Multithread::setNumThreads( unsigned int numThreads )
m_numThreads = numThreads; m_numThreads = numThreads;
} }
Engine* Operator_Multithread::CreateEngine() const Engine* Operator_Multithread::CreateEngine()
{ {
Engine_Multithread* e = Engine_Multithread::New(this,m_numThreads); m_Engine = Engine_Multithread::New(this,m_numThreads);
return e; return m_Engine;
} }
Operator_Multithread::Operator_Multithread() : OPERATOR_MULTITHREAD_BASE() Operator_Multithread::Operator_Multithread() : OPERATOR_MULTITHREAD_BASE()

View File

@ -40,7 +40,7 @@ public:
virtual void setNumThreads( unsigned int numThreads ); virtual void setNumThreads( unsigned int numThreads );
virtual Engine* CreateEngine() const; virtual Engine* CreateEngine();
protected: protected:
Operator_Multithread(); Operator_Multithread();