diff --git a/FDTD/engine_ext_mur_abc.cpp b/FDTD/engine_ext_mur_abc.cpp index a691e5f..17359b2 100644 --- a/FDTD/engine_ext_mur_abc.cpp +++ b/FDTD/engine_ext_mur_abc.cpp @@ -35,6 +35,23 @@ Engine_Ext_Mur_ABC::Engine_Ext_Mur_ABC(Operator_Ext_Mur_ABC* op_ext) : Engine_Ex m_volt_nyP = Create2DArray(m_numLines); m_volt_nyPP = Create2DArray(m_numLines); + + //find if some excitation is on this mur-abc and find the max length of this excite, so that the abc can start after the excitation is done... + int maxDelay=-1; + for (unsigned int n=0;nm_Op->E_Exc_Count;++n) + { + if ( ((m_Op_mur->m_Op->E_Exc_dir[n]==m_nyP) || (m_Op_mur->m_Op->E_Exc_dir[n]==m_nyPP)) && (m_Op_mur->m_Op->E_Exc_index[m_ny][n]==m_LineNr) ) + { + if ((int)m_Op_mur->m_Op->E_Exc_delay[n]>maxDelay) + maxDelay = (int)m_Op_mur->m_Op->E_Exc_delay[n]; + } + } + m_start_TS = 0; + if (maxDelay>=0) + { + m_start_TS = maxDelay + m_Op_mur->m_Op->ExciteLength + 10; //give it some extra timesteps, for the excitation to travel at least one cell away + cerr << "Engine_Ext_Mur_ABC::Engine_Ext_Mur_ABC: Warning: Excitation inside the Mur-ABC #" << m_ny << "-" << (int)(m_LineNr>0) << " found!!!! Mur-ABC will be switched on after excitation is done at " << m_start_TS << " timesteps!!! " << endl; + } } Engine_Ext_Mur_ABC::~Engine_Ext_Mur_ABC() @@ -47,6 +64,7 @@ Engine_Ext_Mur_ABC::~Engine_Ext_Mur_ABC() void Engine_Ext_Mur_ABC::DoPreVoltageUpdates() { + if (IsActive()==false) return; if (m_Eng==NULL) return; if (m_Mur_Coeff==0) return; unsigned int pos[] = {0,0,0}; @@ -68,6 +86,7 @@ void Engine_Ext_Mur_ABC::DoPreVoltageUpdates() void Engine_Ext_Mur_ABC::DoPostVoltageUpdates() { + if (IsActive()==false) return; if (m_Eng==NULL) return; if (m_Mur_Coeff==0) return; unsigned int pos[] = {0,0,0}; @@ -89,6 +108,7 @@ void Engine_Ext_Mur_ABC::DoPostVoltageUpdates() void Engine_Ext_Mur_ABC::Apply2Voltages() { + if (IsActive()==false) return; if (m_Eng==NULL) return; if (m_Mur_Coeff==0) return; unsigned int pos[] = {0,0,0}; diff --git a/FDTD/engine_ext_mur_abc.h b/FDTD/engine_ext_mur_abc.h index 98f38cf..9fb540f 100644 --- a/FDTD/engine_ext_mur_abc.h +++ b/FDTD/engine_ext_mur_abc.h @@ -19,6 +19,7 @@ #define ENGINE_EXT_MUR_ABC_H #include "engine_extension.h" +#include "engine.h" #include "operator.h" class Operator_Ext_Mur_ABC; @@ -36,6 +37,9 @@ public: protected: Operator_Ext_Mur_ABC* m_Op_mur; + inline bool IsActive() {if (m_Eng->GetNumberOfTimesteps()GetMeshDelta(m_ny,pos)); m_Mur_Coeff = (__C0__ * dT - delta) / (__C0__ * dT + delta); -// cerr << "Operator_Ext_Mur_ABC::BuildExtension(): " << m_Mur_Coeff << endl; +// cerr << "Operator_Ext_Mur_ABC::BuildExtension(): " << m_ny << " @ " << m_LineNr << " = "<< m_Mur_Coeff << endl; return true; } diff --git a/FDTD/operator_extension.h b/FDTD/operator_extension.h index 986ba3b..b61efb2 100644 --- a/FDTD/operator_extension.h +++ b/FDTD/operator_extension.h @@ -24,6 +24,7 @@ class Engine_Extension; //! Abstract base-class for all operator extensions class Operator_Extension { + friend class Engine_Extension; public: virtual bool BuildExtension() {return true;}