engine_ext_lumpedRLC: use helper macros.
Signed-off-by: Yifeng Li <tomli@tomli.me>pull/139/head
parent
4dbae1c7e7
commit
7e6bf7239f
|
@ -99,7 +99,8 @@ void Engine_Ext_LumpedRLC::DoPreVoltageUpdates()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine_Ext_LumpedRLC::Apply2Voltages()
|
template <typename EngineType>
|
||||||
|
void Engine_Ext_LumpedRLC::Apply2VoltagesImpl(EngineType* eng)
|
||||||
{
|
{
|
||||||
uint **pos = m_Op_Ext_RLC->v_RLC_pos;
|
uint **pos = m_Op_Ext_RLC->v_RLC_pos;
|
||||||
int *dir = m_Op_Ext_RLC->v_RLC_dir;
|
int *dir = m_Op_Ext_RLC->v_RLC_dir;
|
||||||
|
@ -113,31 +114,8 @@ void Engine_Ext_LumpedRLC::Apply2Voltages()
|
||||||
|
|
||||||
|
|
||||||
// Read engine calculated node voltage
|
// Read engine calculated node voltage
|
||||||
switch (m_Eng->GetType())
|
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
||||||
{
|
v_Vdn[0][pIdx] = eng->EngineType::GetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx]);
|
||||||
case Engine::BASIC:
|
|
||||||
{
|
|
||||||
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
|
||||||
v_Vdn[0][pIdx] = m_Eng->Engine::GetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Engine::SSE:
|
|
||||||
{
|
|
||||||
Engine_sse* eng_sse = (Engine_sse*)m_Eng;
|
|
||||||
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
|
||||||
v_Vdn[0][pIdx] = eng_sse->Engine_sse::GetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
|
||||||
v_Vdn[0][pIdx] = m_Eng->GetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx]);;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Post process: Calculate node voltage with respect to the lumped RLC auxilliary quantity, J
|
// Post process: Calculate node voltage with respect to the lumped RLC auxilliary quantity, J
|
||||||
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
||||||
|
@ -162,34 +140,11 @@ void Engine_Ext_LumpedRLC::Apply2Voltages()
|
||||||
|
|
||||||
|
|
||||||
// Update node voltage
|
// Update node voltage
|
||||||
switch (m_Eng->GetType())
|
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
||||||
{
|
eng->EngineType::SetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx],v_Vdn[0][pIdx]);
|
||||||
case Engine::BASIC:
|
|
||||||
{
|
|
||||||
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
|
||||||
m_Eng->Engine::SetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx],v_Vdn[0][pIdx]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Engine::SSE:
|
|
||||||
{
|
|
||||||
Engine_sse* eng_sse = (Engine_sse*)m_Eng;
|
|
||||||
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
|
||||||
eng_sse->Engine_sse::SetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx],v_Vdn[0][pIdx]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
for (uint pIdx = 0 ; pIdx < m_Op_Ext_RLC->RLC_count ; pIdx++)
|
|
||||||
m_Eng->SetVolt(dir[pIdx],pos[0][pIdx],pos[1][pIdx],pos[2][pIdx],v_Vdn[0][pIdx]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine_Ext_LumpedRLC::Apply2Voltages()
|
||||||
|
{
|
||||||
|
ENG_DISPATCH(Apply2VoltagesImpl);
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "engine_extension.h"
|
#include "engine_extension.h"
|
||||||
#include "FDTD/engine.h"
|
#include "FDTD/engine.h"
|
||||||
#include "FDTD/operator.h"
|
#include "FDTD/operator.h"
|
||||||
|
#include "engine_extension_dispatcher.h"
|
||||||
|
|
||||||
class Operator_Ext_LumpedRLC;
|
class Operator_Ext_LumpedRLC;
|
||||||
|
|
||||||
|
@ -39,6 +40,9 @@ public:
|
||||||
virtual void Apply2Voltages();
|
virtual void Apply2Voltages();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
template <typename EngineType>
|
||||||
|
void Apply2VoltagesImpl(EngineType* eng);
|
||||||
|
|
||||||
Operator_Ext_LumpedRLC* m_Op_Ext_RLC;
|
Operator_Ext_LumpedRLC* m_Op_Ext_RLC;
|
||||||
|
|
||||||
// Auxilliary containers
|
// Auxilliary containers
|
||||||
|
|
Loading…
Reference in New Issue