critical fix: use new Operator->GetEngine for engine interface setup

Bug fix: engine interfaces for multigrids were using subgrid operator,
but main grid engine...

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/12/head
Thorsten Liebig 2014-01-06 16:08:13 +01:00
parent 6353c70ae5
commit 6f6ed4feac
7 changed files with 28 additions and 19 deletions

View File

@ -17,7 +17,7 @@
#include "engine_interface_cylindrical_fdtd.h"
Engine_Interface_Cylindrical_FDTD::Engine_Interface_Cylindrical_FDTD(Operator_sse* op, Engine_sse* eng) : Engine_Interface_SSE_FDTD(op,eng)
Engine_Interface_Cylindrical_FDTD::Engine_Interface_Cylindrical_FDTD(Operator_sse* op) : Engine_Interface_SSE_FDTD(op)
{
m_Op_Cyl = dynamic_cast<Operator_Cylinder*>(op);
if (m_Op_Cyl==NULL)

View File

@ -24,7 +24,7 @@
class Engine_Interface_Cylindrical_FDTD : public Engine_Interface_SSE_FDTD
{
public:
Engine_Interface_Cylindrical_FDTD(Operator_sse* op, Engine_sse* eng);
Engine_Interface_Cylindrical_FDTD(Operator_sse* op);
virtual ~Engine_Interface_Cylindrical_FDTD();
virtual double* GetHField(const unsigned int* pos, double* out) const;

View File

@ -17,15 +17,20 @@
#include "engine_interface_fdtd.h"
Engine_Interface_FDTD::Engine_Interface_FDTD(Operator* op, Engine* eng) : Engine_Interface_Base(op)
Engine_Interface_FDTD::Engine_Interface_FDTD(Operator* op) : Engine_Interface_Base(op)
{
if ((op==NULL) || (eng==NULL))
if (op==NULL)
{
cerr << "Engine_Interface_FDTD::Engine_Interface_FDTD: Error: Operator or Engine is not set! Exit!" << endl;
cerr << "Engine_Interface_FDTD::Engine_Interface_FDTD: Error: Operator is not set! Exit!" << endl;
exit(1);
}
m_Op = op;
m_Eng = eng;
m_Eng = m_Op->GetEngine();
if (m_Eng==NULL)
{
cerr << "Engine_Interface_FDTD::Engine_Interface_FDTD: Error: Engine is not set! Exit!" << endl;
exit(1);
}
}
Engine_Interface_FDTD::~Engine_Interface_FDTD()

View File

@ -27,7 +27,7 @@
class Engine_Interface_FDTD : public Engine_Interface_Base
{
public:
Engine_Interface_FDTD(Operator* op, Engine* eng);
Engine_Interface_FDTD(Operator* op);
virtual ~Engine_Interface_FDTD();
//! Set the FDTD operator

View File

@ -17,10 +17,15 @@
#include "engine_interface_sse_fdtd.h"
Engine_Interface_SSE_FDTD::Engine_Interface_SSE_FDTD(Operator_sse* op, Engine_sse* eng) : Engine_Interface_FDTD(op, eng)
Engine_Interface_SSE_FDTD::Engine_Interface_SSE_FDTD(Operator_sse* op) : Engine_Interface_FDTD(op)
{
m_Op_SSE = op;
m_Eng_SSE = eng;
m_Eng_SSE = dynamic_cast<Engine_sse*>(m_Op_SSE->GetEngine());
if (m_Eng_SSE==NULL)
{
cerr << "Engine_Interface_SSE_FDTD::Engine_Interface_SSE_FDTD: Error: SSE-Engine is not set! Exit!" << endl;
exit(1);
}
}
Engine_Interface_SSE_FDTD::~Engine_Interface_SSE_FDTD()

View File

@ -25,7 +25,7 @@
class Engine_Interface_SSE_FDTD : public Engine_Interface_FDTD
{
public:
Engine_Interface_SSE_FDTD(Operator_sse* op, Engine_sse* eng);
Engine_Interface_SSE_FDTD(Operator_sse* op);
virtual ~Engine_Interface_SSE_FDTD();
virtual double CalcFastEnergy() const;

View File

@ -307,15 +307,14 @@ bool openEMS::SetupBoundaryConditions(TiXmlElement* BC)
Engine_Interface_FDTD* openEMS::NewEngineInterface(int multigridlevel)
{
Operator_CylinderMultiGrid* op_cyl_mg = dynamic_cast<Operator_CylinderMultiGrid*>(FDTD_Op);
Engine_sse* eng_sse = dynamic_cast<Engine_sse*>(FDTD_Eng);
while (op_cyl_mg && eng_sse && multigridlevel>0)
while (op_cyl_mg && multigridlevel>0)
{
int mgl = op_cyl_mg->GetMultiGridLevel();
if (mgl==multigridlevel)
{
if (g_settings.GetVerboseLevel()>0)
cerr << __func__ << ": Operator with requested multi-grid level found." << endl;
return new Engine_Interface_Cylindrical_FDTD(op_cyl_mg,eng_sse);
return new Engine_Interface_Cylindrical_FDTD(op_cyl_mg);
}
Operator_Cylinder* op_cyl_inner = op_cyl_mg->GetInnerOperator();
op_cyl_mg = dynamic_cast<Operator_CylinderMultiGrid*>(op_cyl_inner);
@ -323,17 +322,17 @@ Engine_Interface_FDTD* openEMS::NewEngineInterface(int multigridlevel)
{
if (g_settings.GetVerboseLevel()>0)
cerr << __func__ << ": Operator with highest multi-grid level chosen." << endl;
return new Engine_Interface_Cylindrical_FDTD(op_cyl_inner,eng_sse);
return new Engine_Interface_Cylindrical_FDTD(op_cyl_inner);
}
// try next level
}
Operator_Cylinder* op_cyl = dynamic_cast<Operator_Cylinder*>(FDTD_Op);
if (op_cyl && eng_sse)
return new Engine_Interface_Cylindrical_FDTD(op_cyl,eng_sse);
if (op_cyl)
return new Engine_Interface_Cylindrical_FDTD(op_cyl);
Operator_sse* op_sse = dynamic_cast<Operator_sse*>(FDTD_Op);
if (op_sse && eng_sse)
return new Engine_Interface_SSE_FDTD(op_sse,eng_sse);
return new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng);
if (op_sse)
return new Engine_Interface_SSE_FDTD(op_sse);
return new Engine_Interface_FDTD(FDTD_Op);
}
bool openEMS::SetupProcessing()