diff --git a/Common/process_efield.cpp b/Common/process_efield.cpp
deleted file mode 100644
index 2d820dc..0000000
--- a/Common/process_efield.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-* 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 .
-*/
-
-#include
-#include "time.h"
-#include "process_efield.h"
-
-ProcessEField::ProcessEField(Engine_Interface_Base* eng_if, Engine* eng) : Processing(eng_if)
-{
- Eng = eng;
-}
-
-ProcessEField::~ProcessEField()
-{
- FlushData();
-}
-
-string ProcessEField::GetIntegralName(int row) const
-{
- if (row==0)
- return "Ex/(V/m)";
- if (row==1)
- return "Ey/(V/m)";
- if (row==2)
- return "Ez/(V/m)";
- return "unknown";
-}
-
-void ProcessEField::InitProcess()
-{
- OpenFile(m_Name);
- for (int n=0; n<3; n++)
- FD_Values[n].assign(m_FD_Samples.size(),double_complex(0.0,0.0));
-
- file << "% time-domain E-field probe by openEMS " GIT_VERSION << endl;
- file << "% coords: (" << Op->GetDiscLine(0,start[0])*Op->GetGridDelta() << ","
- << Op->GetDiscLine(1,start[1])*Op->GetGridDelta() << ","
- << Op->GetDiscLine(2,start[2])*Op->GetGridDelta() << ") m -> [" << start[0] << "," << start[1] << "," << start[2] << "]" << endl;
- file << "% t/s\tEx/(V/m)\tEy/(V/m)\tEz/(V/m)" << endl;
-}
-
-void ProcessEField::FlushData()
-{
- if (m_FD_Samples.size())
- Dump_FD_Data(FD_Values,1.0/(double)m_FD_SampleCount,m_filename + "_FD");
-}
-
-void ProcessEField::Dump_FD_Data(vector value[3], double factor, string filename)
-{
- if (value[0].size()==0)
- return;
- if (value[0].size()!=m_FD_Samples.size())
- {
- cerr << "Processing::Dump_FD_Data: Error: Complex value and frequency vector have different size! This should never happend!!!" << endl;
- return;
- }
- ofstream file;
- file.open( filename.c_str() );
- if (!file.is_open())
- cerr << "Can't open file: " << filename << endl;
-
- time_t rawTime;
- time(&rawTime);
- file << "%dump by openEMS @" << ctime(&rawTime) << "%frequency\treal_x\timag_x\treal_y\timag_y\treal_z\timag_z\n";
- for (size_t n=0; nGetNumberOfTimesteps()%ProcessInterval==0)
- {
- file << setprecision(m_precision) << (double)Eng->GetNumberOfTimesteps()*Op->GetTimestep();
- for (int n=0; n<3; n++)
- {
- FDTD_FLOAT field = Eng->GetVolt(n,start) / Op->GetEdgeLength(n,start);
- field *= m_weight;
-// TD_Values.push_back(voltage);
- file << "\t" << field;
- }
- file << endl;
- }
- }
-
- if (m_FD_Interval)
- {
- // frequency-domain processing
- if (Eng->GetNumberOfTimesteps()%m_FD_Interval==0)
- {
- double T = (double)Eng->GetNumberOfTimesteps() * Op->GetTimestep();
- for (int pol=0; pol<3; pol++)
- {
- FDTD_FLOAT field = Eng->GetVolt(pol,start) / Op->GetEdgeLength(pol,start);
- field *= m_weight;
- for (size_t n=0; n.
-*/
-
-#ifndef PROCESS_EFIELD_H
-#define PROCESS_EFIELD_H
-
-#include "processing.h"
-#include "FDTD/engine.h"
-
-/*! \brief Process E-field at a point
-
- This class calculates the E-field at a point in the FDTD lattice.
- Other primitives than \c Point are not supported.
-*/
-class ProcessEField : public Processing
-{
-public:
- ProcessEField(Engine_Interface_Base* eng_if, Engine* eng);
- virtual ~ProcessEField();
-
- virtual string GetProcessingName() const {return "electric field probe";}
-
- virtual string GetIntegralName(int row) const;
-
- virtual void InitProcess();
- virtual void FlushData();
- void Dump_FD_Data(vector value[3], double factor, string filename);
- virtual int Process();
-
-protected:
- Engine* Eng;
- vector FD_Values[3];
-};
-
-#endif // PROCESS_EFIELD_H
diff --git a/Common/process_hfield.cpp b/Common/process_hfield.cpp
deleted file mode 100644
index 2947289..0000000
--- a/Common/process_hfield.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-* 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 .
-*/
-
-#include
-#include "tools/global.h"
-#include "process_hfield.h"
-
-ProcessHField::ProcessHField(Engine_Interface_Base* eng_if, Engine* eng) : ProcessEField(eng_if, eng)
-{
-}
-
-ProcessHField::~ProcessHField()
-{
-}
-
-string ProcessHField::GetIntegralName(int row) const
-{
- if (row==0)
- return "Hx/(A/m)";
- if (row==1)
- return "Hy/(A/m)";
- if (row==2)
- return "Hz/(A/m)";
- return "unknown";
-}
-
-void ProcessHField::InitProcess()
-{
- OpenFile(m_Name);
- for (int n=0; n<3; n++)
- FD_Values[n].assign(m_FD_Samples.size(),double_complex(0.0,0.0));
-
- file << "% time-domain H-field probe by openEMS " GIT_VERSION << endl;
- file << "% coords: (" << Op->GetDiscLine(0,start[0],true)*Op->GetGridDelta() << ","
- << Op->GetDiscLine(1,start[1],true)*Op->GetGridDelta() << ","
- << Op->GetDiscLine(2,start[2],true)*Op->GetGridDelta() << ") m -> [" << start[0] << "," << start[1] << "," << start[2] << "]" << endl;
- file << "% t/s\tEx/(A/m)\tEy/(A/m)\tEz/(A/m)" << endl;
-}
-
-void ProcessHField::DefineStartStopCoord(double* dstart, double* dstop)
-{
- if (Op->SnapToMesh(dstart,start,true,m_start_inside)==false)
- cerr << "ProcessHField::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
- if (Op->SnapToMesh(dstop,stop,true,m_stop_inside)==false)
- cerr << "ProcessHField::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
-
- if (g_settings.showProbeDiscretization())
- {
- cerr << m_Name << ": 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 ProcessHField::Process()
-{
- if (!Enabled)
- return -1;
- if (CheckTimestep()==false)
- return GetNextInterval();
-
-
- if (ProcessInterval)
- {
- // time-domain processing
- if (Eng->GetNumberOfTimesteps()%ProcessInterval==0)
- {
- file << setprecision(m_precision) << ((double)Eng->GetNumberOfTimesteps()+0.5)*Op->GetTimestep();
- for (int n=0; n<3; n++)
- {
- FDTD_FLOAT field = Eng->GetCurr(n,start) / Op->GetEdgeLength(n,start,true);
- field *= m_weight;
-// TD_Values.push_back(voltage);
- file << "\t" << field;
- }
- file << endl;
- }
- }
-
- if (m_FD_Interval)
- {
- // frequency-domain processing
- if (Eng->GetNumberOfTimesteps()%m_FD_Interval==0)
- {
- double T = (double)Eng->GetNumberOfTimesteps() * Op->GetTimestep();
- for (int pol=0; pol<3; pol++)
- {
- FDTD_FLOAT field = Eng->GetCurr(pol,start) / Op->GetEdgeLength(pol,start,true);
- field *= m_weight;
- for (size_t n=0; n.
+*/
+
+#include "processfieldprobe.h"
+
+ProcessFieldProbe::ProcessFieldProbe(Engine_Interface_Base* eng_if, int type) : ProcessIntegral(eng_if)
+{
+ SetFieldType(type);
+}
+
+ProcessFieldProbe::~ProcessFieldProbe()
+{
+
+}
+
+string ProcessFieldProbe::GetProcessingName() const
+{
+ if (m_ModeFieldType==0)
+ return "electric field probe";
+ if (m_ModeFieldType==1)
+ return "magnetic field probe";
+ return "unknown field probe";
+}
+
+string ProcessFieldProbe::GetIntegralName(int row) const
+{
+ if (row==0)
+ {
+ if (m_ModeFieldType==0)
+ return "Ex/(V/m)";
+ if (m_ModeFieldType==1)
+ return "Hx/(A/m)";
+ }
+ if (row==1)
+ {
+ if (m_ModeFieldType==0)
+ return "Ey/(V/m)";
+ if (m_ModeFieldType==1)
+ return "Hy/(A/m)";
+ }
+ if (row==2)
+ {
+ if (m_ModeFieldType==0)
+ return "Ez/(V/m)";
+ if (m_ModeFieldType==1)
+ return "Hz/(A/m)";
+ }
+ return "unknown";
+}
+
+void ProcessFieldProbe::SetFieldType(int type)
+{
+ if ((type<0) || (type>1))
+ {
+ cerr << "ProcessFieldProbe::SetFieldType: Error: unknown field type... skipping" << endl;
+ Enabled=false;
+ }
+ m_ModeFieldType = type;
+}
+
+double* ProcessFieldProbe::CalcMultipleIntegrals()
+{
+ m_Eng_Interface->SetInterpolationType(Engine_Interface_Base::NO_INTERPOLATION);
+
+ switch (m_ModeFieldType)
+ {
+ case 0:
+ default:
+ m_Eng_Interface->GetEField(start,m_Results);
+ break;
+ case 1:
+ m_Eng_Interface->GetHField(start,m_Results);
+ break;
+ }
+ return m_Results;
+}
diff --git a/Common/process_hfield.h b/Common/processfieldprobe.h
similarity index 52%
rename from Common/process_hfield.h
rename to Common/processfieldprobe.h
index 9f71eb9..d14b965 100644
--- a/Common/process_hfield.h
+++ b/Common/processfieldprobe.h
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2010 Sebastian Held (sebastian.held@gmx.de)
+* Copyright (C) 2011 Thorsten Liebig (Thorsten.Liebig@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
@@ -15,29 +15,29 @@
* along with this program. If not, see .
*/
-#ifndef PROCESS_HFIELD_H
-#define PROCESS_HFIELD_H
+#ifndef PROCESSFIELDPROBE_H
+#define PROCESSFIELDPROBE_H
-#include "process_efield.h"
+#include "processintegral.h"
-/*! \brief Process H-field at a point
-
- This class calculates the E-field at a point in the FDTD lattice.
- Other primitives than \c Point are not supported.
-*/
-class ProcessHField : public ProcessEField
+class ProcessFieldProbe : public ProcessIntegral
{
public:
- ProcessHField(Engine_Interface_Base* eng_if, Engine* eng);
- virtual ~ProcessHField();
+ ProcessFieldProbe(Engine_Interface_Base* eng_if, int type=0);
+ virtual ~ProcessFieldProbe();
- virtual string GetProcessingName() const {return "magnetic field probe";}
+ virtual string GetProcessingName() const;
virtual string GetIntegralName(int row) const;
- virtual void InitProcess();
- void DefineStartStopCoord(double* dstart, double* dstop);
- virtual int Process();
+ //! Set the field type (0 electric field, 1 magnetic field)
+ void SetFieldType(int type);
+
+ virtual int GetNumberOfIntegrals() const {return 3;}
+ virtual double* CalcMultipleIntegrals();
+
+protected:
+ int m_ModeFieldType;
};
-#endif // PROCESS_HFIELD_H
+#endif // PROCESSFIELDPROBE_H
diff --git a/openEMS.pro b/openEMS.pro
index 24a64e7..2123466 100644
--- a/openEMS.pro
+++ b/openEMS.pro
@@ -64,8 +64,7 @@ SOURCES += main.cpp \
FDTD/excitation.cpp \
FDTD/operator_cylindermultigrid.cpp \
FDTD/engine_cylindermultigrid.cpp \
- FDTD/engine_interface_fdtd.cpp \
- Common/processfields_fd.cpp
+ FDTD/engine_interface_fdtd.cpp
# FDTD/extensions source files
SOURCES += FDTD/extensions/engine_extension.cpp \
@@ -89,13 +88,13 @@ SOURCES += Common/operator_base.cpp \
Common/engine_interface_base.cpp \
Common/processmodematch.cpp \
Common/processvoltage.cpp \
- Common/process_efield.cpp \
- Common/process_hfield.cpp \
Common/processing.cpp \
Common/processintegral.cpp \
Common/processfields.cpp \
Common/processfields_td.cpp \
- Common/processcurrent.cpp
+ Common/processcurrent.cpp \
+ Common/processfields_fd.cpp \
+ Common/processfieldprobe.cpp
HEADERS += tools/ErrorMsg.h \
tools/AdrOp.h \
@@ -117,8 +116,7 @@ HEADERS += tools/ErrorMsg.h \
FDTD/operator_cylindermultigrid.h \
FDTD/engine_cylindermultigrid.h \
tools/aligned_allocator.h \
- FDTD/engine_interface_fdtd.h \
- Common/processfields_fd.h
+ FDTD/engine_interface_fdtd.h
# FDTD/extensions header files
HEADERS += FDTD/operator_extension.h \
@@ -141,14 +139,14 @@ HEADERS += FDTD/operator_extension.h \
HEADERS += Common/operator_base.h \
Common/engine_interface_base.h \
Common/processvoltage.h \
- Common/process_efield.h \
- Common/process_hfield.h \
Common/processing.h \
Common/processintegral.h \
Common/processfields.h \
Common/processfields_td.h \
Common/processcurrent.h \
- Common/processmodematch.h
+ Common/processmodematch.h \
+ Common/processfields_fd.h \
+ Common/processfieldprobe.h
QMAKE_CXXFLAGS_RELEASE = -O3 \
-g \
diff --git a/openems.cpp b/openems.cpp
index 7eb6551..41d12d8 100644
--- a/openems.cpp
+++ b/openems.cpp
@@ -29,8 +29,7 @@
#include "FDTD/engine_interface_fdtd.h"
#include "Common/processvoltage.h"
#include "Common/processcurrent.h"
-#include "Common/process_efield.h"
-#include "Common/process_hfield.h"
+#include "Common/processfieldprobe.h"
#include "Common/processmodematch.h"
#include "Common/processfields_td.h"
#include "Common/processfields_fd.h"
@@ -313,9 +312,9 @@ bool openEMS::SetupProcessing(ContinuousStructure& CSX)
proc=procCurr;
}
else if (pb->GetProbeType()==2)
- proc = new ProcessEField(new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng),FDTD_Eng);
+ proc = new ProcessFieldProbe(new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng),0);
else if (pb->GetProbeType()==3)
- proc = new ProcessHField(new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng),FDTD_Eng);
+ proc = new ProcessFieldProbe(new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng),1);
else if ((pb->GetProbeType()==10) || (pb->GetProbeType()==11))
{
ProcessModeMatch* pmm = new ProcessModeMatch(new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng));