diff --git a/FDTD/process_efield.cpp b/FDTD/process_efield.cpp
new file mode 100644
index 0000000..fa27bd9
--- /dev/null
+++ b/FDTD/process_efield.cpp
@@ -0,0 +1,119 @@
+/*
+* 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
+#include "process_efield.h"
+
+ProcessEField::ProcessEField(Operator* op, Engine* eng) : Processing(op, eng)
+{
+}
+
+ProcessEField::~ProcessEField()
+{
+ FlushData();
+}
+
+void ProcessEField::InitProcess()
+{
+ OpenFile(m_Name);
+ for (int n=0; n<3; n++)
+ FD_Values[n].assign(m_FD_Samples.size(),0);
+}
+
+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->GetMeshDelta(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->GetMeshDelta(pol,start);
+ field *= m_weight;
+ for (size_t n=0;n.
+*/
+
+#ifndef PROCESS_EFIELD_H
+#define PROCESS_EFIELD_H
+
+#include "processing.h"
+
+typedef _Complex double complexdouble;
+
+/*! \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(Operator* op, Engine* eng);
+ virtual ~ProcessEField();
+
+ virtual void InitProcess();
+ virtual void FlushData();
+ void Dump_FD_Data(vector value[3], double factor, string filename);
+ virtual int Process();
+
+protected:
+ vector FD_Values[3];
+};
+
+#endif // PROCESS_EFIELD_H
diff --git a/FDTD/processing.cpp b/FDTD/processing.cpp
index ee7bbb5..7dd76a7 100644
--- a/FDTD/processing.cpp
+++ b/FDTD/processing.cpp
@@ -146,7 +146,7 @@ void Processing::DefineStartStopCoord(double* dstart, double* dstop)
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 ) << ","
+ cerr << m_Name << ": 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 ) << ")";
diff --git a/FDTD/processing.h b/FDTD/processing.h
index cd3a48d..3b721e3 100644
--- a/FDTD/processing.h
+++ b/FDTD/processing.h
@@ -20,7 +20,6 @@
#include
#include
-#include
#include
#include "operator.h"
#include "engine.h"
diff --git a/openEMS.pro b/openEMS.pro
index 32f7ba3..5d1a2de 100644
--- a/openEMS.pro
+++ b/openEMS.pro
@@ -51,7 +51,8 @@ SOURCES += main.cpp \
FDTD/operator.cpp \
tools/array_ops.cpp \
FDTD/processvoltage.cpp \
- FDTD/processing.cpp \
+ FDTD/process_efield.cpp \
+ FDTD/processing.cpp \
FDTD/processintegral.cpp \
FDTD/processfields.cpp \
FDTD/processfields_td.cpp \
@@ -84,7 +85,8 @@ HEADERS += tools/ErrorMsg.h \
FDTD/operator.h \
tools/array_ops.h \
FDTD/processvoltage.h \
- FDTD/processing.h \
+ FDTD/process_efield.h \
+ FDTD/processing.h \
FDTD/processintegral.h \
FDTD/processfields.h \
FDTD/processfields_td.h \
diff --git a/openems.cpp b/openems.cpp
index 1195116..a612bed 100644
--- a/openems.cpp
+++ b/openems.cpp
@@ -24,6 +24,7 @@
#include "FDTD/operator_ext_mur_abc.h"
#include "FDTD/processvoltage.h"
#include "FDTD/processcurrent.h"
+#include "FDTD/process_efield.h"
#include "FDTD/processfields_td.h"
#include
#include
@@ -338,6 +339,10 @@ int openEMS::SetupFDTD(const char* file)
ProcessCurrent* procCurr = new ProcessCurrent(FDTD_Op,FDTD_Eng);
proc=procCurr;
}
+ else if (pb->GetProbeType()==2)
+ proc = new ProcessEField(FDTD_Op,FDTD_Eng);
+// else if (pb->GetProbeType()==3)
+// proc = new ProcessHField(FDTD_Op,FDTD_Eng);
else
{
cerr << "openEMS::SetupFDTD: Warning: Probe type " << pb->GetProbeType() << " of property '" << pb->GetName() << "' is unknown..." << endl;
@@ -345,9 +350,9 @@ int openEMS::SetupFDTD(const char* file)
}
proc->SetProcessInterval(Nyquist/m_OverSampling);
proc->AddFrequency(pb->GetFDSamples());
+ proc->SetName(pb->GetName());
proc->DefineStartStopCoord(start,stop);
proc->SetWeight(pb->GetWeighting());
- proc->SetName(pb->GetName());
proc->InitProcess();
PA->AddProcessing(proc);
prim->SetPrimitiveUsed(true);