diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index 6c1b473..70c99a3 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -17,6 +17,7 @@ #include #include "operator.h" +#include "engine.h" #include "operator_extension.h" #include "processfields.h" #include "tools/array_ops.h" @@ -43,6 +44,12 @@ Operator::~Operator() Reset(); } +Engine* Operator::CreateEngine() +{ + Engine* eng = Engine::New(this); + return eng; +} + void Operator::Init() { CSX = NULL; diff --git a/FDTD/operator.h b/FDTD/operator.h index b924923..3450705 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -24,6 +24,7 @@ #include "excitation.h" class Operator_Extension; +class Engine; //! Abstract base-class for the FDTD-operator class Operator @@ -34,6 +35,8 @@ public: static Operator* New(); virtual ~Operator(); + virtual Engine* CreateEngine(); + virtual bool SetGeometryCSX(ContinuousStructure* geo); virtual ContinuousStructure* GetGeometryCSX() {return CSX;} diff --git a/FDTD/operator_cylinder.cpp b/FDTD/operator_cylinder.cpp index e7ba875..862e9d3 100644 --- a/FDTD/operator_cylinder.cpp +++ b/FDTD/operator_cylinder.cpp @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +#include "engine.h" #include "operator_cylinder.h" #include "operator_extension.h" #include "operator_ext_cylinder.h" @@ -35,6 +36,13 @@ Operator_Cylinder::~Operator_Cylinder() Operator::Reset(); } +Engine* Operator_Cylinder::CreateEngine() +{ + //!create a confentional engine... cylinder special operations will be dealt by engine extentions + Engine* eng = Engine::New(this); + return eng; +} + void Operator_Cylinder::Init() { CC_closedAlpha = false; diff --git a/FDTD/operator_cylinder.h b/FDTD/operator_cylinder.h index 3505c19..b4257da 100644 --- a/FDTD/operator_cylinder.h +++ b/FDTD/operator_cylinder.h @@ -30,6 +30,8 @@ class Operator_Cylinder : public Operator public: static Operator_Cylinder* New(); virtual ~Operator_Cylinder(); + + virtual Engine* CreateEngine(); virtual bool SetGeometryCSX(ContinuousStructure* geo); diff --git a/FDTD/operator_sse.cpp b/FDTD/operator_sse.cpp index 8b09d33..883d67a 100644 --- a/FDTD/operator_sse.cpp +++ b/FDTD/operator_sse.cpp @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +#include "engine_sse.h" #include "operator_sse.h" #include "tools/array_ops.h" @@ -34,6 +35,13 @@ Operator_sse::~Operator_sse() Reset(); } +Engine* Operator_sse::CreateEngine() +{ + //!create a special sse-engine + Engine_sse* eng = Engine_sse::New(this); + return eng; +} + void Operator_sse::Init() { Operator::Init(); diff --git a/FDTD/operator_sse.h b/FDTD/operator_sse.h index 7d04ad8..c133beb 100644 --- a/FDTD/operator_sse.h +++ b/FDTD/operator_sse.h @@ -28,6 +28,8 @@ public: static Operator_sse* New(); virtual ~Operator_sse(); + virtual Engine* CreateEngine(); + inline virtual FDTD_FLOAT& GetVV( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return f4_vv[n][x][y][z%numVectors].f[z/numVectors]; } inline virtual FDTD_FLOAT& GetVI( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return f4_vi[n][x][y][z%numVectors].f[z/numVectors]; } diff --git a/openems.cpp b/openems.cpp index 193de86..989c4d0 100644 --- a/openems.cpp +++ b/openems.cpp @@ -252,35 +252,12 @@ int openEMS::SetupFDTD(const char* file) cout << "Creation time for operator: " << difftime(OpDoneTime,startTime) << " s" << endl; //create FDTD engine - if (CylinderCoords) + if (m_engine==EngineType_Multithreaded) { - cerr << "openEMS: creating cylinder coordinate FDTD engine..." << endl; - switch (m_engine) { -// case EngineType_Multithreaded: -// FDTD_Eng = Engine_Multithread::New(FDTD_Op,m_engine_numThreads); -// break; -// case EngineType_SSE: -// FDTD_Eng = Engine_sse::New(dynamic_cast(FDTD_Op)); -// break; - default: - FDTD_Eng = Engine::New(FDTD_Op); - break; - } + FDTD_Eng = Engine_Multithread::New(FDTD_Op,m_engine_numThreads); } else - { - switch (m_engine) { - case EngineType_Multithreaded: - FDTD_Eng = Engine_Multithread::New(FDTD_Op,m_engine_numThreads); - break; - case EngineType_SSE: - FDTD_Eng = Engine_sse::New(dynamic_cast(FDTD_Op)); - break; - default: - FDTD_Eng = Engine::New(FDTD_Op); - break; - } - } + FDTD_Eng = FDTD_Op->CreateEngine(); //*************** setup processing ************// cout << "Setting up processing..." << endl;