some fixes in processing routines

pull/1/head
Thorsten Liebig 2010-03-16 21:41:17 +01:00
parent 3ff4eec004
commit 0019eeb9b7
2 changed files with 19 additions and 12 deletions

View File

@ -109,20 +109,24 @@ void ProcessFieldsTD::DumpCellInterpol(ofstream &file)
void ProcessFieldsTD::DumpNoInterpol(ofstream &file) void ProcessFieldsTD::DumpNoInterpol(ofstream &file)
{ {
unsigned int pos[3];
double delta[3];
if (DumpType==0) if (DumpType==0)
{ {
//create array //create array
FDTD_FLOAT**** E_T = Create_N_3DArray(numLines); FDTD_FLOAT**** E_T = Create_N_3DArray(numLines);
unsigned int pos[3];
for (pos[0]=0;pos[0]<numLines[0];++pos[0]) for (pos[0]=0;pos[0]<numLines[0];++pos[0])
{ {
delta[0]=fabs(Op->MainOp->GetIndexDelta(0,pos[0]+start[0]));
for (pos[1]=0;pos[1]<numLines[1];++pos[1]) for (pos[1]=0;pos[1]<numLines[1];++pos[1])
{ {
delta[1]=fabs(Op->MainOp->GetIndexDelta(1,pos[1]+start[1]));
for (pos[2]=0;pos[2]<numLines[2];++pos[2]) for (pos[2]=0;pos[2]<numLines[2];++pos[2])
{ {
E_T[0][pos[0]][pos[1]][pos[2]] = Eng->volt[0][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]; delta[2]=fabs(Op->MainOp->GetIndexDelta(2,pos[2]+start[2]));
E_T[1][pos[0]][pos[1]][pos[2]] = Eng->volt[1][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]; E_T[0][pos[0]][pos[1]][pos[2]] = Eng->volt[0][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]/delta[0]/Op->gridDelta;
E_T[2][pos[0]][pos[1]][pos[2]] = Eng->volt[2][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]; E_T[1][pos[0]][pos[1]][pos[2]] = Eng->volt[1][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]/delta[1]/Op->gridDelta;
E_T[2][pos[0]][pos[1]][pos[2]] = Eng->volt[2][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]/delta[2]/Op->gridDelta;
} }
} }
} }
@ -135,17 +139,19 @@ void ProcessFieldsTD::DumpNoInterpol(ofstream &file)
{ {
//create array //create array
FDTD_FLOAT**** H_T = Create_N_3DArray(numLines); FDTD_FLOAT**** H_T = Create_N_3DArray(numLines);
unsigned int pos[3] = {start[0],start[1],start[2]};
for (pos[0]=0;pos[0]<numLines[0];++pos[0]) for (pos[0]=0;pos[0]<numLines[0];++pos[0])
{ {
delta[0]=fabs(Op->MainOp->GetIndexWidth(0,pos[0]+start[0]));
for (pos[1]=0;pos[1]<numLines[1];++pos[1]) for (pos[1]=0;pos[1]<numLines[1];++pos[1])
{ {
delta[1]=fabs(Op->MainOp->GetIndexWidth(1,pos[1]+start[1]));
for (pos[2]=0;pos[2]<numLines[2];++pos[2]) for (pos[2]=0;pos[2]<numLines[2];++pos[2])
{ {
delta[2]=fabs(Op->MainOp->GetIndexWidth(2,pos[2]+start[2]));
//in x //in x
H_T[0][pos[0]][pos[1]][pos[2]] = Eng->curr[0][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]; H_T[0][pos[0]][pos[1]][pos[2]] = Eng->curr[0][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]/delta[0]/Op->gridDelta;
H_T[1][pos[0]][pos[1]][pos[2]] = Eng->curr[1][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]; H_T[1][pos[0]][pos[1]][pos[2]] = Eng->curr[1][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]/delta[1]/Op->gridDelta;
H_T[2][pos[0]][pos[1]][pos[2]] = Eng->curr[2][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]; H_T[2][pos[0]][pos[1]][pos[2]] = Eng->curr[2][pos[0]+start[0]][pos[1]+start[1]][pos[2]+start[2]]/delta[2]/Op->gridDelta;
} }
} }
} }

View File

@ -56,24 +56,25 @@ double Processing::CalcLineIntegral(unsigned int* start, unsigned int* stop, int
array=Eng->curr; array=Eng->curr;
else return 0.0; else return 0.0;
unsigned int pos[3]={start[0],start[1],start[2]};
// cerr << Eng->volt[1][pos[0]][pos[1]][pos[2]] << endl;
for (int n=0;n<3;++n) for (int n=0;n<3;++n)
{ {
if (start[n]<stop[n]) if (start[n]<stop[n])
{ {
unsigned int pos[3]={start[0],start[1],start[2]};
for (;pos[n]<stop[n];++pos[n]) for (;pos[n]<stop[n];++pos[n])
{ {
result+=array[n][pos[0]][pos[1]][pos[2]]; result+=array[n][pos[0]][pos[1]][pos[2]];
// cerr << n << " " << pos[0] << " " << pos[1] << " " << pos[2] << " " << Eng->volt[n][pos[0]][pos[1]][pos[2]] << endl;
} }
} }
else else
{ {
for (;pos[n]>stop[n];--pos[n]) unsigned int pos[3]={stop[0],stop[1],stop[2]};
for (;pos[n]<start[n];++pos[n])
{
result-=array[n][pos[0]][pos[1]][pos[2]]; result-=array[n][pos[0]][pos[1]][pos[2]];
} }
} }
}
return result; return result;
} }