processing: new type name and header dump in integral processing
- new type name for each processing class (used in some file descriptions) - new integral name in ProcessIntegral for every result row --> used in file header Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
parent
c0c66518c1
commit
dff20e51cd
@ -29,6 +29,17 @@ 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);
|
||||
|
@ -32,6 +32,10 @@ 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<double_complex> value[3], double factor, string filename);
|
||||
|
@ -27,6 +27,17 @@ 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);
|
||||
|
@ -31,6 +31,10 @@ public:
|
||||
ProcessHField(Engine_Interface_Base* eng_if, Engine* eng);
|
||||
virtual ~ProcessHField();
|
||||
|
||||
virtual string GetProcessingName() const {return "magnetic field probe";}
|
||||
|
||||
virtual string GetIntegralName(int row) const;
|
||||
|
||||
virtual void InitProcess();
|
||||
void DefineStartStopCoord(double* dstart, double* dstop);
|
||||
virtual int Process();
|
||||
|
@ -28,6 +28,13 @@ ProcessCurrent::~ProcessCurrent()
|
||||
{
|
||||
}
|
||||
|
||||
string ProcessCurrent::GetIntegralName(int row) const
|
||||
{
|
||||
if (row==0)
|
||||
return "current";
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
double ProcessCurrent::CalcIntegral()
|
||||
{
|
||||
FDTD_FLOAT current=0;
|
||||
|
@ -26,6 +26,10 @@ public:
|
||||
ProcessCurrent(Engine_Interface_Base* eng_if);
|
||||
virtual ~ProcessCurrent();
|
||||
|
||||
virtual string GetProcessingName() const {return "current integration";}
|
||||
|
||||
virtual string GetIntegralName(int row) const;
|
||||
|
||||
//! Integrate currents flowing through an area
|
||||
virtual double CalcIntegral();
|
||||
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
*/
|
||||
enum DumpType { E_FIELD_DUMP, H_FIELD_DUMP, J_FIELD_DUMP, ROTH_FIELD_DUMP};
|
||||
|
||||
virtual string GetProcessingName() const {return "common field processing";}
|
||||
|
||||
virtual void InitProcess();
|
||||
|
||||
virtual void DefineStartStopCoord(double* dstart, double* dstop);
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
ProcessFieldsFD(Engine_Interface_Base* eng_if);
|
||||
virtual ~ProcessFieldsFD();
|
||||
|
||||
virtual string GetProcessingName() const {return "frequency domain field dump";}
|
||||
|
||||
virtual void InitProcess();
|
||||
|
||||
virtual int Process();
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
ProcessFieldsTD(Engine_Interface_Base* eng_if);
|
||||
virtual ~ProcessFieldsTD();
|
||||
|
||||
virtual string GetProcessingName() const {return "time domain field dump";}
|
||||
|
||||
virtual void InitProcess();
|
||||
|
||||
virtual int Process();
|
||||
|
@ -40,7 +40,6 @@ using namespace std;
|
||||
class Processing
|
||||
{
|
||||
public:
|
||||
Processing(Engine_Interface_Base* eng_if);
|
||||
virtual ~Processing();
|
||||
|
||||
enum MeshType { CARTESIAN_MESH, CYLINDRICAL_MESH};
|
||||
@ -50,6 +49,9 @@ public:
|
||||
|
||||
virtual void SetName(string val) {m_Name=val;}
|
||||
|
||||
//! Get the name for this processing, will be used in file description.
|
||||
virtual string GetProcessingName() const = 0;
|
||||
|
||||
virtual void InitProcess() {};
|
||||
virtual void Reset();
|
||||
|
||||
@ -101,6 +103,7 @@ public:
|
||||
virtual void SetDualTime(bool val) {m_dualTime=val;}
|
||||
|
||||
protected:
|
||||
Processing(Engine_Interface_Base* eng_if);
|
||||
Engine_Interface_Base* m_Eng_Interface;
|
||||
const Operator_Base* Op;
|
||||
MeshType m_Mesh_Type;
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "processintegral.h"
|
||||
#include "Common/operator_base.h"
|
||||
#include "time.h"
|
||||
#include <iomanip>
|
||||
|
||||
@ -44,6 +45,25 @@ void ProcessIntegral::InitProcess()
|
||||
m_filename = m_Name;
|
||||
OpenFile(m_filename);
|
||||
|
||||
//write header
|
||||
time_t rawTime;
|
||||
time(&rawTime);
|
||||
file << "% time-domain " << GetProcessingName() << " by openEMS " << GIT_VERSION << " @" << ctime(&rawTime);
|
||||
file << "% start-coordinates: ("
|
||||
<< 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 << "% stop-coordinates: ("
|
||||
<< Op->GetDiscLine(0,stop[0])*Op->GetGridDelta() << ","
|
||||
<< Op->GetDiscLine(1,stop[1])*Op->GetGridDelta() << ","
|
||||
<< Op->GetDiscLine(2,stop[2])*Op->GetGridDelta() << ") m -> [" << stop[0] << "," << stop[1] << "," << stop[2] << "]" << endl;
|
||||
file << "% t/s";
|
||||
for (int n=0;n<GetNumberOfIntegrals();++n)
|
||||
{
|
||||
file << "\t" << GetIntegralName(n);
|
||||
}
|
||||
file << endl;
|
||||
|
||||
for (int i=0;i<GetNumberOfIntegrals();++i)
|
||||
{
|
||||
for (size_t n=0; n<m_FD_Samples.size(); ++n)
|
||||
@ -68,12 +88,28 @@ void ProcessIntegral::Dump_FD_Data(double factor, string filename)
|
||||
file.open( filename.c_str() );
|
||||
if (!file.is_open())
|
||||
cerr << "ProcessIntegral::Dump_FD_Data: Error: Can't open file: " << filename << endl;
|
||||
|
||||
//write header
|
||||
time_t rawTime;
|
||||
time(&rawTime);
|
||||
file << "%dump by openEMS @" << ctime(&rawTime) << "%frequency";
|
||||
file << "% frequency-domain " << GetProcessingName() << " by openEMS " << GIT_VERSION << " @" << ctime(&rawTime);
|
||||
file << "% start-coordinates: ("
|
||||
<< 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 << "% stop-coordinates: ("
|
||||
<< Op->GetDiscLine(0,stop[0])*Op->GetGridDelta() << ","
|
||||
<< Op->GetDiscLine(1,stop[1])*Op->GetGridDelta() << ","
|
||||
<< Op->GetDiscLine(2,stop[2])*Op->GetGridDelta() << ") m -> [" << stop[0] << "," << stop[1] << "," << stop[2] << "]" << endl;
|
||||
file << "% f/Hz";
|
||||
for (int n=0;n<GetNumberOfIntegrals();++n)
|
||||
{
|
||||
file << "\t" << GetIntegralName(n) << "\t";
|
||||
}
|
||||
file << endl << "%";
|
||||
for (int i = 0; i < GetNumberOfIntegrals();++i)
|
||||
file << "\treal\timag";
|
||||
file << "\n";
|
||||
file << endl;
|
||||
|
||||
for (size_t n=0; n<m_FD_Samples.size(); ++n)
|
||||
{
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
|
||||
virtual void InitProcess();
|
||||
|
||||
virtual string GetProcessingName() const = 0;
|
||||
|
||||
//! Flush FD data to disk
|
||||
virtual void FlushData();
|
||||
|
||||
@ -41,6 +43,9 @@ public:
|
||||
*/
|
||||
virtual double* CalcMultipleIntegrals();
|
||||
|
||||
//! Get the name of the integral for the given row. The names will be used in the file header.
|
||||
virtual string GetIntegralName(int row) const = 0;
|
||||
|
||||
//! Number of calculated results produced by this integral processing. \sa CalcMultipleIntegrals
|
||||
virtual int GetNumberOfIntegrals() const {return 1;}
|
||||
|
||||
|
@ -41,6 +41,31 @@ ProcessModeMatch::~ProcessModeMatch()
|
||||
Reset();
|
||||
}
|
||||
|
||||
string ProcessModeMatch::GetIntegralName(int row) const
|
||||
{
|
||||
if (row==0)
|
||||
{
|
||||
if (m_ModeFieldType==0)
|
||||
return "voltage";
|
||||
if (m_ModeFieldType==1)
|
||||
return "current";
|
||||
}
|
||||
if (row==1)
|
||||
{
|
||||
return "mode_purity";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
string ProcessModeMatch::GetProcessingName() const
|
||||
{
|
||||
if (m_ModeFieldType==0)
|
||||
return "voltage mode matching";
|
||||
if (m_ModeFieldType==1)
|
||||
return "current mode matching";
|
||||
return "unknown mode matching";
|
||||
}
|
||||
|
||||
void ProcessModeMatch::InitProcess()
|
||||
{
|
||||
if (!Enabled) return;
|
||||
|
@ -33,6 +33,10 @@ public:
|
||||
ProcessModeMatch(Engine_Interface_Base* eng_if);
|
||||
virtual ~ProcessModeMatch();
|
||||
|
||||
virtual string GetProcessingName() const;
|
||||
|
||||
virtual string GetIntegralName(int row) const;
|
||||
|
||||
virtual void InitProcess();
|
||||
virtual void Reset();
|
||||
|
||||
|
@ -26,6 +26,13 @@ ProcessVoltage::~ProcessVoltage()
|
||||
{
|
||||
}
|
||||
|
||||
string ProcessVoltage::GetIntegralName(int row) const
|
||||
{
|
||||
if (row==0)
|
||||
return "voltage";
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
double ProcessVoltage::CalcIntegral()
|
||||
{
|
||||
//integrate voltages from start to stop on a line
|
||||
|
@ -27,6 +27,10 @@ public:
|
||||
ProcessVoltage(Engine_Interface_Base* eng_if);
|
||||
virtual ~ProcessVoltage();
|
||||
|
||||
virtual string GetProcessingName() const {return "voltage integration";}
|
||||
|
||||
virtual string GetIntegralName(int row) const;
|
||||
|
||||
virtual double CalcIntegral();
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user