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:
parent
6b9320490a
commit
422f17b414
@ -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)
|
||||||
|
@ -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.
|
||||||
|
260
openems.cpp
260
openems.cpp
@ -297,73 +297,82 @@ 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);
|
||||||
if (prim!=NULL)
|
|
||||||
|
for (size_t nb=0; nb<Probes.at(i)->GetQtyPrimitives(); ++nb)
|
||||||
{
|
{
|
||||||
bool acc;
|
CSPrimitives* prim = Probes.at(i)->GetPrimitive(nb);
|
||||||
double bnd[6] = {0,0,0,0,0,0};
|
if (prim!=NULL)
|
||||||
acc = prim->GetBoundBox(bnd,true);
|
|
||||||
start[0]= bnd[0];
|
|
||||||
start[1]=bnd[2];
|
|
||||||
start[2]=bnd[4];
|
|
||||||
stop[0] = bnd[1];
|
|
||||||
stop[1] =bnd[3];
|
|
||||||
stop[2] =bnd[5];
|
|
||||||
CSPropProbeBox* pb = Probes.at(i)->ToProbeBox();
|
|
||||||
Processing* proc = NULL;
|
|
||||||
if (pb)
|
|
||||||
{
|
{
|
||||||
if (pb->GetProbeType()==0)
|
bool acc;
|
||||||
|
double bnd[6] = {0,0,0,0,0,0};
|
||||||
|
acc = prim->GetBoundBox(bnd,true);
|
||||||
|
start[0]= bnd[0];
|
||||||
|
start[1]=bnd[2];
|
||||||
|
start[2]=bnd[4];
|
||||||
|
stop[0] = bnd[1];
|
||||||
|
stop[1] =bnd[3];
|
||||||
|
stop[2] =bnd[5];
|
||||||
|
CSPropProbeBox* pb = Probes.at(i)->ToProbeBox();
|
||||||
|
Processing* proc = NULL;
|
||||||
|
if (pb)
|
||||||
{
|
{
|
||||||
ProcessVoltage* procVolt = new ProcessVoltage(NewEngineInterface());
|
if (pb->GetProbeType()==0)
|
||||||
proc=procVolt;
|
{
|
||||||
}
|
ProcessVoltage* procVolt = new ProcessVoltage(NewEngineInterface());
|
||||||
else if (pb->GetProbeType()==1)
|
proc=procVolt;
|
||||||
{
|
}
|
||||||
ProcessCurrent* procCurr = new ProcessCurrent(NewEngineInterface());
|
else if (pb->GetProbeType()==1)
|
||||||
proc=procCurr;
|
{
|
||||||
}
|
ProcessCurrent* procCurr = new ProcessCurrent(NewEngineInterface());
|
||||||
else if (pb->GetProbeType()==2)
|
proc=procCurr;
|
||||||
proc = new ProcessFieldProbe(NewEngineInterface(),0);
|
}
|
||||||
else if (pb->GetProbeType()==3)
|
else if (pb->GetProbeType()==2)
|
||||||
proc = new ProcessFieldProbe(NewEngineInterface(),1);
|
proc = new ProcessFieldProbe(NewEngineInterface(),0);
|
||||||
else if ((pb->GetProbeType()==10) || (pb->GetProbeType()==11))
|
else if (pb->GetProbeType()==3)
|
||||||
{
|
proc = new ProcessFieldProbe(NewEngineInterface(),1);
|
||||||
ProcessModeMatch* pmm = new ProcessModeMatch(NewEngineInterface());
|
else if ((pb->GetProbeType()==10) || (pb->GetProbeType()==11))
|
||||||
pmm->SetFieldType(pb->GetProbeType()-10);
|
{
|
||||||
pmm->SetModeFunction(0,pb->GetAttributeValue("ModeFunctionX"));
|
ProcessModeMatch* pmm = new ProcessModeMatch(NewEngineInterface());
|
||||||
pmm->SetModeFunction(1,pb->GetAttributeValue("ModeFunctionY"));
|
pmm->SetFieldType(pb->GetProbeType()-10);
|
||||||
pmm->SetModeFunction(2,pb->GetAttributeValue("ModeFunctionZ"));
|
pmm->SetModeFunction(0,pb->GetAttributeValue("ModeFunctionX"));
|
||||||
proc = pmm;
|
pmm->SetModeFunction(1,pb->GetAttributeValue("ModeFunctionY"));
|
||||||
|
pmm->SetModeFunction(2,pb->GetAttributeValue("ModeFunctionZ"));
|
||||||
|
proc = pmm;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cerr << "openEMS::SetupFDTD: Warning: Probe type " << pb->GetProbeType() << " of property '" << pb->GetName() << "' is unknown..." << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (CylinderCoords)
|
||||||
|
proc->SetMeshType(Processing::CYLINDRICAL_MESH);
|
||||||
|
if ((pb->GetProbeType()==1) || (pb->GetProbeType()==3) || (pb->GetProbeType()==11))
|
||||||
|
{
|
||||||
|
proc->SetDualTime(true);
|
||||||
|
proc->SetDualMesh(true);
|
||||||
|
}
|
||||||
|
proc->SetProcessInterval(Nyquist/m_OverSampling);
|
||||||
|
proc->AddFrequency(pb->GetFDSamples());
|
||||||
|
if (l_MultiBox==false)
|
||||||
|
proc->SetName(pb->GetName());
|
||||||
|
else
|
||||||
|
proc->SetName(pb->GetName(),nb);
|
||||||
|
proc->DefineStartStopCoord(start,stop);
|
||||||
|
if (g_settings.showProbeDiscretization())
|
||||||
|
proc->ShowSnappedCoords();
|
||||||
|
proc->SetWeight(pb->GetWeighting());
|
||||||
|
PA->AddProcessing(proc);
|
||||||
|
prim->SetPrimitiveUsed(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
delete proc;
|
||||||
cerr << "openEMS::SetupFDTD: Warning: Probe type " << pb->GetProbeType() << " of property '" << pb->GetName() << "' is unknown..." << endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (CylinderCoords)
|
|
||||||
proc->SetMeshType(Processing::CYLINDRICAL_MESH);
|
|
||||||
if ((pb->GetProbeType()==1) || (pb->GetProbeType()==3) || (pb->GetProbeType()==11))
|
|
||||||
{
|
|
||||||
proc->SetDualTime(true);
|
|
||||||
proc->SetDualMesh(true);
|
|
||||||
}
|
|
||||||
proc->SetProcessInterval(Nyquist/m_OverSampling);
|
|
||||||
proc->AddFrequency(pb->GetFDSamples());
|
|
||||||
proc->SetName(pb->GetName());
|
|
||||||
proc->DefineStartStopCoord(start,stop);
|
|
||||||
if (g_settings.showProbeDiscretization())
|
|
||||||
proc->ShowSnappedCoords();
|
|
||||||
proc->SetWeight(pb->GetWeighting());
|
|
||||||
PA->AddProcessing(proc);
|
|
||||||
prim->SetPrimitiveUsed(true);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
delete proc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,74 +381,85 @@ bool openEMS::SetupProcessing()
|
|||||||
{
|
{
|
||||||
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);
|
||||||
if (prim!=NULL)
|
|
||||||
|
for (size_t nb=0; nb<DumpProps.at(i)->GetQtyPrimitives(); ++nb)
|
||||||
{
|
{
|
||||||
bool acc;
|
|
||||||
double bnd[6] = {0,0,0,0,0,0};
|
CSPrimitives* prim = DumpProps.at(i)->GetPrimitive(nb);
|
||||||
acc = prim->GetBoundBox(bnd,true);
|
if (prim!=NULL)
|
||||||
start[0]= bnd[0];
|
|
||||||
start[1]=bnd[2];
|
|
||||||
start[2]=bnd[4];
|
|
||||||
stop[0] = bnd[1];
|
|
||||||
stop[1] =bnd[3];
|
|
||||||
stop[2] =bnd[5];
|
|
||||||
CSPropDumpBox* db = DumpProps.at(i)->ToDumpBox();
|
|
||||||
if (db)
|
|
||||||
{
|
{
|
||||||
if ((db->GetDumpType()>=0) && (db->GetDumpType()<=3))
|
bool acc;
|
||||||
ProcField = new ProcessFieldsTD(NewEngineInterface());
|
double bnd[6] = {0,0,0,0,0,0};
|
||||||
else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13))
|
acc = prim->GetBoundBox(bnd,true);
|
||||||
ProcField = new ProcessFieldsFD(NewEngineInterface());
|
start[0]= bnd[0];
|
||||||
else if (db->GetDumpType()==20)
|
start[1]=bnd[2];
|
||||||
ProcField = new ProcessFieldsSAR(NewEngineInterface());
|
start[2]=bnd[4];
|
||||||
else
|
stop[0] = bnd[1];
|
||||||
cerr << "openEMS::SetupFDTD: unknown dump box type... skipping!" << endl;
|
stop[1] =bnd[3];
|
||||||
if (ProcField)
|
stop[2] =bnd[5];
|
||||||
|
CSPropDumpBox* db = DumpProps.at(i)->ToDumpBox();
|
||||||
|
if (db)
|
||||||
{
|
{
|
||||||
ProcField->SetEnable(Enable_Dumps);
|
if ((db->GetDumpType()>=0) && (db->GetDumpType()<=3))
|
||||||
ProcField->SetProcessInterval(Nyquist/m_OverSampling);
|
ProcField = new ProcessFieldsTD(NewEngineInterface());
|
||||||
if ((db->GetDumpType()==1) || (db->GetDumpType()==11))
|
else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13))
|
||||||
{
|
ProcField = new ProcessFieldsFD(NewEngineInterface());
|
||||||
ProcField->SetDualTime(true);
|
else if (db->GetDumpType()==20)
|
||||||
//make dualMesh the default mesh for h-field dumps, maybe overwritten by interpolation type (node-interpolation)
|
ProcField = new ProcessFieldsSAR(NewEngineInterface());
|
||||||
ProcField->SetDualMesh(true);
|
|
||||||
}
|
|
||||||
if (db->GetDumpType()>=10)
|
|
||||||
{
|
|
||||||
ProcField->AddFrequency(db->GetFDSamples());
|
|
||||||
ProcField->SetDumpType((ProcessFields::DumpType)(db->GetDumpType()-10));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
ProcField->SetDumpType((ProcessFields::DumpType)db->GetDumpType());
|
cerr << "openEMS::SetupFDTD: unknown dump box type... skipping!" << endl;
|
||||||
|
if (ProcField)
|
||||||
if (db->GetDumpType()==20)
|
|
||||||
{
|
{
|
||||||
ProcField->SetDumpType(ProcessFields::SAR_LOCAL_DUMP);
|
ProcField->SetEnable(Enable_Dumps);
|
||||||
|
ProcField->SetProcessInterval(Nyquist/m_OverSampling);
|
||||||
|
if ((db->GetDumpType()==1) || (db->GetDumpType()==11))
|
||||||
|
{
|
||||||
|
ProcField->SetDualTime(true);
|
||||||
|
//make dualMesh the default mesh for h-field dumps, maybe overwritten by interpolation type (node-interpolation)
|
||||||
|
ProcField->SetDualMesh(true);
|
||||||
|
}
|
||||||
|
if (db->GetDumpType()>=10)
|
||||||
|
{
|
||||||
|
ProcField->AddFrequency(db->GetFDSamples());
|
||||||
|
ProcField->SetDumpType((ProcessFields::DumpType)(db->GetDumpType()-10));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ProcField->SetDumpType((ProcessFields::DumpType)db->GetDumpType());
|
||||||
|
|
||||||
|
if (db->GetDumpType()==20)
|
||||||
|
{
|
||||||
|
ProcField->SetDumpType(ProcessFields::SAR_LOCAL_DUMP);
|
||||||
|
}
|
||||||
|
|
||||||
|
//SetupMaterialStorages() has previewed storage needs... refresh here to prevent cleanup!!!
|
||||||
|
if ( ((db->GetDumpType()==2) || (db->GetDumpType()==12) || (db->GetDumpType()==20)) && Enable_Dumps )
|
||||||
|
FDTD_Op->SetMaterialStoreFlags(1,true);
|
||||||
|
|
||||||
|
ProcField->SetDumpMode((Engine_Interface_Base::InterpolationType)db->GetDumpMode());
|
||||||
|
ProcField->SetFileType((ProcessFields::FileType)db->GetFileType());
|
||||||
|
if (CylinderCoords)
|
||||||
|
ProcField->SetMeshType(Processing::CYLINDRICAL_MESH);
|
||||||
|
if (db->GetSubSampling())
|
||||||
|
for (int n=0; n<3; ++n)
|
||||||
|
ProcField->SetSubSampling(db->GetSubSampling(n),n);
|
||||||
|
if (db->GetOptResolution())
|
||||||
|
for (int n=0; n<3; ++n)
|
||||||
|
ProcField->SetOptResolution(db->GetOptResolution(n),n);
|
||||||
|
|
||||||
|
if (l_MultiBox==false)
|
||||||
|
ProcField->SetName(db->GetName());
|
||||||
|
else
|
||||||
|
ProcField->SetName(db->GetName(),nb);
|
||||||
|
|
||||||
|
ProcField->SetFileName(ProcField->GetName());
|
||||||
|
ProcField->DefineStartStopCoord(start,stop);
|
||||||
|
if (g_settings.showProbeDiscretization())
|
||||||
|
ProcField->ShowSnappedCoords();
|
||||||
|
PA->AddProcessing(ProcField);
|
||||||
|
prim->SetPrimitiveUsed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//SetupMaterialStorages() has previewed storage needs... refresh here to prevent cleanup!!!
|
|
||||||
if ( ((db->GetDumpType()==2) || (db->GetDumpType()==12) || (db->GetDumpType()==20)) && Enable_Dumps )
|
|
||||||
FDTD_Op->SetMaterialStoreFlags(1,true);
|
|
||||||
|
|
||||||
ProcField->SetDumpMode((Engine_Interface_Base::InterpolationType)db->GetDumpMode());
|
|
||||||
ProcField->SetFileType((ProcessFields::FileType)db->GetFileType());
|
|
||||||
if (CylinderCoords)
|
|
||||||
ProcField->SetMeshType(Processing::CYLINDRICAL_MESH);
|
|
||||||
if (db->GetSubSampling())
|
|
||||||
for (int n=0; n<3; ++n)
|
|
||||||
ProcField->SetSubSampling(db->GetSubSampling(n),n);
|
|
||||||
if (db->GetOptResolution())
|
|
||||||
for (int n=0; n<3; ++n)
|
|
||||||
ProcField->SetOptResolution(db->GetOptResolution(n),n);
|
|
||||||
ProcField->SetName(db->GetName());
|
|
||||||
ProcField->SetFileName(db->GetName());
|
|
||||||
ProcField->DefineStartStopCoord(start,stop);
|
|
||||||
if (g_settings.showProbeDiscretization())
|
|
||||||
ProcField->ShowSnappedCoords();
|
|
||||||
PA->AddProcessing(ProcField);
|
|
||||||
prim->SetPrimitiveUsed(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user