added command line option --showProbeDiscretization

pull/1/head
Sebastian Held 2010-05-28 15:13:14 +02:00
parent 8333cf2f6a
commit f671b52986
6 changed files with 117 additions and 6 deletions

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tools/global.h"
#include "processcurrent.h"
#include <iomanip>
@ -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()

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tools/global.h"
#include "processing.h"
Processing::Processing(Operator* op, Engine* eng)
@ -87,8 +88,19 @@ void Processing::AddSteps(vector<unsigned int> 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

View File

@ -22,6 +22,7 @@
#include <sstream>
#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<argc;++n)
{
if (g_settings.parseCommandLineArgument(argv[n]))
continue;
if (!FDTD.parseCommandLineArgument(argv[n]))
cout << "openEMS - unknown argument: " << argv[n] << endl;
}

View File

@ -55,7 +55,8 @@ SOURCES += main.cpp \
FDTD/engine_ext_cylinder.cpp \
FDTD/operator_sse_compressed.cpp \
FDTD/engine_sse_compressed.cpp \
FDTD/operator_multithread.cpp
FDTD/operator_multithread.cpp \
tools/global.cpp
HEADERS += tools/ErrorMsg.h \
tools/AdrOp.h \
tools/constants.h \
@ -81,7 +82,8 @@ HEADERS += tools/ErrorMsg.h \
FDTD/engine_ext_cylinder.h \
FDTD/operator_sse_compressed.h \
FDTD/engine_sse_compressed.h \
FDTD/operator_multithread.h
FDTD/operator_multithread.h \
tools/global.h
QMAKE_CXXFLAGS_RELEASE = -O3 \
-g \
-march=native

46
tools/global.cpp Normal file
View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2010 Sebastian Held <sebastian.held@gmx.de>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <cstring>
#include <iostream>
#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;
}

35
tools/global.h Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2010 Sebastian Held <sebastian.held@gmx.de>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#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