diff --git a/FDTD/excitation.cpp b/FDTD/excitation.cpp index f1899d9..893d832 100644 --- a/FDTD/excitation.cpp +++ b/FDTD/excitation.cpp @@ -36,6 +36,8 @@ Excitation::Excitation( double timestep ) Curr_dir = 0; Curr_Count = 0; + m_Excit_Type = -1; + for (int n=0; n<3; ++n) { Volt_index[n] = 0; @@ -87,6 +89,8 @@ void Excitation::Reset( double timestep ) Volt_Count = 0; Curr_Count = 0; + m_Excit_Type = -1; + for (int n=0; n<3; ++n) { delete[] Volt_index[n]; @@ -110,12 +114,11 @@ bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS ) return false; } - int Excit_Type=0; double f0=0; double fc=0; - Excite->QueryIntAttribute("Type",&Excit_Type); + Excite->QueryIntAttribute("Type",&m_Excit_Type); - switch (Excit_Type) + switch (m_Excit_Type) { case 0: Excite->QueryDoubleAttribute("f0",&f0); @@ -137,7 +140,8 @@ bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS ) CalcCustomExcitation(f0,maxTS,Excite->Attribute("Function")); break; default: - cerr << "Excitation::setupExcitation: Unknown excitation type: \"" << Excit_Type<< "\" !!" << endl; + cerr << "Excitation::setupExcitation: Unknown excitation type: \"" << m_Excit_Type<< "\" !!" << endl; + m_Excit_Type = -1; return false; } diff --git a/FDTD/excitation.h b/FDTD/excitation.h index c2c0986..ff83e98 100644 --- a/FDTD/excitation.h +++ b/FDTD/excitation.h @@ -54,6 +54,9 @@ public: //! Get the used timestep double GetTimestep() const {return dT;} + //! Get the type of excitation + int GetExciteType() const {return m_Excit_Type;} + //Excitation time-signal unsigned int Length; FDTD_FLOAT* Signal_volt; @@ -78,6 +81,7 @@ public: protected: double dT; unsigned int m_nyquistTS; + int m_Excit_Type; //! Calculate a custom signal virtual void CalcCustomExcitation(double f0, int nTS, string signal); diff --git a/FDTD/openems_fdtd_mpi.cpp b/FDTD/openems_fdtd_mpi.cpp index 88891f1..015dc40 100644 --- a/FDTD/openems_fdtd_mpi.cpp +++ b/FDTD/openems_fdtd_mpi.cpp @@ -501,7 +501,7 @@ void openEMS_FDTD_MPI::RunFDTD() PA->FlushNext(); } } - if ((m_MyID==0) && (m_EnergyDecrement>endCrit)) + if ((m_MyID==0) && (m_EnergyDecrement>endCrit) && (FDTD_Op->Exc->GetExciteType()==0)) cerr << "RunFDTD: max. number of timesteps was reached before the end-criteria of -" << fabs(10.0*log10(endCrit)) << "dB was reached... " << endl << \ "\tYou may want to choose a higher number of max. timesteps... " << endl; diff --git a/openems.cpp b/openems.cpp index e41718c..f5c1b56 100644 --- a/openems.cpp +++ b/openems.cpp @@ -680,7 +680,7 @@ int openEMS::SetupFDTD(const char* file) cout << "Excitation signal length is: " << FDTD_Op->Exc->Length << " timesteps (" << FDTD_Op->Exc->Length*FDTD_Op->GetTimestep() << "s)" << endl; cout << "Max. number of timesteps: " << NrTS << " ( --> " << (double)NrTS/(double)(FDTD_Op->Exc->Length) << " * Excitation signal length)" << endl; - if ((double)NrTS/(double)FDTD_Op->Exc->Length < 3) + if ( ((double)NrTS/(double)FDTD_Op->Exc->Length < 3) && (FDTD_Op->Exc->GetExciteType()==0)) cerr << "openEMS::SetupFDTD: Warning, max. number of timesteps is smaller than three times the excitation. " << endl << \ "\tYou may want to choose a higher number of max. timesteps... " << endl; @@ -813,7 +813,7 @@ void openEMS::RunFDTD() PA->FlushNext(); } } - if (change>endCrit) + if ((change>endCrit) && (FDTD_Op->Exc->GetExciteType()==0)) cerr << "RunFDTD: Warning: Max. number of timesteps was reached before the end-criteria of -" << fabs(10.0*log10(endCrit)) << "dB was reached... " << endl << \ "\tYou may want to choose a higher number of max. timesteps... " << endl;