new command-line option: dump operator to vtk-file

This commit is contained in:
Thorsten Liebig 2010-03-17 23:16:41 +01:00
parent a662c405f2
commit 1f20f7ae42
4 changed files with 18 additions and 15 deletions

View File

@ -186,21 +186,11 @@ void Operator::DumpOperator2File(string filename)
cerr << "Operator::DumpOperator2File: Can't open file: " << filename << endl; cerr << "Operator::DumpOperator2File: Can't open file: " << filename << endl;
return; return;
} }
file << "########### Operator vv ###########" << endl;
file << "ix\tiy\tiz\tvv_x\tvv_y\tvv_z" << endl;
Dump_N_3DArray2File(file,vv,numLines);
file << "########### Operator vi ###########" << endl; string names[] = {"vv", "vi", "iv" , "ii"};
file << "ix\tiy\tiz\tvi_x\tvi_y\tvi_z" << endl; FDTD_FLOAT**** array[] = {vv,vi,iv,ii};
Dump_N_3DArray2File(file,vi,numLines);
file << "########### Operator iv ###########" << endl; ProcessFields::DumpMultiVectorArray2VTK(file, names , array , 4, discLines, numLines);
file << "ix\tiy\tiz\tiv_x\tiv_y\tiv_z" << endl;
Dump_N_3DArray2File(file,iv,numLines);
file << "########### Operator ii ###########" << endl;
file << "ix\tiy\tiz\tii_x\tii_y\tii_z" << endl;
Dump_N_3DArray2File(file,ii,numLines);
file.close(); file.close();
} }

View File

@ -34,7 +34,7 @@ int main(int argc, char *argv[])
#ifdef STANDALONE #ifdef STANDALONE
if (argc<=1) if (argc<=1)
{ {
cout << " usage: openEMS FDTD_XML_FILE [--disable-dumps] [--debug-material]" << endl; cout << " usage: openEMS FDTD_XML_FILE [--disable-dumps] [--debug-material] [--debug-operator]" << endl;
exit(-1); exit(-1);
} }
@ -52,6 +52,11 @@ int main(int argc, char *argv[])
cout << "openEMS - dumping material to 'material_dump.vtk'" << endl; cout << "openEMS - dumping material to 'material_dump.vtk'" << endl;
FDTD.DebugMaterial(); FDTD.DebugMaterial();
} }
else if (strcmp(argv[n],"--debug-operator")==0)
{
cout << "openEMS - dumping operator to 'operator_dump.vtk'" << endl;
FDTD.DebugOperator();
}
else else
cout << "openEMS - unknown argument: " << argv[n] << endl; cout << "openEMS - unknown argument: " << argv[n] << endl;
} }
@ -78,7 +83,8 @@ int main(int argc, char *argv[])
const char* file=fileHelix; const char* file=fileHelix;
FDTD.DebugMaterial(); // FDTD.DebugMaterial();
// FDTD.DebugOperator();
#endif #endif
int EC = FDTD.SetupFDTD(file); int EC = FDTD.SetupFDTD(file);

View File

@ -35,6 +35,7 @@ openEMS::openEMS()
PA=NULL; PA=NULL;
Enable_Dumps = true; Enable_Dumps = true;
DebugMat = false; DebugMat = false;
DebugOp = false;
endCrit = 1e-6; endCrit = 1e-6;
} }
@ -145,6 +146,10 @@ int openEMS::SetupFDTD(const char* file)
FDTD_Op->DumpMaterial2File("material_dump.vtk"); FDTD_Op->DumpMaterial2File("material_dump.vtk");
} }
FDTD_Op->CalcECOperator(); FDTD_Op->CalcECOperator();
if (DebugOp)
{
FDTD_Op->DumpOperator2File("operator_dump.vtk");
}
if (Excit_Type==0) if (Excit_Type==0)
FDTD_Op->CalcGaussianPulsExcitation(f0,fc); FDTD_Op->CalcGaussianPulsExcitation(f0,fc);

View File

@ -38,12 +38,14 @@ public:
void SetEndCriteria(double val) {endCrit=val;} void SetEndCriteria(double val) {endCrit=val;}
void DebugMaterial() {DebugMat=true;} void DebugMaterial() {DebugMat=true;}
void DebugOperator() {DebugOp=true;}
protected: protected:
//! Number of Timesteps //! Number of Timesteps
int NrTS; int NrTS;
bool Enable_Dumps; bool Enable_Dumps;
bool DebugMat; bool DebugMat;
bool DebugOp;
double endCrit; double endCrit;
Operator* FDTD_Op; Operator* FDTD_Op;
Engine* FDTD_Eng; Engine* FDTD_Eng;