From 6353c70ae5f7b3f7f00b3beee793c78f1050f20b Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Mon, 6 Jan 2014 15:40:39 +0100 Subject: [PATCH] Operator: new method to get corresponding engine Signed-off-by: Thorsten Liebig --- FDTD/operator.cpp | 7 ++++--- FDTD/operator.h | 5 ++++- FDTD/operator_cylinder.cpp | 6 +++--- FDTD/operator_cylinder.h | 2 +- FDTD/operator_cylindermultigrid.cpp | 6 +++--- FDTD/operator_cylindermultigrid.h | 2 +- FDTD/operator_mpi.cpp | 7 ++++--- FDTD/operator_mpi.h | 2 +- FDTD/operator_multithread.cpp | 6 +++--- FDTD/operator_multithread.h | 2 +- 10 files changed, 25 insertions(+), 20 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index f34c7a5..59a5993 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -61,15 +61,16 @@ Operator::~Operator() Delete(); } -Engine* Operator::CreateEngine() const +Engine* Operator::CreateEngine() { - Engine* eng = Engine::New(this); - return eng; + m_Engine = Engine::New(this); + return m_Engine; } void Operator::Init() { CSX = NULL; + m_Engine = NULL; Operator_Base::Init(); diff --git a/FDTD/operator.h b/FDTD/operator.h index 8dd259b..65aed18 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -48,7 +48,8 @@ public: static Operator* New(); virtual ~Operator(); - virtual Engine* CreateEngine() const; + virtual Engine* CreateEngine(); + virtual Engine* GetEngine() const {return m_Engine;} virtual bool SetGeometryCSX(ContinuousStructure* geo); @@ -262,6 +263,8 @@ protected: vector m_Op_exts; + Engine* m_Engine; + // excitation classes Excitation* m_Exc; // excitation time signal class // Operator_Ext_Excitation* m_Op_Ext_Exc; // excitation extension diff --git a/FDTD/operator_cylinder.cpp b/FDTD/operator_cylinder.cpp index 88f787f..4ca5134 100644 --- a/FDTD/operator_cylinder.cpp +++ b/FDTD/operator_cylinder.cpp @@ -43,11 +43,11 @@ Operator_Cylinder::~Operator_Cylinder() } -Engine* Operator_Cylinder::CreateEngine() const +Engine* Operator_Cylinder::CreateEngine() { //! create a special cylindrical-engine - Engine_Cylinder* eng = Engine_Cylinder::New(this, m_numThreads); - return eng; + m_Engine = Engine_Cylinder::New(this, m_numThreads); + return m_Engine; } void Operator_Cylinder::Init() diff --git a/FDTD/operator_cylinder.h b/FDTD/operator_cylinder.h index 0ea67bd..a559570 100644 --- a/FDTD/operator_cylinder.h +++ b/FDTD/operator_cylinder.h @@ -90,7 +90,7 @@ public: virtual void AddExtension(Operator_Extension* op_ext); - virtual Engine* CreateEngine() const; + virtual Engine* CreateEngine(); protected: Operator_Cylinder(); diff --git a/FDTD/operator_cylindermultigrid.cpp b/FDTD/operator_cylindermultigrid.cpp index abf19fd..c61dd15 100644 --- a/FDTD/operator_cylindermultigrid.cpp +++ b/FDTD/operator_cylindermultigrid.cpp @@ -49,10 +49,10 @@ Operator_CylinderMultiGrid* Operator_CylinderMultiGrid::New(vector Split return op; } -Engine* Operator_CylinderMultiGrid::CreateEngine() const +Engine* Operator_CylinderMultiGrid::CreateEngine() { - Engine_CylinderMultiGrid* eng = Engine_CylinderMultiGrid::New(this,m_numThreads); - return eng; + m_Engine = Engine_CylinderMultiGrid::New(this,m_numThreads); + return m_Engine; } double Operator_CylinderMultiGrid::GetNumberCells() const diff --git a/FDTD/operator_cylindermultigrid.h b/FDTD/operator_cylindermultigrid.h index 6b30791..57481f1 100644 --- a/FDTD/operator_cylindermultigrid.h +++ b/FDTD/operator_cylindermultigrid.h @@ -37,7 +37,7 @@ public: virtual double GetNumberCells() const; - virtual Engine* CreateEngine() const; + virtual Engine* CreateEngine(); virtual bool SetGeometryCSX(ContinuousStructure* geo); diff --git a/FDTD/operator_mpi.cpp b/FDTD/operator_mpi.cpp index 7526433..432f5d7 100644 --- a/FDTD/operator_mpi.cpp +++ b/FDTD/operator_mpi.cpp @@ -77,12 +77,13 @@ void Operator_MPI::SetBoundaryCondition(int* BCs) Operator_SSE_Compressed::SetBoundaryCondition(BCs); } -Engine* Operator_MPI::CreateEngine() const +Engine* Operator_MPI::CreateEngine() { if (m_MPI_Enabled) - return Engine_MPI::New(this); + m_Engine = Engine_MPI::New(this); 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) diff --git a/FDTD/operator_mpi.h b/FDTD/operator_mpi.h index 18b1403..c09616e 100644 --- a/FDTD/operator_mpi.h +++ b/FDTD/operator_mpi.h @@ -32,7 +32,7 @@ public: virtual void SetBoundaryCondition(int* BCs); - virtual Engine* CreateEngine() const; + virtual Engine* CreateEngine(); virtual void SetTag(int tag) {m_MyTag=tag;} diff --git a/FDTD/operator_multithread.cpp b/FDTD/operator_multithread.cpp index 8768d07..dce406b 100644 --- a/FDTD/operator_multithread.cpp +++ b/FDTD/operator_multithread.cpp @@ -38,10 +38,10 @@ void Operator_Multithread::setNumThreads( unsigned int numThreads ) m_numThreads = numThreads; } -Engine* Operator_Multithread::CreateEngine() const +Engine* Operator_Multithread::CreateEngine() { - Engine_Multithread* e = Engine_Multithread::New(this,m_numThreads); - return e; + m_Engine = Engine_Multithread::New(this,m_numThreads); + return m_Engine; } Operator_Multithread::Operator_Multithread() : OPERATOR_MULTITHREAD_BASE() diff --git a/FDTD/operator_multithread.h b/FDTD/operator_multithread.h index 32103b1..65f4748 100644 --- a/FDTD/operator_multithread.h +++ b/FDTD/operator_multithread.h @@ -40,7 +40,7 @@ public: virtual void setNumThreads( unsigned int numThreads ); - virtual Engine* CreateEngine() const; + virtual Engine* CreateEngine(); protected: Operator_Multithread();