removed unnecessary methodes in sse engine & fixed excitation
parent
209c066732
commit
3e09b22b4a
|
@ -118,7 +118,7 @@ void Engine::ApplyVoltageExcite()
|
|||
exc_pos = (int)numTS - (int)Op->E_Exc_delay[n];
|
||||
exc_pos *= (exc_pos>0 && exc_pos<=(int)Op->ExciteLength);
|
||||
// if (n==0) cerr << numTS << " => " << Op->ExciteSignal[exc_pos] << endl;
|
||||
volt[Op->E_Exc_dir[n]][Op->E_Exc_index[0][n]][Op->E_Exc_index[1][n]][Op->E_Exc_index[2][n]] += Op->E_Exc_amp[n]*Op->ExciteSignal_volt[exc_pos];
|
||||
GetVolt(Op->E_Exc_dir[n],Op->E_Exc_index[0][n],Op->E_Exc_index[1][n],Op->E_Exc_index[2][n]) += Op->E_Exc_amp[n]*Op->ExciteSignal_volt[exc_pos];
|
||||
}
|
||||
|
||||
// write the first excitation into the file "et1"
|
||||
|
@ -164,7 +164,7 @@ void Engine::ApplyCurrentExcite()
|
|||
exc_pos = (int)numTS - (int)Op->Curr_Exc_delay[n];
|
||||
exc_pos *= (exc_pos>0 && exc_pos<=(int)Op->ExciteLength);
|
||||
// if (n==0) cerr << numTS << " => " << Op->ExciteSignal[exc_pos] << endl;
|
||||
curr[Op->Curr_Exc_dir[n]][Op->Curr_Exc_index[0][n]][Op->Curr_Exc_index[1][n]][Op->Curr_Exc_index[2][n]] += Op->Curr_Exc_amp[n]*Op->ExciteSignal_curr[exc_pos];
|
||||
GetCurr(Op->Curr_Exc_dir[n],Op->Curr_Exc_index[0][n],Op->Curr_Exc_index[1][n],Op->Curr_Exc_index[2][n]) += Op->Curr_Exc_amp[n]*Op->ExciteSignal_curr[exc_pos];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,11 @@ public:
|
|||
|
||||
virtual unsigned int GetNumberOfTimesteps() {return numTS;};
|
||||
|
||||
inline virtual FDTD_FLOAT GetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return volt[n][x][y][z]; }
|
||||
inline virtual FDTD_FLOAT GetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return curr[n][x][y][z]; }
|
||||
inline virtual FDTD_FLOAT& GetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return volt[n][x][y][z]; }
|
||||
inline virtual FDTD_FLOAT& GetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return curr[n][x][y][z]; }
|
||||
|
||||
inline virtual FDTD_FLOAT& GetVolt( unsigned int n, unsigned int pos[] ) { return volt[n][pos[0]][pos[1]][pos[2]]; }
|
||||
inline virtual FDTD_FLOAT& GetCurr( unsigned int n, unsigned int pos[] ) { return curr[n][pos[0]][pos[1]][pos[2]]; }
|
||||
inline virtual FDTD_FLOAT& GetVolt( unsigned int n, unsigned int pos[] ) { return GetVolt(n,pos[0],pos[1],pos[2]); }
|
||||
inline virtual FDTD_FLOAT& GetCurr( unsigned int n, unsigned int pos[] ) { return GetCurr(n,pos[0],pos[1],pos[2]); }
|
||||
|
||||
protected:
|
||||
Engine(const Operator* op);
|
||||
|
|
|
@ -69,7 +69,7 @@ void Engine_sse::UpdateVoltages()
|
|||
for (pos[1]=0;pos[1]<numLines[1];++pos[1])
|
||||
{
|
||||
shift[1]=pos[1];
|
||||
for (pos[2]=0;pos[2]<numLines[2]/4;++pos[2])
|
||||
for (pos[2]=0;pos[2]<ceil(numLines[2]/4);++pos[2])
|
||||
{
|
||||
// x-polarization
|
||||
temp.f[0] = curr_[1][pos[0]][pos[1]][pos[2]-(bool)pos[2]].f[3];
|
||||
|
@ -95,20 +95,6 @@ void Engine_sse::UpdateVoltages()
|
|||
}
|
||||
}
|
||||
|
||||
void Engine_sse::ApplyVoltageExcite()
|
||||
{
|
||||
int exc_pos;
|
||||
unsigned int pos;
|
||||
//soft voltage excitation here (E-field excite)
|
||||
for (unsigned int n=0;n<Op->E_Exc_Count;++n)
|
||||
{
|
||||
exc_pos = (int)numTS - (int)Op->E_Exc_delay[n];
|
||||
exc_pos *= (exc_pos>0 && exc_pos<=(int)Op->ExciteLength);
|
||||
pos = Op->E_Exc_index[2][n];
|
||||
volt_[Op->E_Exc_dir[n]][Op->E_Exc_index[0][n]][Op->E_Exc_index[1][n]][pos/4].f[pos%4] += Op->E_Exc_amp[n]*Op->ExciteSignal[exc_pos];
|
||||
}
|
||||
}
|
||||
|
||||
void Engine_sse::UpdateCurrents()
|
||||
{
|
||||
unsigned int pos[5];
|
||||
|
@ -118,7 +104,7 @@ void Engine_sse::UpdateCurrents()
|
|||
{
|
||||
for (pos[1]=0;pos[1]<numLines[1]-1;++pos[1])
|
||||
{
|
||||
for (pos[2]=0;pos[2]<numLines[2]/4;++pos[2]) // FIXME is this correct?
|
||||
for (pos[2]=0;pos[2]<ceil(numLines[2]/4);++pos[2]) // FIXME is this correct?
|
||||
{
|
||||
// x-pol
|
||||
temp.f[0] = volt_[1][pos[0]][pos[1]][pos[2]].f[1];
|
||||
|
@ -143,20 +129,3 @@ void Engine_sse::UpdateCurrents()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Engine_sse::ApplyCurrentExcite()
|
||||
{
|
||||
}
|
||||
|
||||
bool Engine_sse::IterateTS(unsigned int iterTS)
|
||||
{
|
||||
for (unsigned int iter=0;iter<iterTS;++iter)
|
||||
{
|
||||
UpdateVoltages();
|
||||
ApplyVoltageExcite();
|
||||
UpdateCurrents();
|
||||
ApplyCurrentExcite();
|
||||
++numTS;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,28 +30,20 @@ public:
|
|||
virtual void Init();
|
||||
virtual void Reset();
|
||||
|
||||
//!Iterate a number of timesteps
|
||||
virtual bool IterateTS(unsigned int iterTS);
|
||||
|
||||
virtual unsigned int GetNumberOfTimesteps() {return numTS;};
|
||||
|
||||
inline virtual FDTD_FLOAT GetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return volt_[n][x][y][z/4].f[z%4]; }
|
||||
inline virtual FDTD_FLOAT GetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return curr_[n][x][y][z/4].f[z%4]; }
|
||||
inline virtual FDTD_FLOAT& GetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return volt_[n][x][y][z/4].f[z%4]; }
|
||||
inline virtual FDTD_FLOAT& GetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return curr_[n][x][y][z/4].f[z%4]; }
|
||||
|
||||
protected:
|
||||
Engine_sse(const Operator_sse* op);
|
||||
const Operator_sse* Op;
|
||||
|
||||
virtual void UpdateVoltages();
|
||||
virtual void ApplyVoltageExcite();
|
||||
virtual void UpdateCurrents();
|
||||
virtual void ApplyCurrentExcite();
|
||||
|
||||
unsigned int numLines[3];
|
||||
|
||||
f4vector**** volt_;
|
||||
f4vector**** curr_;
|
||||
unsigned int numTS;
|
||||
};
|
||||
|
||||
#endif // ENGINE_SSE_H
|
||||
|
|
|
@ -149,10 +149,7 @@ void Delete_N_3DArray_v4sf(f4vector**** array, const unsigned int* numLines)
|
|||
|
||||
f4vector*** Create3DArray_v4sf(const unsigned int* numLines)
|
||||
{
|
||||
if ((numLines[2] % 4) != 0) {
|
||||
cerr << "sse engine needs number of mesh lines divideable by 4" << endl;
|
||||
exit(1);
|
||||
}
|
||||
unsigned int numZ = ceil(numLines[2]/4)+1;
|
||||
|
||||
f4vector*** array=NULL;
|
||||
unsigned int pos[3];
|
||||
|
@ -162,8 +159,8 @@ f4vector*** Create3DArray_v4sf(const unsigned int* numLines)
|
|||
array[pos[0]] = new f4vector*[numLines[1]];
|
||||
for (pos[1]=0;pos[1]<numLines[1];++pos[1])
|
||||
{
|
||||
array[pos[0]][pos[1]] = new f4vector[numLines[2]/4];
|
||||
for (pos[2]=0;pos[2]<numLines[2]/4;++pos[2])
|
||||
array[pos[0]][pos[1]] = new f4vector[numZ];
|
||||
for (pos[2]=0;pos[2]<numZ;++pos[2])
|
||||
{
|
||||
array[pos[0]][pos[1]][pos[2]].f[0] = 0;
|
||||
array[pos[0]][pos[1]][pos[2]].f[1] = 0;
|
||||
|
|
Loading…
Reference in New Issue