From 0cdc26eba2c80f7d96bf009c5e440aa2c6cf535c Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 21 Nov 2012 16:41:53 +0100 Subject: [PATCH] cylindrical operator: improve mesh snapping for angular directions --- FDTD/operator_cylinder.cpp | 56 ++++++++++++++++++++++++++++++++++++++ FDTD/operator_cylinder.h | 7 +++++ 2 files changed, 63 insertions(+) diff --git a/FDTD/operator_cylinder.cpp b/FDTD/operator_cylinder.cpp index 293f782..d455196 100644 --- a/FDTD/operator_cylinder.cpp +++ b/FDTD/operator_cylinder.cpp @@ -201,6 +201,62 @@ double Operator_Cylinder::GetEdgeArea(int ny, const unsigned int pos[3], bool du return GetEdgeLength(1,pos,!dualMesh) * GetEdgeLength(2,pos,!dualMesh); } +double Operator_Cylinder::FitToAlphaRange(double a_coord) const +{ + double min = GetDiscLine(1,0); + double max = GetDiscLine(1,GetOriginalNumLines(1)-1); + if ((a_coord>=min) && (a_coord<=max)) + return a_coord; + while (a_coordmax) + return a_coord-2*PI; + if (a_coord>min) + return a_coord; + } + while (a_coord>max) + { + a_coord-=2*PI; + if (a_coorda_max) + a_stop=a_max; + if (a_stopa_max) + a_start=a_max; + if (a_start