void Operator::CalcPEC_Curves() { //special treatment for primitives of type curve (treated as wires) double p1[3]; double p2[3]; struct Grid_Path path; vector<CSProperties*> vec_prop = CSX->GetPropertyByType(CSProperties::METAL); for (size_t p=0; p<vec_prop.size(); ++p) { CSProperties* prop = vec_prop.at(p); for (size_t n=0; n<prop->GetQtyPrimitives(); ++n) { CSPrimitives* prim = prop->GetPrimitive(n); CSPrimCurve* curv = prim->ToCurve(); if (curv) { for (size_t i=1; i<curv->GetNumberOfPoints(); ++i) { curv->GetPoint(i-1,p1); curv->GetPoint(i,p2); path = FindPath(p1,p2); if (path.dir.size()>0) prim->SetPrimitiveUsed(true); for (size_t t=0; t<path.dir.size(); ++t) { SetVV(path.dir.at(t),path.posPath[0].at(t),path.posPath[1].at(t),path.posPath[2].at(t), 0 ); SetVI(path.dir.at(t),path.posPath[0].at(t),path.posPath[1].at(t),path.posPath[2].at(t), 0 ); ++m_Nr_PEC[path.dir.at(t)]; } } } } } }
bool openEMS::SetupProcessing() { //*************** setup processing ************// if (g_settings.GetVerboseLevel()>0) cout << "Setting up processing..." << endl; unsigned int Nyquist = FDTD_Op->GetExcitationSignal()->GetNyquistNum(); PA = new ProcessingArray(Nyquist); double start[3]; double stop[3]; bool l_MultiBox = false; vector<CSProperties*> Probes = m_CSX->GetPropertyByType(CSProperties::PROBEBOX); for (size_t i=0; i<Probes.size(); ++i) { //check whether one or more probe boxes are defined 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) { double bnd[6] = {0,0,0,0,0,0}; 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(); ProcessIntegral* proc = NULL; if (pb) { if (pb->GetProbeType()==0) { ProcessVoltage* procVolt = new ProcessVoltage(NewEngineInterface()); proc=procVolt; } else if (pb->GetProbeType()==1) { ProcessCurrent* procCurr = new ProcessCurrent(NewEngineInterface()); proc=procCurr; } else if (pb->GetProbeType()==2) proc = new ProcessFieldProbe(NewEngineInterface(),0); else if (pb->GetProbeType()==3) proc = new ProcessFieldProbe(NewEngineInterface(),1); else if ((pb->GetProbeType()==10) || (pb->GetProbeType()==11)) { ProcessModeMatch* pmm = new ProcessModeMatch(NewEngineInterface()); pmm->SetFieldType(pb->GetProbeType()-10); pmm->SetModeFunction(0,pb->GetAttributeValue("ModeFunctionX")); 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); if (pb->GetStartTime()>0 || pb->GetStopTime()>0) proc->SetProcessStartStopTime(pb->GetStartTime(), pb->GetStopTime()); proc->AddFrequency(pb->GetFDSamples()); proc->GetNormalDir(pb->GetNormalDir()); 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 delete proc; } } } vector<CSProperties*> DumpProps = m_CSX->GetPropertyByType(CSProperties::DUMPBOX); for (size_t i=0; i<DumpProps.size(); ++i) { ProcessFields* ProcField=NULL; //check whether one or more probe boxes are defined 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) { double bnd[6] = {0,0,0,0,0,0}; 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]; CSPropDumpBox* db = DumpProps.at(i)->ToDumpBox(); if (db) { if ((db->GetDumpType()>=0) && (db->GetDumpType()<=3)) ProcField = new ProcessFieldsTD(NewEngineInterface(db->GetMultiGridLevel())); else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13)) ProcField = new ProcessFieldsFD(NewEngineInterface(db->GetMultiGridLevel())); else if ( ((db->GetDumpType()>=20) && (db->GetDumpType()<=22)) || (db->GetDumpType()==29) ) { ProcessFieldsSAR* procSAR = new ProcessFieldsSAR(NewEngineInterface(db->GetMultiGridLevel())); ProcField = procSAR; string method = db->GetAttributeValue("SAR_Method"); if (!method.empty()) procSAR->SetSARAveragingMethod(method); // use (center)-cell based conductivity only procSAR->SetUseCellConductivity(true); } else cerr << "openEMS::SetupFDTD: unknown dump box type... skipping!" << endl; if (ProcField) { ProcField->SetEnable(Enable_Dumps); ProcField->SetProcessInterval(Nyquist/m_OverSampling); if (db->GetStopTime()>0 || db->GetStartTime()>0) ProcField->SetProcessStartStopTime(db->GetStartTime(), db->GetStopTime()); 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); if (db->GetDumpType()==21) ProcField->SetDumpType(ProcessFields::SAR_1G_DUMP); if (db->GetDumpType()==22) ProcField->SetDumpType(ProcessFields::SAR_10G_DUMP); if (db->GetDumpType()==29) ProcField->SetDumpType(ProcessFields::SAR_RAW_DATA); //SetupMaterialStorages() has previewed storage needs... refresh here to prevent cleanup!!! if ( ProcField->NeedConductivity() && 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); } } } } } return true; }