From 1f20f7ae42b67b884d96b329d8e7ef66932adb1a Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 17 Mar 2010 23:16:41 +0100 Subject: [PATCH] new command-line option: dump operator to vtk-file --- FDTD/operator.cpp | 16 +++------------- main.cpp | 10 ++++++++-- openems.cpp | 5 +++++ openems.h | 2 ++ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index b232509..89f541c 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -186,21 +186,11 @@ void Operator::DumpOperator2File(string filename) cerr << "Operator::DumpOperator2File: Can't open file: " << filename << endl; 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; - file << "ix\tiy\tiz\tvi_x\tvi_y\tvi_z" << endl; - Dump_N_3DArray2File(file,vi,numLines); + string names[] = {"vv", "vi", "iv" , "ii"}; + FDTD_FLOAT**** array[] = {vv,vi,iv,ii}; - file << "########### Operator iv ###########" << endl; - 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); + ProcessFields::DumpMultiVectorArray2VTK(file, names , array , 4, discLines, numLines); file.close(); } diff --git a/main.cpp b/main.cpp index 3e235a7..ca5c195 100644 --- a/main.cpp +++ b/main.cpp @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) #ifdef STANDALONE 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); } @@ -52,6 +52,11 @@ int main(int argc, char *argv[]) cout << "openEMS - dumping material to 'material_dump.vtk'" << endl; FDTD.DebugMaterial(); } + else if (strcmp(argv[n],"--debug-operator")==0) + { + cout << "openEMS - dumping operator to 'operator_dump.vtk'" << endl; + FDTD.DebugOperator(); + } else cout << "openEMS - unknown argument: " << argv[n] << endl; } @@ -78,7 +83,8 @@ int main(int argc, char *argv[]) const char* file=fileHelix; - FDTD.DebugMaterial(); +// FDTD.DebugMaterial(); +// FDTD.DebugOperator(); #endif int EC = FDTD.SetupFDTD(file); diff --git a/openems.cpp b/openems.cpp index f6114a0..dba1765 100644 --- a/openems.cpp +++ b/openems.cpp @@ -35,6 +35,7 @@ openEMS::openEMS() PA=NULL; Enable_Dumps = true; DebugMat = false; + DebugOp = false; endCrit = 1e-6; } @@ -145,6 +146,10 @@ int openEMS::SetupFDTD(const char* file) FDTD_Op->DumpMaterial2File("material_dump.vtk"); } FDTD_Op->CalcECOperator(); + if (DebugOp) + { + FDTD_Op->DumpOperator2File("operator_dump.vtk"); + } if (Excit_Type==0) FDTD_Op->CalcGaussianPulsExcitation(f0,fc); diff --git a/openems.h b/openems.h index 6899fec..a0fa307 100644 --- a/openems.h +++ b/openems.h @@ -38,12 +38,14 @@ public: void SetEndCriteria(double val) {endCrit=val;} void DebugMaterial() {DebugMat=true;} + void DebugOperator() {DebugOp=true;} protected: //! Number of Timesteps int NrTS; bool Enable_Dumps; bool DebugMat; + bool DebugOp; double endCrit; Operator* FDTD_Op; Engine* FDTD_Eng;