Processing: some code cleanups & consistencies
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/1/head
parent
6f06497dab
commit
e880fa3ee8
|
@ -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();
|
FD_currents.clear();
|
||||||
for (size_t n=0;n<m_FD_Samples.size();++n)
|
for (size_t n=0;n<m_FD_Samples.size();++n)
|
||||||
FD_currents.push_back(0);
|
FD_currents.push_back(0);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
virtual void DefineStartStopCoord(double* dstart, double* dstop);
|
virtual void DefineStartStopCoord(double* dstart, double* dstop);
|
||||||
|
|
||||||
virtual void Init();
|
virtual void InitProcess();
|
||||||
virtual void FlushData();
|
virtual void FlushData();
|
||||||
virtual int Process();
|
virtual int Process();
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,8 @@ void ProcessFields::InitProcess()
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_fileName+= ".h5";
|
m_filename+= ".h5";
|
||||||
H5::H5File* file = new H5::H5File( m_fileName , H5F_ACC_TRUNC );
|
H5::H5File* file = new H5::H5File( m_filename , H5F_ACC_TRUNC );
|
||||||
|
|
||||||
H5::Group* group = new H5::Group( file->createGroup( "/Mesh" ));
|
H5::Group* group = new H5::Group( file->createGroup( "/Mesh" ));
|
||||||
for (int n=0;n<3;++n)
|
for (int n=0;n<3;++n)
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
void SetFilePattern(string fp) {m_filename=filePattern=fp;}
|
void SetFilePattern(string fp) {m_filename=filePattern=fp;}
|
||||||
|
|
||||||
//! Set the filename for a hdf5 data group file (HDF5 FileType only) \sa SetFileType
|
//! 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
|
//! Define the Dump-Mode
|
||||||
void SetDumpMode(DumpMode mode) {m_DumpMode=mode;}
|
void SetDumpMode(DumpMode mode) {m_DumpMode=mode;}
|
||||||
|
@ -87,7 +87,6 @@ protected:
|
||||||
DumpType m_DumpType;
|
DumpType m_DumpType;
|
||||||
MeshType m_Mesh_Type;
|
MeshType m_Mesh_Type;
|
||||||
string filePattern;
|
string filePattern;
|
||||||
string m_fileName;
|
|
||||||
FileType m_fileType;
|
FileType m_fileType;
|
||||||
|
|
||||||
//! field dump sub-sampling
|
//! field dump sub-sampling
|
||||||
|
|
|
@ -387,11 +387,11 @@ int ProcessFieldsTD::Process()
|
||||||
else if (m_fileType==HDF5_FILETYPE)
|
else if (m_fileType==HDF5_FILETYPE)
|
||||||
{
|
{
|
||||||
if (m_DumpMode==NO_INTERPOLATION)
|
if (m_DumpMode==NO_INTERPOLATION)
|
||||||
DumpNoInterpol(m_fileName);
|
DumpNoInterpol(m_filename);
|
||||||
if (m_DumpMode==NODE_INTERPOLATE)
|
if (m_DumpMode==NODE_INTERPOLATE)
|
||||||
DumpNodeInterpol(m_fileName);
|
DumpNodeInterpol(m_filename);
|
||||||
if (m_DumpMode==CELL_INTERPOLATE)
|
if (m_DumpMode==CELL_INTERPOLATE)
|
||||||
DumpCellInterpol(m_fileName);
|
DumpCellInterpol(m_filename);
|
||||||
}
|
}
|
||||||
return GetNextInterval();
|
return GetNextInterval();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,9 @@ public:
|
||||||
Processing(Operator* op, Engine* eng);
|
Processing(Operator* op, Engine* eng);
|
||||||
virtual ~Processing();
|
virtual ~Processing();
|
||||||
|
|
||||||
virtual void Init() {};
|
virtual void SetName(string val) {m_Name=val;}
|
||||||
|
|
||||||
|
virtual void InitProcess() {};
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
virtual void DefineStartStopCoord(double* dstart, double* dstop);
|
virtual void DefineStartStopCoord(double* dstart, double* dstop);
|
||||||
|
@ -62,8 +64,6 @@ public:
|
||||||
//! Set the dump precision
|
//! Set the dump precision
|
||||||
void SetPrecision(unsigned int val) {m_precision = val;}
|
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
|
virtual void DumpBox2File( string vtkfilenameprefix, bool dualMesh = false ) const; //!< dump geometry to file
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -71,6 +71,8 @@ protected:
|
||||||
Engine* Eng;
|
Engine* Eng;
|
||||||
unsigned int m_precision;
|
unsigned int m_precision;
|
||||||
|
|
||||||
|
string m_Name;
|
||||||
|
|
||||||
bool m_Flush;
|
bool m_Flush;
|
||||||
|
|
||||||
double m_weight;
|
double m_weight;
|
||||||
|
@ -103,6 +105,8 @@ protected:
|
||||||
ofstream file;
|
ofstream file;
|
||||||
string m_filename;
|
string m_filename;
|
||||||
|
|
||||||
|
virtual void OpenFile(string outfile);
|
||||||
|
|
||||||
double CalcLineIntegral(unsigned int* start, unsigned int* stop, int field) const;
|
double CalcLineIntegral(unsigned int* start, unsigned int* stop, int field) const;
|
||||||
double CalcLineIntegral_I(unsigned int* start, unsigned int* stop) const;
|
double CalcLineIntegral_I(unsigned int* start, unsigned int* stop) const;
|
||||||
double CalcLineIntegral_V(unsigned int* start, unsigned int* stop) const;
|
double CalcLineIntegral_V(unsigned int* start, unsigned int* stop) const;
|
||||||
|
|
|
@ -28,8 +28,10 @@ ProcessVoltage::~ProcessVoltage()
|
||||||
ProcessVoltage::FlushData();
|
ProcessVoltage::FlushData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessVoltage::Init()
|
void ProcessVoltage::InitProcess()
|
||||||
{
|
{
|
||||||
|
m_filename = m_Name;
|
||||||
|
OpenFile(m_filename);
|
||||||
FD_voltages.clear();
|
FD_voltages.clear();
|
||||||
for (size_t n=0;n<m_FD_Samples.size();++n)
|
for (size_t n=0;n<m_FD_Samples.size();++n)
|
||||||
FD_voltages.push_back(0);
|
FD_voltages.push_back(0);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
ProcessVoltage(Operator* op, Engine* eng);
|
ProcessVoltage(Operator* op, Engine* eng);
|
||||||
virtual ~ProcessVoltage();
|
virtual ~ProcessVoltage();
|
||||||
|
|
||||||
virtual void Init();
|
virtual void InitProcess();
|
||||||
virtual void FlushData();
|
virtual void FlushData();
|
||||||
|
|
||||||
virtual int Process();
|
virtual int Process();
|
||||||
|
|
|
@ -315,13 +315,11 @@ int openEMS::SetupFDTD(const char* file)
|
||||||
if (pb->GetProbeType()==0)
|
if (pb->GetProbeType()==0)
|
||||||
{
|
{
|
||||||
ProcessVoltage* procVolt = new ProcessVoltage(FDTD_Op,FDTD_Eng);
|
ProcessVoltage* procVolt = new ProcessVoltage(FDTD_Op,FDTD_Eng);
|
||||||
procVolt->OpenFile(pb->GetName());
|
|
||||||
proc=procVolt;
|
proc=procVolt;
|
||||||
}
|
}
|
||||||
else if (pb->GetProbeType()==1)
|
else if (pb->GetProbeType()==1)
|
||||||
{
|
{
|
||||||
ProcessCurrent* procCurr = new ProcessCurrent(FDTD_Op,FDTD_Eng);
|
ProcessCurrent* procCurr = new ProcessCurrent(FDTD_Op,FDTD_Eng);
|
||||||
procCurr->OpenFile(pb->GetName());
|
|
||||||
proc=procCurr;
|
proc=procCurr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -333,7 +331,8 @@ int openEMS::SetupFDTD(const char* file)
|
||||||
proc->AddFrequency(pb->GetFDSamples());
|
proc->AddFrequency(pb->GetFDSamples());
|
||||||
proc->DefineStartStopCoord(start,stop);
|
proc->DefineStartStopCoord(start,stop);
|
||||||
proc->SetWeight(pb->GetWeighting());
|
proc->SetWeight(pb->GetWeighting());
|
||||||
proc->Init();
|
proc->SetName(pb->GetName());
|
||||||
|
proc->InitProcess();
|
||||||
PA->AddProcessing(proc);
|
PA->AddProcessing(proc);
|
||||||
prim->SetPrimitiveUsed(true);
|
prim->SetPrimitiveUsed(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue