new: operator should create its engine
parent
74ba9eceff
commit
54d0671d33
|
@ -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;
|
||||
|
|
|
@ -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;}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -31,6 +31,8 @@ public:
|
|||
static Operator_Cylinder* New();
|
||||
virtual ~Operator_Cylinder();
|
||||
|
||||
virtual Engine* CreateEngine();
|
||||
|
||||
virtual bool SetGeometryCSX(ContinuousStructure* geo);
|
||||
|
||||
virtual void ApplyElectricBC(bool* dirs);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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]; }
|
||||
|
||||
|
|
29
openems.cpp
29
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<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;
|
||||
|
|
Loading…
Reference in New Issue