new: operator should create its engine

pull/1/head
Thorsten Liebig 2010-05-08 18:12:44 +02:00 committed by Thorsten Liebig
parent 74ba9eceff
commit 54d0671d33
7 changed files with 33 additions and 26 deletions

View File

@ -17,6 +17,7 @@
#include <fstream>
#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;

View File

@ -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;}

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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;

View File

@ -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);

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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();

View File

@ -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]; }

View File

@ -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<Operator_sse*>(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<Operator_sse*>(FDTD_Op));
break;
default:
FDTD_Eng = Engine::New(FDTD_Op);
break;
}
}
FDTD_Eng = FDTD_Op->CreateEngine();
//*************** setup processing ************//
cout << "Setting up processing..." << endl;