added virtual Pre- and PostProcessing methods to Processing-classes

pull/1/head
Thorsten Liebig 2010-12-17 15:13:43 +01:00
parent 79c742ffc7
commit ef65970246
3 changed files with 27 additions and 0 deletions

View File

@ -305,6 +305,11 @@ void ProcessingArray::DeleteAll()
ProcessArray.clear();
}
void ProcessingArray::PreProcess()
{
for (size_t i=0; i<ProcessArray.size(); ++i) ProcessArray.at(i)->PreProcess();
}
int ProcessingArray::Process()
{
int nextProcess=maxInterval;
@ -318,6 +323,11 @@ int ProcessingArray::Process()
return nextProcess;
}
void ProcessingArray::PostProcess()
{
for (size_t i=0; i<ProcessArray.size(); ++i) ProcessArray.at(i)->PostProcess();
}
void ProcessingArray::DumpBoxes2File( string vtkfilenameprefix ) const
{
for (size_t i=0; i<ProcessArray.size(); ++i)

View File

@ -64,8 +64,16 @@ public:
void AddFrequency(vector<double> *freqs);
bool CheckTimestep();
//! Process data prior to the simulation run.
virtual void PreProcess() {};
//! Process data during simulation run.
virtual int Process() {return GetNextInterval();}
//! Process data after simulation has finished.
virtual void PostProcess() {};
//! If disabled, Process() will do nothing...
virtual void SetEnable(bool val) {Enabled=val;}
//! If disabled, Process() will do nothing...
@ -152,8 +160,15 @@ public:
//! Deletes all given processing's, can be helpful, but use carefull!!!
void DeleteAll();
//! Invoke PreProcess() on all Processings.
void PreProcess();
//! Invoke Process() on all Processings. Will return the smallest next iteration interval.
int Process();
//! Invoke PostProcess() on all Processings.
void PostProcess();
void DumpBoxes2File( string vtkfilenameprefix ) const;
protected:

View File

@ -617,6 +617,7 @@ void openEMS::RunFDTD()
//*************** simulate ************//
PA->PreProcess();
int step=PA->Process();
if ((step<0) || (step>(int)NrTS)) step=NrTS;
while ((FDTD_Eng->GetNumberOfTimesteps()<NrTS) && (change>endCrit) && !CheckAbortCond())
@ -654,6 +655,7 @@ void openEMS::RunFDTD()
PA->FlushNext();
}
}
PA->PostProcess();
//*************** postproc ************//
prevTime = currTime;