From b3653f0c0a43fe2e10d5f333e09e71518d1d8a84 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 5 Jan 2011 16:25:50 +0100 Subject: [PATCH] Processing/ ProcessIntegral: fixed FD & multiple results handling --- Common/processing.cpp | 29 ++++--------------- Common/processing.h | 4 +-- Common/processintegral.cpp | 58 ++++++++++++++++++++++++++++++-------- Common/processintegral.h | 4 +-- 4 files changed, 54 insertions(+), 41 deletions(-) diff --git a/Common/processing.cpp b/Common/processing.cpp index 9697990..3460b4f 100644 --- a/Common/processing.cpp +++ b/Common/processing.cpp @@ -185,6 +185,11 @@ void Processing::OpenFile( string outfile ) m_filename = outfile; } +void Processing::PostProcess() +{ + FlushData(); +} + void Processing::DumpBox2File( string vtkfilenameprefix, bool dualMesh ) const { string vtkfilename = vtkfilenameprefix + m_filename + ".vtk"; @@ -252,30 +257,6 @@ void Processing::DumpBox2File( string vtkfilenameprefix, bool dualMesh ) const file.close(); } -void Processing::Dump_FD_Data(vector value, double factor, string filename) -{ - if (value.size()==0) - return; - if (value.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\timag\n"; - for (size_t n=0; n value, double factor, string filename); - //! define if given coords are on main or dualMesh (default is false) bool m_dualMesh; diff --git a/Common/processintegral.cpp b/Common/processintegral.cpp index 52c4510..4fb0a8b 100644 --- a/Common/processintegral.cpp +++ b/Common/processintegral.cpp @@ -21,29 +21,68 @@ ProcessIntegral::ProcessIntegral(Engine_Interface_Base* eng_if) : Processing(eng_if) { m_Results=NULL; + m_FD_Results=NULL; } ProcessIntegral::~ProcessIntegral() { delete[] m_Results; + delete[] m_FD_Results; m_Results = NULL; - ProcessIntegral::FlushData(); + m_FD_Results = NULL; } void ProcessIntegral::InitProcess() { + delete[] m_Results; + delete[] m_FD_Results; + m_Results = new double[GetNumberOfIntegrals()]; + m_FD_Results = new vector[GetNumberOfIntegrals()]; + m_filename = m_Name; OpenFile(m_filename); - FD_Values.clear(); - for (size_t n=0; nGetTime(m_dualTime); if (ProcessInterval) { if (m_Eng_Interface->GetNumberOfTimesteps()%ProcessInterval==0) { - TD_Values.push_back(integral); file << setprecision(m_precision) << time; for (int n=0; nGetNumberOfTimesteps()%m_FD_Interval==0) { - double T = time; for (size_t n=0; n TD_Values; - vector FD_Values; + void Dump_FD_Data(double factor, string filename); + vector *m_FD_Results; double *m_Results; };