new debug option: dump PEC

command line parameter: --debug-PEC
writes a file PEC_dump.vtk which can be visualized with paraview
visualize one component (x,y,z) at a time using arrow glyphs
pull/1/head
Sebastian Held 2010-06-02 16:37:21 +02:00
parent 96144ed3a1
commit 82befba245
4 changed files with 43 additions and 2 deletions

View File

@ -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]<numLines[0]; pos[0]++) {
for (pos[1]=0; pos[1]<numLines[1]; pos[1]++) {
for (pos[2]=0; pos[2]<numLines[2]; pos[2]++) {
if ((GetVV(0,pos[0],pos[1],pos[2]) == 0) && (GetVI(0,pos[0],pos[1],pos[2]) == 0))
pec[0][pos[0]][pos[1]][pos[2]] = MainOp->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;

View File

@ -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;

View File

@ -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);

View File

@ -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;