From 98063bba6e8cd0b756d4fc767e7c40b58e6e68fe Mon Sep 17 00:00:00 2001 From: Sebastian Held Date: Thu, 1 Apr 2010 09:38:56 +0200 Subject: [PATCH] new excitation step --- FDTD/operator.cpp | 23 +++++++++++++++++++++-- FDTD/operator.h | 3 +++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index bff3584..2fd1638 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -253,13 +253,32 @@ unsigned int Operator::CalcDiracPulsExcitation() if (dT==0) return 0; ExciteLength = 1; - cerr << "Operator::CalcDiracPulsExcitation: Length of the excite signal: " << ExciteLength << " timesteps" << endl; +// cerr << "Operator::CalcDiracPulsExcitation: Length of the excite signal: " << ExciteLength << " timesteps" << endl; delete[] ExciteSignal; ExciteSignal = new FDTD_FLOAT[ExciteLength+1]; ExciteSignal[0]=0.0; ExciteSignal[1]=1.0; - return 1; + // FIXME GetNyquistNum() has side-effects! + m_nyquistTS = 1; + + return m_nyquistTS; +} + +unsigned int Operator::CalcStepExcitation() +{ + if (dT==0) return 0; + + ExciteLength = 1; + delete[] ExciteSignal; + ExciteSignal = new FDTD_FLOAT[ExciteLength+1]; + ExciteSignal[0]=1.0; + ExciteSignal[1]=1.0; + + // FIXME GetNyquistNum() has side-effects! + m_nyquistTS = 1; + + return m_nyquistTS; } unsigned int Operator::CalcSinusExcitation(double f0, int nTS) diff --git a/FDTD/operator.h b/FDTD/operator.h index 45b8db4..fab5c27 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -41,7 +41,10 @@ public: virtual unsigned int CalcGaussianPulsExcitation(double f0, double fc); //! Calculate a sinusoidal excitation with frequency f0 and a duration of nTS number of timesteps \return number of Nyquist timesteps virtual unsigned int CalcSinusExcitation(double f0, int nTS); + //! Calculate a dirac impuls excitation \return number of Nyquist timesteps virtual unsigned int CalcDiracPulsExcitation(); + //! Calculate a step excitation \return number of Nyquist timesteps + virtual unsigned int CalcStepExcitation(); virtual void ApplyElectricBC(bool* dirs); //applied by default to all boundaries virtual void ApplyMagneticBC(bool* dirs);