diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index fd3d467..fad8b97 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -140,16 +140,16 @@ bool Operator::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool du { for (int n=0;n<3;++n) coords[n]=GetDiscLine(n,pos[n],dualMesh); + coords[ny]=GetDiscLine(ny,pos[ny],!dualMesh); + + //check if position is inside the FDTD domain if (dualMesh==false) //main grid { - coords[ny]+=0.5*fabs(GetRawDiscDelta(ny,pos[ny])); if (pos[ny]>=numLines[ny]-1) return false; } else //dual grid { - coords[ny]-=0.5*fabs(GetRawDiscDelta(ny, pos[ny]-1)); - int nP = (ny+1)%3; int nPP = (ny+2)%3; if ((pos[nP]>=numLines[nP]-1) || (pos[nPP]>=numLines[nPP]-1)) diff --git a/FDTD/operator_cylinder.cpp b/FDTD/operator_cylinder.cpp index 9cd160a..a13e2f4 100644 --- a/FDTD/operator_cylinder.cpp +++ b/FDTD/operator_cylinder.cpp @@ -97,12 +97,14 @@ string Operator_Cylinder::GetDirName(int ny) const bool Operator_Cylinder::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const { - if (CC_closedAlpha && (coords[1]>GetDiscLine(1,0,false)+2*PI)) + bool ret = Operator_Multithread::GetYeeCoords(ny,pos,coords,dualMesh); + + if (CC_closedAlpha && (coords[1]>=GetDiscLine(1,0,false)+2*PI)) coords[1]-=2*PI; if (CC_closedAlpha && (coords[1]