From 1dff63d2cd4a21ae20e33833e8b06cbc03cbde56 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Fri, 18 Mar 2011 14:46:27 +0100 Subject: [PATCH] cylinder engine extension should use inline functions for field accesss --- FDTD/extensions/engine_ext_cylinder.cpp | 24 ++++++++++++++++-------- FDTD/extensions/engine_ext_cylinder.h | 4 ++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/FDTD/extensions/engine_ext_cylinder.cpp b/FDTD/extensions/engine_ext_cylinder.cpp index bf93b3b..cdb9700 100644 --- a/FDTD/extensions/engine_ext_cylinder.cpp +++ b/FDTD/extensions/engine_ext_cylinder.cpp @@ -18,10 +18,12 @@ #include "FDTD/engine.h" #include "engine_ext_cylinder.h" #include "operator_ext_cylinder.h" +#include "FDTD/engine_sse.h" Engine_Ext_Cylinder::Engine_Ext_Cylinder(Operator_Ext_Cylinder* op_ext) : Engine_Extension(op_ext) { cyl_Op = op_ext; + m_Eng_SSE = NULL; CC_closedAlpha = op_ext->CC_closedAlpha; CC_R0_included = op_ext->CC_R0_included; @@ -33,6 +35,12 @@ Engine_Ext_Cylinder::Engine_Ext_Cylinder(Operator_Ext_Cylinder* op_ext) : Engine m_Priority = ENG_EXT_PRIO_CYLINDER; } +void Engine_Ext_Cylinder::SetEngine(Engine* eng) +{ + Engine_Extension::SetEngine(eng); + m_Eng_SSE = dynamic_cast(m_Eng); +} + void Engine_Ext_Cylinder::Apply2Voltages() { if (CC_closedAlpha==false) return; @@ -43,18 +51,18 @@ void Engine_Ext_Cylinder::Apply2Voltages() pos[0] = 0; for (pos[2]=0; pos[2]SetVolt(2,0,0,pos[2], m_Eng->GetVolt(2,0,0,pos[2])*cyl_Op->vv_R0[pos[2]]); + m_Eng_SSE->Engine_sse::SetVolt(2,0,0,pos[2], m_Eng_SSE->Engine_sse::GetVolt(2,0,0,pos[2])*cyl_Op->vv_R0[pos[2]]); for (pos[1]=0; pos[1]SetVolt(2,0,0,pos[2], m_Eng->GetVolt(2,0,0,pos[2]) + cyl_Op->vi_R0[pos[2]] * m_Eng->GetCurr(1,0,pos[1],pos[2]) ); + m_Eng_SSE->Engine_sse::SetVolt(2,0,0,pos[2], m_Eng_SSE->Engine_sse::GetVolt(2,0,0,pos[2]) + cyl_Op->vi_R0[pos[2]] * m_Eng_SSE->Engine_sse::GetCurr(1,0,pos[1],pos[2]) ); } } for (pos[1]=0; pos[1]SetVolt(1,0,pos[1],pos[2], 0); //no voltage in alpha-direction at r=0 - m_Eng->SetVolt(2,0,pos[1],pos[2], m_Eng->GetVolt(2,0,0,pos[2]) ); + m_Eng_SSE->Engine_sse::SetVolt(1,0,pos[1],pos[2], 0); //no voltage in alpha-direction at r=0 + m_Eng_SSE->Engine_sse::SetVolt(2,0,pos[1],pos[2], m_Eng_SSE->Engine_sse::GetVolt(2,0,0,pos[2]) ); } } } @@ -67,8 +75,8 @@ void Engine_Ext_Cylinder::Apply2Voltages() { for (pos[2]=0; pos[2]SetVolt(0,pos[0],0,pos[2], m_Eng->GetVolt(0,pos[0],last_A_Line,pos[2]) ); - m_Eng->SetVolt(2,pos[0],0,pos[2], m_Eng->GetVolt(2,pos[0],last_A_Line,pos[2]) ); + m_Eng_SSE->Engine_sse::SetVolt(0,pos[0],0,pos[2], m_Eng_SSE->Engine_sse::GetVolt(0,pos[0],last_A_Line,pos[2]) ); + m_Eng_SSE->Engine_sse::SetVolt(2,pos[0],0,pos[2], m_Eng_SSE->Engine_sse::GetVolt(2,pos[0],last_A_Line,pos[2]) ); } } } @@ -85,8 +93,8 @@ void Engine_Ext_Cylinder::Apply2Current() unsigned int last_A_Line = numLines[1]-2; for (pos[2]=0; pos[2]SetCurr(0,pos[0],last_A_Line,pos[2], m_Eng->GetCurr(0,pos[0],0,pos[2]) ); - m_Eng->SetCurr(2,pos[0],last_A_Line,pos[2], m_Eng->GetCurr(2,pos[0],0,pos[2]) ); + m_Eng_SSE->Engine_sse::SetCurr(0,pos[0],last_A_Line,pos[2], m_Eng_SSE->Engine_sse::GetCurr(0,pos[0],0,pos[2]) ); + m_Eng_SSE->Engine_sse::SetCurr(2,pos[0],last_A_Line,pos[2], m_Eng_SSE->Engine_sse::GetCurr(2,pos[0],0,pos[2]) ); } } } diff --git a/FDTD/extensions/engine_ext_cylinder.h b/FDTD/extensions/engine_ext_cylinder.h index d468bc6..ed75aec 100644 --- a/FDTD/extensions/engine_ext_cylinder.h +++ b/FDTD/extensions/engine_ext_cylinder.h @@ -23,6 +23,7 @@ #include "FDTD/operator_cylinder.h" class Operator_Ext_Cylinder; +class Engine_sse; class Engine_Ext_Cylinder : public Engine_Extension { @@ -33,8 +34,11 @@ public: virtual void Apply2Current(); + virtual void SetEngine(Engine* eng); + protected: Operator_Ext_Cylinder* cyl_Op; + Engine_sse* m_Eng_SSE; unsigned int numLines[3];