From 08328e62b03f804dd543b01b13315cfe3ab63d80 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 6 Jun 2012 10:19:30 +0200 Subject: [PATCH] updates to GetYeeCoords the cylindrical multigrid will return false in case of a sub-grid mesh position --- FDTD/operator.cpp | 6 +++--- FDTD/operator_cylinder.cpp | 6 ++++-- FDTD/operator_cylindermultigrid.cpp | 10 ++++++++++ FDTD/operator_cylindermultigrid.h | 3 +++ 4 files changed, 20 insertions(+), 5 deletions(-) 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]