Processing: some code cleanups & consistencies

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/1/head
Thorsten Liebig 2010-06-28 18:27:41 +02:00
parent 6f06497dab
commit e880fa3ee8
9 changed files with 23 additions and 17 deletions

View File

@ -46,8 +46,10 @@ void ProcessCurrent::DefineStartStopCoord(double* dstart, double* dstop)
}
}
void ProcessCurrent::Init()
void ProcessCurrent::InitProcess()
{
m_filename = m_Name;
OpenFile(m_filename);
FD_currents.clear();
for (size_t n=0;n<m_FD_Samples.size();++n)
FD_currents.push_back(0);

View File

@ -28,7 +28,7 @@ public:
virtual void DefineStartStopCoord(double* dstart, double* dstop);
virtual void Init();
virtual void InitProcess();
virtual void FlushData();
virtual int Process();

View File

@ -77,8 +77,8 @@ void ProcessFields::InitProcess()
else
return;
m_fileName+= ".h5";
H5::H5File* file = new H5::H5File( m_fileName , H5F_ACC_TRUNC );
m_filename+= ".h5";
H5::H5File* file = new H5::H5File( m_filename , H5F_ACC_TRUNC );
H5::Group* group = new H5::Group( file->createGroup( "/Mesh" ));
for (int n=0;n<3;++n)

View File

@ -43,7 +43,7 @@ public:
void SetFilePattern(string fp) {m_filename=filePattern=fp;}
//! Set the filename for a hdf5 data group file (HDF5 FileType only) \sa SetFileType
void SetFileName(string fn) {m_filename=m_fileName=fn;}
void SetFileName(string fn) {m_filename=fn;}
//! Define the Dump-Mode
void SetDumpMode(DumpMode mode) {m_DumpMode=mode;}
@ -87,7 +87,6 @@ protected:
DumpType m_DumpType;
MeshType m_Mesh_Type;
string filePattern;
string m_fileName;
FileType m_fileType;
//! field dump sub-sampling

View File

@ -387,11 +387,11 @@ int ProcessFieldsTD::Process()
else if (m_fileType==HDF5_FILETYPE)
{
if (m_DumpMode==NO_INTERPOLATION)
DumpNoInterpol(m_fileName);
DumpNoInterpol(m_filename);
if (m_DumpMode==NODE_INTERPOLATE)
DumpNodeInterpol(m_fileName);
DumpNodeInterpol(m_filename);
if (m_DumpMode==CELL_INTERPOLATE)
DumpCellInterpol(m_fileName);
DumpCellInterpol(m_filename);
}
return GetNextInterval();
}

View File

@ -31,7 +31,9 @@ public:
Processing(Operator* op, Engine* eng);
virtual ~Processing();
virtual void Init() {};
virtual void SetName(string val) {m_Name=val;}
virtual void InitProcess() {};
virtual void Reset();
virtual void DefineStartStopCoord(double* dstart, double* dstop);
@ -62,8 +64,6 @@ public:
//! Set the dump precision
void SetPrecision(unsigned int val) {m_precision = val;}
virtual void OpenFile( string outfile );
virtual void DumpBox2File( string vtkfilenameprefix, bool dualMesh = false ) const; //!< dump geometry to file
protected:
@ -71,6 +71,8 @@ protected:
Engine* Eng;
unsigned int m_precision;
string m_Name;
bool m_Flush;
double m_weight;
@ -103,6 +105,8 @@ protected:
ofstream file;
string m_filename;
virtual void OpenFile(string outfile);
double CalcLineIntegral(unsigned int* start, unsigned int* stop, int field) const;
double CalcLineIntegral_I(unsigned int* start, unsigned int* stop) const;
double CalcLineIntegral_V(unsigned int* start, unsigned int* stop) const;

View File

@ -28,8 +28,10 @@ ProcessVoltage::~ProcessVoltage()
ProcessVoltage::FlushData();
}
void ProcessVoltage::Init()
void ProcessVoltage::InitProcess()
{
m_filename = m_Name;
OpenFile(m_filename);
FD_voltages.clear();
for (size_t n=0;n<m_FD_Samples.size();++n)
FD_voltages.push_back(0);

View File

@ -27,7 +27,7 @@ public:
ProcessVoltage(Operator* op, Engine* eng);
virtual ~ProcessVoltage();
virtual void Init();
virtual void InitProcess();
virtual void FlushData();
virtual int Process();

View File

@ -315,13 +315,11 @@ int openEMS::SetupFDTD(const char* file)
if (pb->GetProbeType()==0)
{
ProcessVoltage* procVolt = new ProcessVoltage(FDTD_Op,FDTD_Eng);
procVolt->OpenFile(pb->GetName());
proc=procVolt;
}
else if (pb->GetProbeType()==1)
{
ProcessCurrent* procCurr = new ProcessCurrent(FDTD_Op,FDTD_Eng);
procCurr->OpenFile(pb->GetName());
proc=procCurr;
}
else
@ -333,7 +331,8 @@ int openEMS::SetupFDTD(const char* file)
proc->AddFrequency(pb->GetFDSamples());
proc->DefineStartStopCoord(start,stop);
proc->SetWeight(pb->GetWeighting());
proc->Init();
proc->SetName(pb->GetName());
proc->InitProcess();
PA->AddProcessing(proc);
prim->SetPrimitiveUsed(true);
}