openEMS/FDTD/processvoltage.cpp

34 lines
710 B
C++
Raw Normal View History

#include "processvoltage.h"
ProcessVoltage::ProcessVoltage(Operator* op, Engine* eng) : Processing(op, eng)
{
}
ProcessVoltage::~ProcessVoltage()
{
file.close();
}
void ProcessVoltage::OpenFile(string outfile)
{
if (file.is_open()) file.close();
file.open(outfile.c_str());
if (file.is_open()==false)
{
cerr << "Can't open file: " << outfile << endl;
return;
}
}
int ProcessVoltage::Process()
{
if (Enabled==false) return -1;
if (CheckTimestep()==false) return GetNextInterval();
2010-03-11 09:48:00 +00:00
FDTD_FLOAT voltage=CalcLineIntegral(start,stop,0);
// cerr << voltage << endl;
voltages.push_back(voltage);
2010-03-01 19:50:42 +00:00
file << (double)Eng->numTS*Op->GetTimestep() << "\t" << voltage << endl;
return GetNextInterval();
}