diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index 7f7006e..f7b5588 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -731,18 +731,18 @@ bool Operator::CalcEFieldExcitation() vector vDelay; vector vDir; unsigned int ipos; - int pos[3]; + unsigned int pos[3]; double coord[3]; double delta[3]; double amp=0; - for (pos[2]=0;pos[2]<(int)numLines[2];++pos[2]) + for (pos[2]=0;pos[2]GetIndexDelta(2,pos[2])); - for (pos[1]=0;pos[1]<(int)numLines[1];++pos[1]) + for (pos[1]=0;pos[1]GetIndexDelta(1,pos[1])); - for (pos[0]=0;pos[0]<(int)numLines[0];++pos[0]) + for (pos[0]=0;pos[0]GetIndexDelta(0,pos[0])); coord[0] = discLines[0][pos[0]]; @@ -759,7 +759,7 @@ bool Operator::CalcEFieldExcitation() CSPropElectrode* elec = prop->ToElectrode(); if (elec!=NULL) { - if ((elec->GetActiveDir(n)) && (pos[n]<(int)numLines[n]-1)) + if ((elec->GetActiveDir(n)) && (pos[n]GetWeightedExcitation(n,coord)*delta[n]*gridDelta; if (amp!=0) @@ -824,7 +824,7 @@ bool Operator::CalcEFieldExcitation() // cerr << n << " " << coord[0] << " " << coord[1] << " " << coord[2] << endl; if (elec!=NULL) { - if ((elec->GetActiveDir(n)) && (pos[n]<(int)numLines[n]-1)) + if ((elec->GetActiveDir(n)) && (pos[n]GetWeightedExcitation(n,coord)*deltaN*gridDelta; if (amp!=0) diff --git a/FDTD/processfields.cpp b/FDTD/processfields.cpp index 4c46261..ff70810 100644 --- a/FDTD/processfields.cpp +++ b/FDTD/processfields.cpp @@ -185,12 +185,13 @@ bool ProcessFields::DumpVectorArray2VTK(ofstream &file, string name, FDTD_FLOAT* { WriteVTKHeader(file, discLines, numLines); WriteVTKVectorArray(file, name, array, numLines); + return true; } bool ProcessFields::DumpMultiVectorArray2VTK(ofstream &file, string names[], FDTD_FLOAT**** array[], unsigned int numFields, double** discLines, unsigned int* numLines) { WriteVTKHeader(file, discLines, numLines); - for (int n=0;nQueryIntAttribute("NumberOfTimesteps",&NrTS); + int help=0; + FDTD_Opts->QueryIntAttribute("NumberOfTimesteps",&help); + if (help<0) + NrTS=0; + else + NrTS = help; FDTD_Opts->QueryDoubleAttribute("endCriteria",&endCrit); if (endCrit==0) endCrit=1e-6; @@ -325,14 +330,14 @@ void openEMS::RunFDTD() double t_diff; //*************** simulate ************// int step=PA->Process(); - if ((step<0) || (step>NrTS)) step=NrTS; + if ((step<0) || (step>(int)NrTS)) step=NrTS; while ((FDTD_Eng->GetNumberOfTimesteps()endCrit)) { FDTD_Eng->IterateTS(step); step=PA->Process(); // cout << " do " << step << " steps; current: " << eng.GetNumberOfTimesteps() << endl; currTS = FDTD_Eng->GetNumberOfTimesteps(); - if ((step<0) || (step>NrTS - currTS)) step=NrTS - currTS; + if ((step<0) || (step>(int)(NrTS - currTS))) step=NrTS - currTS; gettimeofday(&currTime,NULL); diff --git a/openems.h b/openems.h index 73bc943..ca3378b 100644 --- a/openems.h +++ b/openems.h @@ -44,7 +44,7 @@ public: protected: //! Number of Timesteps - int NrTS; + unsigned int NrTS; bool Enable_Dumps; bool DebugMat; bool DebugOp;