From 0019eeb9b75c73608b029d71a56365201c26db7f Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Tue, 16 Mar 2010 21:41:17 +0100 Subject: [PATCH] some fixes in processing routines --- FDTD/processfields_td.cpp | 22 ++++++++++++++-------- FDTD/processing.cpp | 9 +++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/FDTD/processfields_td.cpp b/FDTD/processfields_td.cpp index 683da37..e95d9b5 100644 --- a/FDTD/processfields_td.cpp +++ b/FDTD/processfields_td.cpp @@ -109,20 +109,24 @@ void ProcessFieldsTD::DumpCellInterpol(ofstream &file) void ProcessFieldsTD::DumpNoInterpol(ofstream &file) { + unsigned int pos[3]; + double delta[3]; if (DumpType==0) { //create array FDTD_FLOAT**** E_T = Create_N_3DArray(numLines); - unsigned int pos[3]; for (pos[0]=0;pos[0]MainOp->GetIndexDelta(0,pos[0]+start[0])); for (pos[1]=0;pos[1]MainOp->GetIndexDelta(1,pos[1]+start[1])); for (pos[2]=0;pos[2]volt[0][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]]; - 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]=fabs(Op->MainOp->GetIndexDelta(2,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[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 FDTD_FLOAT**** H_T = Create_N_3DArray(numLines); - unsigned int pos[3] = {start[0],start[1],start[2]}; for (pos[0]=0;pos[0]MainOp->GetIndexWidth(0,pos[0]+start[0])); for (pos[1]=0;pos[1]MainOp->GetIndexWidth(1,pos[1]+start[1])); for (pos[2]=0;pos[2]MainOp->GetIndexWidth(2,pos[2]+start[2])); //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[1][pos[0]][pos[1]][pos[2]] = Eng->curr[1][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]]; + 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]]/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]]/delta[2]/Op->gridDelta; } } } diff --git a/FDTD/processing.cpp b/FDTD/processing.cpp index 34e19dd..5be1f68 100644 --- a/FDTD/processing.cpp +++ b/FDTD/processing.cpp @@ -56,22 +56,23 @@ double Processing::CalcLineIntegral(unsigned int* start, unsigned int* stop, int array=Eng->curr; 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) { if (start[n]volt[n][pos[0]][pos[1]][pos[2]] << endl; } } else { - for (;pos[n]>stop[n];--pos[n]) + unsigned int pos[3]={stop[0],stop[1],stop[2]}; + for (;pos[n]