allow multiple boxes in Probe and Dump Properties

if more than one box is defined for a probe or dump property,
the name of the probe/dump processing is appended by a "_n"
This commit is contained in:
Thorsten Liebig 2011-08-31 11:05:04 +02:00
parent 6b9320490a
commit 422f17b414
3 changed files with 148 additions and 120 deletions

View File

@ -68,6 +68,13 @@ void Processing::SetEngineInterface(Engine_Interface_Base* eng_if)
Op=NULL; Op=NULL;
} }
void Processing::SetName(string val, int number)
{
stringstream ss;
ss << val << "_" << number;
SetName(ss.str());
}
bool Processing::CheckTimestep() bool Processing::CheckTimestep()
{ {
if (m_ProcessSteps.size()>m_PS_pos) if (m_ProcessSteps.size()>m_PS_pos)

View File

@ -48,6 +48,7 @@ public:
void SetEngineInterface(Engine_Interface_Base* eng_if); void SetEngineInterface(Engine_Interface_Base* eng_if);
virtual void SetName(string val) {m_Name=val;} virtual void SetName(string val) {m_Name=val;}
virtual void SetName(string val, int number);
virtual string GetName() const {return m_Name;} virtual string GetName() const {return m_Name;}
//! Get the name for this processing, will be used in file description. //! Get the name for this processing, will be used in file description.

View File

@ -297,11 +297,16 @@ bool openEMS::SetupProcessing()
double start[3]; double start[3];
double stop[3]; double stop[3];
bool l_MultiBox = false;
vector<CSProperties*> Probes = m_CSX->GetPropertyByType(CSProperties::PROBEBOX); vector<CSProperties*> Probes = m_CSX->GetPropertyByType(CSProperties::PROBEBOX);
for (size_t i=0; i<Probes.size(); ++i) for (size_t i=0; i<Probes.size(); ++i)
{ {
//only looking for one prim atm //check whether one or more probe boxes are defined
CSPrimitives* prim = Probes.at(i)->GetPrimitive(0); l_MultiBox = (Probes.at(i)->GetQtyPrimitives()>1);
for (size_t nb=0; nb<Probes.at(i)->GetQtyPrimitives(); ++nb)
{
CSPrimitives* prim = Probes.at(i)->GetPrimitive(nb);
if (prim!=NULL) if (prim!=NULL)
{ {
bool acc; bool acc;
@ -354,7 +359,10 @@ bool openEMS::SetupProcessing()
} }
proc->SetProcessInterval(Nyquist/m_OverSampling); proc->SetProcessInterval(Nyquist/m_OverSampling);
proc->AddFrequency(pb->GetFDSamples()); proc->AddFrequency(pb->GetFDSamples());
if (l_MultiBox==false)
proc->SetName(pb->GetName()); proc->SetName(pb->GetName());
else
proc->SetName(pb->GetName(),nb);
proc->DefineStartStopCoord(start,stop); proc->DefineStartStopCoord(start,stop);
if (g_settings.showProbeDiscretization()) if (g_settings.showProbeDiscretization())
proc->ShowSnappedCoords(); proc->ShowSnappedCoords();
@ -366,14 +374,20 @@ bool openEMS::SetupProcessing()
delete proc; delete proc;
} }
} }
}
vector<CSProperties*> DumpProps = m_CSX->GetPropertyByType(CSProperties::DUMPBOX); vector<CSProperties*> DumpProps = m_CSX->GetPropertyByType(CSProperties::DUMPBOX);
for (size_t i=0; i<DumpProps.size(); ++i) for (size_t i=0; i<DumpProps.size(); ++i)
{ {
ProcessFields* ProcField=NULL; ProcessFields* ProcField=NULL;
//only looking for one prim atm //check whether one or more probe boxes are defined
CSPrimitives* prim = DumpProps.at(i)->GetPrimitive(0); l_MultiBox = (DumpProps.at(i)->GetQtyPrimitives()>1);
for (size_t nb=0; nb<DumpProps.at(i)->GetQtyPrimitives(); ++nb)
{
CSPrimitives* prim = DumpProps.at(i)->GetPrimitive(nb);
if (prim!=NULL) if (prim!=NULL)
{ {
bool acc; bool acc;
@ -433,8 +447,13 @@ bool openEMS::SetupProcessing()
if (db->GetOptResolution()) if (db->GetOptResolution())
for (int n=0; n<3; ++n) for (int n=0; n<3; ++n)
ProcField->SetOptResolution(db->GetOptResolution(n),n); ProcField->SetOptResolution(db->GetOptResolution(n),n);
if (l_MultiBox==false)
ProcField->SetName(db->GetName()); ProcField->SetName(db->GetName());
ProcField->SetFileName(db->GetName()); else
ProcField->SetName(db->GetName(),nb);
ProcField->SetFileName(ProcField->GetName());
ProcField->DefineStartStopCoord(start,stop); ProcField->DefineStartStopCoord(start,stop);
if (g_settings.showProbeDiscretization()) if (g_settings.showProbeDiscretization())
ProcField->ShowSnappedCoords(); ProcField->ShowSnappedCoords();
@ -444,6 +463,7 @@ bool openEMS::SetupProcessing()
} }
} }
} }
}
return true; return true;
} }