core: fix probe handling

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
Thorsten Liebig 2021-08-25 19:05:38 +02:00
parent bad842a710
commit 0e54fbf7ac

View File

@ -50,6 +50,7 @@
#include "tinyxml.h"
#include "ContinuousStructure.h"
#include "CSPropProbeBox.h"
#include "CSPrimBox.h"
#include "CSPropDumpBox.h"
using namespace std;
@ -368,12 +369,15 @@ bool openEMS::SetupProcessing()
vector<CSProperties*> Probes = m_CSX->GetPropertyByType(CSProperties::PROBEBOX);
for (size_t i=0; i<Probes.size(); ++i)
{
CSPropProbeBox* pb = Probes.at(i)->ToProbeBox();
if (!pb)
continue;
//check whether one or more probe boxes are defined
l_MultiBox = (Probes.at(i)->GetQtyPrimitives()>1);
l_MultiBox = (pb->GetQtyPrimitives()>1);
for (size_t nb=0; nb<Probes.at(i)->GetQtyPrimitives(); ++nb)
for (size_t nb=0; nb<pb->GetQtyPrimitives(); ++nb)
{
CSPrimitives* prim = Probes.at(i)->GetPrimitive(nb);
CSPrimitives* prim = pb->GetPrimitive(nb);
if (prim!=NULL)
{
double bnd[6] = {0,0,0,0,0,0};
@ -384,12 +388,22 @@ bool openEMS::SetupProcessing()
stop[0] = bnd[1];
stop[1] =bnd[3];
stop[2] =bnd[5];
CSPropProbeBox* pb = Probes.at(i)->ToProbeBox();
ProcessIntegral* proc = NULL;
if (pb)
{
if (pb->GetProbeType()==0)
{
CSPrimBox* box = prim->ToBox();
if (!(box) or box->GetDimension()!=1)
{
cerr << "openEMS::SetupProcessing: Error: Probe primitive type or dimension not suitable ... skipping probe " << pb->GetName() << endl;
continue;
}
// use the direction and coordinates of the box
for (int n=0;n<3;++n)
{
start[n] = box->GetCoord(2*n);
stop[n] = box->GetCoord(2*n+1);
}
ProcessVoltage* procVolt = new ProcessVoltage(NewEngineInterface());
proc=procVolt;
}
@ -441,9 +455,6 @@ bool openEMS::SetupProcessing()
PA->AddProcessing(proc);
prim->SetPrimitiveUsed(true);
}
else
delete proc;
}
}
}