2010-03-01 08:19:39 +00:00
|
|
|
#include "operator.h"
|
2010-03-01 13:56:27 +00:00
|
|
|
#include "tools/array_ops.h"
|
2010-03-01 08:19:39 +00:00
|
|
|
|
|
|
|
Operator::Operator()
|
|
|
|
{
|
|
|
|
Operator::Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
Operator::~Operator()
|
|
|
|
{
|
|
|
|
Operator::Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Operator::Init()
|
|
|
|
{
|
|
|
|
CSX = NULL;
|
|
|
|
|
2010-03-01 13:56:27 +00:00
|
|
|
ExciteSignal = NULL;
|
2010-03-01 08:19:39 +00:00
|
|
|
E_Ex_delay = NULL;
|
2010-03-01 13:56:27 +00:00
|
|
|
vv=NULL;
|
|
|
|
vi=NULL;
|
|
|
|
iv=NULL;
|
|
|
|
ii=NULL;
|
2010-03-01 08:19:39 +00:00
|
|
|
for (int n=0;n<3;++n)
|
|
|
|
{
|
|
|
|
discLines[n]=NULL;
|
|
|
|
E_Ex_amp[n]=NULL;
|
2010-03-01 13:56:27 +00:00
|
|
|
E_Ex_index[n]=NULL;
|
2010-03-01 08:19:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Operator::Reset()
|
|
|
|
{
|
2010-03-01 13:56:27 +00:00
|
|
|
delete[] ExciteSignal;
|
2010-03-01 08:19:39 +00:00
|
|
|
delete[] E_Ex_delay;
|
2010-03-01 13:56:27 +00:00
|
|
|
Delete_N_3DArray(vv,numLines);
|
|
|
|
Delete_N_3DArray(vi,numLines);
|
|
|
|
Delete_N_3DArray(iv,numLines);
|
|
|
|
Delete_N_3DArray(ii,numLines);
|
2010-03-01 08:19:39 +00:00
|
|
|
for (int n=0;n<3;++n)
|
|
|
|
{
|
2010-03-01 13:56:27 +00:00
|
|
|
delete[] discLines[n];
|
2010-03-01 08:19:39 +00:00
|
|
|
delete[] E_Ex_amp[n];
|
2010-03-01 13:56:27 +00:00
|
|
|
delete[] E_Ex_index[n];
|
2010-03-01 08:19:39 +00:00
|
|
|
}
|
|
|
|
Operator::Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Operator::SetGeometryCSX(ContinuousStructure* geo)
|
|
|
|
{
|
|
|
|
if (geo==NULL) return;
|
|
|
|
|
|
|
|
Reset();
|
|
|
|
CSX = geo;
|
|
|
|
}
|
2010-03-01 13:56:27 +00:00
|
|
|
|
|
|
|
double Operator::GetNumberCells()
|
|
|
|
{
|
|
|
|
if (numLines)
|
|
|
|
return (numLines[0]-1)*(numLines[1]-1)*(numLines[2]-1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Operator::ShowSize()
|
|
|
|
{
|
|
|
|
unsigned int OpSize = 12*numLines[0]*numLines[1]*numLines[2]*sizeof(FDTD_FLOAT);
|
|
|
|
unsigned int FieldSize = 6*numLines[0]*numLines[1]*numLines[2]*sizeof(FDTD_FLOAT);
|
|
|
|
double MBdiff = 1024*1024;
|
|
|
|
|
|
|
|
cout << "FDTD Operator Size:" << endl;
|
|
|
|
cout << "Size of Operator in Byte : " << OpSize << " Byte (" << (double)OpSize/MBdiff << " MB) " << endl;
|
|
|
|
cout << "Size of Field-Data in Byte: " << FieldSize << " Byte (" << (double)FieldSize/MBdiff << " MB) " << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Operator::CalcGaussianPulsExcitation(double f0, double fc)
|
|
|
|
{
|
|
|
|
if (dT==0) return;
|
|
|
|
|
|
|
|
ExciteLength = (unsigned int)(2.0 * 9.0/(2.0*PI*fc) / dT);
|
|
|
|
cerr << "Operator::CalcGaussianPulsExcitation: Length of the excite signal: " << ExciteLength << " timesteps" << endl;
|
|
|
|
delete[] ExciteSignal;
|
|
|
|
ExciteSignal = new FDTD_FLOAT[ExciteLength+1];
|
|
|
|
ExciteSignal[0]=0.0;
|
|
|
|
for (unsigned int n=1;n<ExciteLength+1;++n)
|
|
|
|
{
|
|
|
|
ExciteSignal[n] = cos(2.0*PI*f0*(n*dT-9.0/(2.0*PI*fc)))*exp(-1*pow(2.0*PI*fc*n*dT/3.0-3,2));
|
|
|
|
// cerr << ExciteSignal[n] << endl;
|
|
|
|
}
|
|
|
|
}
|