diff --git a/FDTD/extensions/operator_ext_upml.cpp b/FDTD/extensions/operator_ext_upml.cpp index eba8451..3b8d29c 100644 --- a/FDTD/extensions/operator_ext_upml.cpp +++ b/FDTD/extensions/operator_ext_upml.cpp @@ -97,13 +97,13 @@ bool Operator_Ext_UPML::Create_UPML(Operator* op, const int ui_BC[6], const unsi size[0]=0; cerr << "Operator_Ext_UPML::Create_UPML: Warning: An upml in r-min direction is not possible, resetting to PEC..." << endl; } - if (BC[2]==3) + if ( (BC[2]==3) && (op_cyl->GetClosedAlpha()) ) { BC[2]=0; size[2]=0; cerr << "Operator_Ext_UPML::Create_UPML: Warning: An upml in alpha-min direction is not possible, resetting to PEC..." << endl; } - if (BC[3]==3) + if ( (BC[3]==3) && (op_cyl->GetClosedAlpha()) ) { BC[3]=0; size[3]=0; @@ -276,6 +276,12 @@ void Operator_Ext_UPML::CalcGradingKappa(int ny, unsigned int pos[3], double Zm, width = (m_Op->GetDiscLine(n,m_Size[2*n]) - m_Op->GetDiscLine(n,0))*m_Op->GetGridDelta(); depth = width - (m_Op->GetDiscLine(n,pos[n]) - m_Op->GetDiscLine(n,0))*m_Op->GetGridDelta(); + if ((m_Op_Cyl) && (n==1)) + { + width *= m_Op_Cyl->GetDiscLine(0,pos[0]); + depth *= m_Op_Cyl->GetDiscLine(0,pos[0]); + } + if (n==ny) depth-=m_Op->GetEdgeLength(n,pos)/2; double vars[5] = {depth, width/m_Size[2*n], width, Zm, m_Size[2*n]}; @@ -301,6 +307,12 @@ void Operator_Ext_UPML::CalcGradingKappa(int ny, unsigned int pos[3], double Zm, width = (m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-1) - m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-m_Size[2*n+1]-1))*m_Op->GetGridDelta(); depth = width - (m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-1) - m_Op->GetDiscLine(n,pos[n]))*m_Op->GetGridDelta(); + if ((m_Op_Cyl) && (n==1)) + { + width *= m_Op_Cyl->GetDiscLine(0,pos[0]); + depth *= m_Op_Cyl->GetDiscLine(0,pos[0]); + } + if (n==ny) depth+=m_Op->GetEdgeLength(n,pos)/2; double vars[5] = {depth, width/(m_Size[2*n]), width, Zm, m_Size[2*n]}; diff --git a/FDTD/extensions/operator_extension.cpp b/FDTD/extensions/operator_extension.cpp index 20ed422..1f5d14b 100644 --- a/FDTD/extensions/operator_extension.cpp +++ b/FDTD/extensions/operator_extension.cpp @@ -17,10 +17,13 @@ #include "operator_extension.h" #include "FDTD/operator.h" +#include "FDTD/operator_cylinder.h" Operator_Extension::Operator_Extension(Operator* op) { m_Op = op; + + m_Op_Cyl = dynamic_cast(op); } Operator_Extension::~Operator_Extension() diff --git a/FDTD/extensions/operator_extension.h b/FDTD/extensions/operator_extension.h index 28b70a8..0856377 100644 --- a/FDTD/extensions/operator_extension.h +++ b/FDTD/extensions/operator_extension.h @@ -29,6 +29,7 @@ using namespace std; class Operator; +class Operator_Cylinder; class Engine_Extension; //! Abstract base-class for all operator extensions @@ -63,7 +64,12 @@ protected: Operator_Extension(Operator* op); //! Copy constructor, returns NULL if extension cannot be copied... Operator_Extension(Operator* op, Operator_Extension* op_ext); + + //FDTD Operator Operator* m_Op; + + //Cylindrical FDTD Operator (not NULL if a cylindrical FDTD is used) + Operator_Cylinder* m_Op_Cyl; }; #endif // OPERATOR_EXTENSION_H