bug fix in operator resetting and (Re)InitExcitation

pull/1/head
Thorsten Liebig 2011-07-25 14:56:27 +02:00
parent ea71dce1c3
commit 0fe63823d0
3 changed files with 45 additions and 4 deletions

View File

@ -63,7 +63,43 @@ Excitation::~Excitation()
delete[] Volt_index[n];
delete[] Curr_index[n];
}
}
void Excitation::Reset( double timestep )
{
delete[] Signal_volt;
Signal_volt = 0;
delete[] Signal_curr;
Signal_curr = 0;
delete[] Volt_delay;
Volt_delay = 0;
delete[] Volt_dir;
Volt_dir = 0;
delete[] Volt_amp;
Volt_amp = 0;
delete[] Curr_delay;
Curr_delay = 0;
delete[] Curr_dir;
Curr_dir = 0;
delete[] Curr_amp;
Curr_amp = 0;
Volt_Count = 0;
Curr_Count = 0;
for (int n=0; n<3; ++n)
{
delete[] Volt_index[n];
Volt_index[n] = 0;
delete[] Curr_index[n];
Curr_index[n] = 0;
Volt_Count_Dir[n] = 0;
Curr_Count_Dir[n] = 0;
}
dT = timestep;
m_nyquistTS = 0;
}
bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS )

View File

@ -30,6 +30,8 @@ public:
Excitation( double timestep );
virtual ~Excitation();
virtual void Reset( double timestep );
bool setupExcitation( TiXmlElement* Excite, unsigned int maxTS );
//! Get the excitation timestep with the (first) max amplitude

View File

@ -803,11 +803,14 @@ double Operator::GetDiscMaterial(int type, int n, const unsigned int pos[3]) con
void Operator::InitExcitation()
{
delete Exc;
if (Exc!=NULL)
Exc->Reset(dT);
else
{
Exc = new Excitation( dT );
this->AddExtension(new Operator_Ext_Excitation(this,Exc));
}
}
void Operator::Calc_ECOperatorPos(int n, unsigned int* pos)
{