fixed lots of int/u-int comparison and missing return values

pull/1/head
Thorsten Liebig 2010-03-26 19:51:09 +01:00
parent 207e22f1db
commit 98f72a855e
3 changed files with 19 additions and 14 deletions

View File

@ -139,9 +139,9 @@ struct Operator::Grid_Path Operator::FindPath(double start[], double stop[])
double meshStart[] = {discLines[0][uiStart[0]], discLines[1][uiStart[1]], discLines[2][uiStart[2]]};
double meshStop[] = {discLines[0][uiStop[0]], discLines[1][uiStop[1]], discLines[2][uiStop[2]]};
double foot,dist,minFoot,minDist;
int minDir;
bool UpDir;
double foot=0,dist=0,minFoot=0,minDist=0;
int minDir=0;
unsigned int minPos[3];
double startFoot,stopFoot,currFoot;
Point_Line_Distance(meshStart,start,stop,startFoot,dist);
@ -158,7 +158,7 @@ struct Operator::Grid_Path Operator::FindPath(double start[], double stop[])
P[0] = discLines[0][currPos[0]];
P[1] = discLines[1][currPos[1]];
P[2] = discLines[2][currPos[2]];
if ((currPos[n]-1)>=0)
if (((int)currPos[n]-1)>=0)
{
P[n] = discLines[n][currPos[n]-1];
Point_Line_Distance(P,start,stop,foot,dist);
@ -725,13 +725,13 @@ bool Operator::CalcEFieldExcitation()
double delta[3];
double amp=0;
for (pos[2]=0;pos[2]<numLines[2];++pos[2])
for (pos[2]=0;pos[2]<(int)numLines[2];++pos[2])
{
delta[2]=fabs(MainOp->GetIndexDelta(2,pos[2]));
for (pos[1]=0;pos[1]<numLines[1];++pos[1])
for (pos[1]=0;pos[1]<(int)numLines[1];++pos[1])
{
delta[1]=fabs(MainOp->GetIndexDelta(1,pos[1]));
for (pos[0]=0;pos[0]<numLines[0];++pos[0])
for (pos[0]=0;pos[0]<(int)numLines[0];++pos[0])
{
delta[0]=fabs(MainOp->GetIndexDelta(0,pos[0]));
coord[0] = discLines[0][pos[0]];
@ -748,7 +748,7 @@ bool Operator::CalcEFieldExcitation()
CSPropElectrode* elec = prop->ToElectrode();
if (elec!=NULL)
{
if ((elec->GetActiveDir(n)) && (pos[n]<numLines[n]-1))
if ((elec->GetActiveDir(n)) && (pos[n]<(int)numLines[n]-1))
{
amp = elec->GetWeightedExcitation(n,coord)*delta[n]*gridDelta;
if (amp!=0)
@ -865,5 +865,7 @@ bool Operator::CalcPEC()
}
}
}
return true;
}

View File

@ -65,22 +65,22 @@ int ProcessCurrent::Process()
}
//x-current
for (int i=start[0];i<stop[0];++i)
for (unsigned int i=start[0];i<stop[0];++i)
current+=Eng->curr[0][i][start[1]][start[2]];
//y-current
for (int i=start[1];i<stop[1];++i)
for (unsigned int i=start[1];i<stop[1];++i)
current+=Eng->curr[1][stop[0]][i][start[2]];
//z-current
for (int i=start[2];i<stop[2];++i)
for (unsigned int i=start[2];i<stop[2];++i)
current+=Eng->curr[2][stop[0]][stop[1]][i];
//x-current
for (int i=start[0];i<stop[0];++i)
for (unsigned int i=start[0];i<stop[0];++i)
current-=Eng->curr[0][i][stop[1]][stop[2]];
//y-current
for (int i=start[1];i<stop[1];++i)
for (unsigned int i=start[1];i<stop[1];++i)
current-=Eng->curr[1][start[0]][i][stop[2]];
//z-current
for (int i=start[2];i<stop[2];++i)
for (unsigned int i=start[2];i<stop[2];++i)
current-=Eng->curr[2][start[0]][start[1]][i];
// cerr << "ts: " << Eng->numTS << " i: " << current << endl;

View File

@ -193,6 +193,7 @@ bool ProcessFields::DumpMultiVectorArray2VTK(ofstream &file, string names[], FDT
WriteVTKVectorArray(file, names[n], array[n], numLines);
file << endl;
}
return true;
}
void ProcessFields::WriteVTKScalarArray(ofstream &file, string name, FDTD_FLOAT*** array, unsigned int* numLines)
@ -220,16 +221,18 @@ bool ProcessFields::DumpScalarArray2VTK(ofstream &file, string name, FDTD_FLOAT*
{
WriteVTKHeader(file, discLines, numLines);
WriteVTKScalarArray(file, name, array, numLines);
return true;
}
bool ProcessFields::DumpMultiScalarArray2VTK(ofstream &file, string names[], FDTD_FLOAT*** array[], unsigned int numFields, double** discLines, unsigned int* numLines)
{
WriteVTKHeader(file, discLines, numLines);
for (int n=0;n<numFields;++n)
for (unsigned int n=0;n<numFields;++n)
{
WriteVTKScalarArray(file, names[n], array[n], numLines);
file << endl;
}
return true;
}