diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index 80882b5..bd3aa47 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -69,6 +69,9 @@ void Operator::Init() EC_L[n]=NULL; EC_R[n]=NULL; } + + for (int n=0;n<6;++n) + m_BC[n]=0; } void Operator::Reset() @@ -577,6 +580,11 @@ int Operator::CalcECOperator() if (CalcEFieldExcitation()==false) return -1; CalcPEC(); + bool PMC[6]; + for (int n=0;n<6;++n) + PMC[n] = m_BC[n]==1; + ApplyMagneticBC(PMC); + return 0; } diff --git a/FDTD/operator.h b/FDTD/operator.h index 120439d..ba202b3 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -53,6 +53,7 @@ public: //! Get the excitation timestep with the (first) max amplitude virtual unsigned int GetMaxExcitationTimestep() const; + virtual void SetBoundaryCondition(int* BCs) {for (int n=0;n<6;++n) m_BC[n]=BCs[n];} virtual void ApplyElectricBC(bool* dirs); //applied by default to all boundaries virtual void ApplyMagneticBC(bool* dirs); @@ -104,6 +105,8 @@ protected: ContinuousStructure* CSX; + int m_BC[6]; + //E-Field Excitation //! Calc the electric field excitation. virtual bool CalcEFieldExcitation(); diff --git a/openems.cpp b/openems.cpp index 8a0f6ce..63434e6 100644 --- a/openems.cpp +++ b/openems.cpp @@ -237,10 +237,6 @@ int openEMS::SetupFDTD(const char* file) return(-2); } - bool PMC[6]; - for (int n=0;n<6;++n) - PMC[n]=(bounds[n]==1); - //*************** setup operator ************// cout << "Create Operator..." << endl; if (CylinderCoords) @@ -255,8 +251,10 @@ int openEMS::SetupFDTD(const char* file) if (FDTD_Op->SetGeometryCSX(&CSX)==false) return(2); + FDTD_Op->SetBoundaryCondition(bounds); //operator only knows about PEC and PMC, everything else is defined by extensions (see below) + /**************************** create all operator/engine extensions here !!!! **********************************/ - //Mur-ABC + //Mur-ABC, defined as extension to the operator for (int n=0;n<6;++n) { if (bounds[n]==2) @@ -284,8 +282,6 @@ int openEMS::SetupFDTD(const char* file) FDTD_Op->ShowStat(); - FDTD_Op->ApplyMagneticBC(PMC); - cout << "Creation time for operator: " << difftime(OpDoneTime,startTime) << " s" << endl; //create FDTD engine