diff --git a/FDTD/processcurrent.cpp b/FDTD/processcurrent.cpp
index 28e2622..3ed12b1 100644
--- a/FDTD/processcurrent.cpp
+++ b/FDTD/processcurrent.cpp
@@ -15,6 +15,7 @@
* along with this program. If not, see .
*/
+#include "tools/global.h"
#include "processcurrent.h"
#include
@@ -28,8 +29,19 @@ ProcessCurrent::~ProcessCurrent()
void ProcessCurrent::DefineStartStopCoord(double* dstart, double* dstop)
{
- if (Op->SnapToMesh(dstart,start,true,m_start_inside)==false) cerr << "ProcessCurrent::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
- if (Op->SnapToMesh(dstop,stop,true,m_stop_inside)==false) cerr << "ProcessCurrent::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
+ if (Op->SnapToMesh(dstart,start)==false)
+ cerr << "ProcessCurrent::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
+ if (Op->SnapToMesh(dstop,stop)==false)
+ cerr << "ProcessCurrent::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
+
+ if (g_settings.showProbeDiscretization()) {
+ cerr << m_filename << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], true ) << ","
+ << Op->GetDiscLine( 1, start[1], true ) << "," << Op->GetDiscLine( 2, start[2], true ) << ") -> ("
+ << Op->GetDiscLine( 0, stop[0], true ) << ","<< Op->GetDiscLine( 1, stop[1], true ) << ","
+ << Op->GetDiscLine( 2, stop[2], true ) << ")";
+ cerr << " [" << start[0] << "," << start[1] << "," << start[2] << "] -> ["
+ << stop[0] << "," << stop[1] << "," << stop[2] << "]" << endl;
+ }
}
int ProcessCurrent::Process()
diff --git a/FDTD/processing.cpp b/FDTD/processing.cpp
index d557fd6..5b1835f 100644
--- a/FDTD/processing.cpp
+++ b/FDTD/processing.cpp
@@ -15,6 +15,7 @@
* along with this program. If not, see .
*/
+#include "tools/global.h"
#include "processing.h"
Processing::Processing(Operator* op, Engine* eng)
@@ -87,8 +88,19 @@ void Processing::AddSteps(vector steps)
void Processing::DefineStartStopCoord(double* dstart, double* dstop)
{
- if (Op->SnapToMesh(dstart,start)==false) cerr << "Processing::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
- if (Op->SnapToMesh(dstop,stop)==false) cerr << "Processing::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
+ if (Op->SnapToMesh(dstart,start)==false)
+ cerr << "Processing::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
+ if (Op->SnapToMesh(dstop,stop)==false)
+ cerr << "Processing::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
+
+ if (g_settings.showProbeDiscretization()) {
+ cerr << m_filename << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], false ) << ","
+ << Op->GetDiscLine( 1, start[1], false ) << "," << Op->GetDiscLine( 2, start[2], false ) << ") -> ("
+ << Op->GetDiscLine( 0, stop[0], false ) << ","<< Op->GetDiscLine( 1, stop[1], false ) << ","
+ << Op->GetDiscLine( 2, stop[2], false ) << ")";
+ cerr << " [" << start[0] << "," << start[1] << "," << start[2] << "] -> ["
+ << stop[0] << "," << stop[1] << "," << stop[2] << "]" << endl;
+ }
}
double Processing::CalcLineIntegral(unsigned int* start, unsigned int* stop, int field) const
diff --git a/main.cpp b/main.cpp
index 20703c7..7514a28 100644
--- a/main.cpp
+++ b/main.cpp
@@ -22,6 +22,7 @@
#include
#include "openems.h"
+#include "tools/global.h"
#ifndef GIT_VERSION
#define GIT_VERSION "unknown:compiled@" __DATE__
@@ -60,6 +61,9 @@ int main(int argc, char *argv[])
{
for (int n=2;n
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*/
+
+#include
+#include
+#include "global.h"
+
+using namespace std;
+
+// create global object
+Global g_settings;
+
+Global::Global()
+{
+ m_showProbeDiscretization = false;
+}
+
+//! \brief This function initializes the object
+bool Global::parseCommandLineArgument( const char *argv )
+{
+ if (!argv)
+ return false;
+
+ if (strcmp(argv,"--showProbeDiscretization")==0)
+ {
+ cout << "openEMS - showing probe discretization information" << endl;
+ m_showProbeDiscretization = true;
+ return true;
+ }
+
+ return false;
+}
diff --git a/tools/global.h b/tools/global.h
new file mode 100644
index 0000000..10e5e34
--- /dev/null
+++ b/tools/global.h
@@ -0,0 +1,35 @@
+/*
+* Copyright (C) 2010 Sebastian Held
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*/
+
+#ifndef GLOBAL_H
+#define GLOBAL_H
+
+class Global
+{
+public:
+ Global();
+ bool parseCommandLineArgument( const char *argv );
+
+ bool showProbeDiscretization() const {return m_showProbeDiscretization;}
+
+protected:
+ bool m_showProbeDiscretization;
+};
+
+extern Global g_settings;
+
+#endif // GLOBAL_H