diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index 0feafb4..e6df2c9 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -334,6 +334,38 @@ void Operator::DumpOperator2File(string filename) file.close(); } +//! \brief dump PEC (perfect electric conductor) information (into VTK-file) +//! visualization via paraview +//! visualize only one component (x, y or z) +void Operator::DumpPEC2File( string filename ) +{ + ofstream file( filename.c_str() ); + if (!file.is_open()) { + cerr << "Operator::DumpPEC2File: Can't open file: " << filename << endl; + return; + } + + FDTD_FLOAT**** pec = Create_N_3DArray( numLines ); + unsigned int pos[3]; + + for (pos[0]=0; pos[0]GetIndexDelta( 0, pos[0] ); // PEC-x found + if ((GetVV(1,pos[0],pos[1],pos[2]) == 0) && (GetVI(1,pos[0],pos[1],pos[2]) == 0)) + pec[1][pos[0]][pos[1]][pos[2]] = MainOp->GetIndexDelta( 1, pos[1] ); // PEC-y found + if ((GetVV(2,pos[0],pos[1],pos[2]) == 0) && (GetVI(2,pos[0],pos[1],pos[2]) == 0)) + pec[2][pos[0]][pos[1]][pos[2]] = MainOp->GetIndexDelta( 2, pos[2] ); // PEC-z found + } + } + } + + ProcessFields::DumpVectorArray2VTK( file, "PEC", pec, discLines, numLines ); + + file.close(); +} + void Operator::DumpMaterial2File(string filename) { FDTD_FLOAT*** epsilon; diff --git a/FDTD/operator.h b/FDTD/operator.h index 8f5a1e7..93d45a9 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -64,6 +64,7 @@ public: virtual void DumpOperator2File(string filename); virtual void DumpMaterial2File(string filename); + virtual void DumpPEC2File( string filename ); //! Get the name for the given direction: 0 -> x, 1 -> y, 2 -> z virtual string GetDirName(int ny) const; diff --git a/openems.cpp b/openems.cpp index 095c2b1..d117545 100644 --- a/openems.cpp +++ b/openems.cpp @@ -48,7 +48,7 @@ openEMS::openEMS() Enable_Dumps = true; DebugMat = false; DebugOp = false; - m_debugBox = false; + m_debugBox = m_debugPEC = false; endCrit = 1e-6; m_OverSampling = 4; @@ -101,6 +101,12 @@ bool openEMS::parseCommandLineArgument( const char *argv ) DebugBox(); return true; } + else if (strcmp(argv,"--debug-PEC")==0) + { + cout << "openEMS - dumping PEC info to 'PEC_dump.vtk'" << endl; + m_debugPEC = true; + return true; + } else if (strcmp(argv,"--engine=multithreaded")==0) { cout << "openEMS - enabled multithreading" << endl; @@ -268,6 +274,8 @@ int openEMS::SetupFDTD(const char* file) } if (DebugOp) FDTD_Op->DumpOperator2File("operator_dump.vtk"); + if (m_debugPEC) + FDTD_Op->DumpPEC2File("PEC_dump.vtk"); time_t OpDoneTime=time(NULL); diff --git a/openems.h b/openems.h index efa9f2e..5af83ce 100644 --- a/openems.h +++ b/openems.h @@ -52,7 +52,7 @@ protected: bool Enable_Dumps; bool DebugMat; bool DebugOp; - bool m_debugBox; + bool m_debugBox, m_debugPEC; double endCrit; int m_OverSampling; Operator* FDTD_Op;