diff --git a/FDTD/engine.cpp b/FDTD/engine.cpp index 691cfdd..21c6c3a 100644 --- a/FDTD/engine.cpp +++ b/FDTD/engine.cpp @@ -118,7 +118,7 @@ void Engine::ApplyVoltageExcite() exc_pos = (int)numTS - (int)Op->E_Exc_delay[n]; exc_pos *= (exc_pos>0 && exc_pos<=(int)Op->ExciteLength); // if (n==0) cerr << numTS << " => " << Op->ExciteSignal[exc_pos] << endl; - volt[Op->E_Exc_dir[n]][Op->E_Exc_index[0][n]][Op->E_Exc_index[1][n]][Op->E_Exc_index[2][n]] += Op->E_Exc_amp[n]*Op->ExciteSignal_volt[exc_pos]; + GetVolt(Op->E_Exc_dir[n],Op->E_Exc_index[0][n],Op->E_Exc_index[1][n],Op->E_Exc_index[2][n]) += Op->E_Exc_amp[n]*Op->ExciteSignal_volt[exc_pos]; } // write the first excitation into the file "et1" @@ -164,7 +164,7 @@ void Engine::ApplyCurrentExcite() exc_pos = (int)numTS - (int)Op->Curr_Exc_delay[n]; exc_pos *= (exc_pos>0 && exc_pos<=(int)Op->ExciteLength); // if (n==0) cerr << numTS << " => " << Op->ExciteSignal[exc_pos] << endl; - curr[Op->Curr_Exc_dir[n]][Op->Curr_Exc_index[0][n]][Op->Curr_Exc_index[1][n]][Op->Curr_Exc_index[2][n]] += Op->Curr_Exc_amp[n]*Op->ExciteSignal_curr[exc_pos]; + GetCurr(Op->Curr_Exc_dir[n],Op->Curr_Exc_index[0][n],Op->Curr_Exc_index[1][n],Op->Curr_Exc_index[2][n]) += Op->Curr_Exc_amp[n]*Op->ExciteSignal_curr[exc_pos]; } } diff --git a/FDTD/engine.h b/FDTD/engine.h index 7ef5123..db1c6f7 100644 --- a/FDTD/engine.h +++ b/FDTD/engine.h @@ -37,11 +37,11 @@ public: virtual unsigned int GetNumberOfTimesteps() {return numTS;}; - inline virtual FDTD_FLOAT GetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return volt[n][x][y][z]; } - inline virtual FDTD_FLOAT GetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return curr[n][x][y][z]; } + inline virtual FDTD_FLOAT& GetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return volt[n][x][y][z]; } + inline virtual FDTD_FLOAT& GetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return curr[n][x][y][z]; } - inline virtual FDTD_FLOAT& GetVolt( unsigned int n, unsigned int pos[] ) { return volt[n][pos[0]][pos[1]][pos[2]]; } - inline virtual FDTD_FLOAT& GetCurr( unsigned int n, unsigned int pos[] ) { return curr[n][pos[0]][pos[1]][pos[2]]; } + inline virtual FDTD_FLOAT& GetVolt( unsigned int n, unsigned int pos[] ) { return GetVolt(n,pos[0],pos[1],pos[2]); } + inline virtual FDTD_FLOAT& GetCurr( unsigned int n, unsigned int pos[] ) { return GetCurr(n,pos[0],pos[1],pos[2]); } protected: Engine(const Operator* op); diff --git a/FDTD/engine_sse.cpp b/FDTD/engine_sse.cpp index 1859248..737c97b 100644 --- a/FDTD/engine_sse.cpp +++ b/FDTD/engine_sse.cpp @@ -69,7 +69,7 @@ void Engine_sse::UpdateVoltages() for (pos[1]=0;pos[1]E_Exc_Count;++n) - { - exc_pos = (int)numTS - (int)Op->E_Exc_delay[n]; - exc_pos *= (exc_pos>0 && exc_pos<=(int)Op->ExciteLength); - pos = Op->E_Exc_index[2][n]; - volt_[Op->E_Exc_dir[n]][Op->E_Exc_index[0][n]][Op->E_Exc_index[1][n]][pos/4].f[pos%4] += Op->E_Exc_amp[n]*Op->ExciteSignal[exc_pos]; - } -} - void Engine_sse::UpdateCurrents() { unsigned int pos[5]; @@ -118,7 +104,7 @@ void Engine_sse::UpdateCurrents() { for (pos[1]=0;pos[1]