excitation setup speedup

* get all excitation primitives inside a yz-slice only

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
Thorsten Liebig 2020-11-22 19:08:07 +01:00
parent 46827dccb0
commit 9017d91594

View File

@ -135,14 +135,13 @@ bool Operator_Ext_Excitation::BuildExtension()
CSPropExcitation* elec=NULL; CSPropExcitation* elec=NULL;
CSProperties* prop=NULL; CSProperties* prop=NULL;
int priority=0;
unsigned int numLines[] = {m_Op->GetNumberOfLines(0,true),m_Op->GetNumberOfLines(1,true),m_Op->GetNumberOfLines(2,true)}; unsigned int numLines[] = {m_Op->GetNumberOfLines(0,true),m_Op->GetNumberOfLines(1,true),m_Op->GetNumberOfLines(2,true)};
for (pos[2]=0; pos[2]<numLines[2]; ++pos[2]) for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
{ {
for (pos[1]=0; pos[1]<numLines[1]; ++pos[1]) for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
{ {
vector<CSPrimitives*> vPrims = m_Op->GetPrimitivesBoundBox(-1, pos[1], pos[2], CSProperties::EXCITATION);
for (pos[0]=0; pos[0]<numLines[0]; ++pos[0]) for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
{ {
//electric field excite //electric field excite
@ -156,31 +155,28 @@ bool Operator_Ext_Excitation::BuildExtension()
if (m_CC_R0_included && (n==1) && (pos[0]==0)) if (m_CC_R0_included && (n==1) && (pos[0]==0))
continue; continue;
for (size_t p=0; p<vec_prop.size(); ++p) CSProperties* prop = CSX->GetPropertyByCoordPriority(volt_coord, vPrims, true);
if (prop)
{ {
prop = vec_prop.at(p);
elec = prop->ToExcitation(); elec = prop->ToExcitation();
if (elec==NULL) if (elec==NULL)
continue; continue;
if (prop->CheckCoordInPrimitive(volt_coord,priority,true)) if ((elec->GetActiveDir(n)) && ( (elec->GetExcitType()==0) || (elec->GetExcitType()==1) ))//&& (pos[n]<numLines[n]-1))
{ {
if ((elec->GetActiveDir(n)) && ( (elec->GetExcitType()==0) || (elec->GetExcitType()==1) ))//&& (pos[n]<numLines[n]-1)) amp = elec->GetWeightedExcitation(n,volt_coord)*m_Op->GetEdgeLength(n,pos);// delta[n]*gridDelta;
if (amp!=0)
{ {
amp = elec->GetWeightedExcitation(n,volt_coord)*m_Op->GetEdgeLength(n,pos);// delta[n]*gridDelta; volt_vExcit.push_back(amp);
if (amp!=0) volt_vDelay.push_back((unsigned int)(elec->GetDelay()/dT));
{ volt_vDir.push_back(n);
volt_vExcit.push_back(amp); volt_vIndex[0].push_back(pos[0]);
volt_vDelay.push_back((unsigned int)(elec->GetDelay()/dT)); volt_vIndex[1].push_back(pos[1]);
volt_vDir.push_back(n); volt_vIndex[2].push_back(pos[2]);
volt_vIndex[0].push_back(pos[0]); }
volt_vIndex[1].push_back(pos[1]); if (elec->GetExcitType()==1) //hard excite
volt_vIndex[2].push_back(pos[2]); {
} m_Op->SetVV(n,pos[0],pos[1],pos[2], 0 );
if (elec->GetExcitType()==1) //hard excite m_Op->SetVI(n,pos[0],pos[1],pos[2], 0 );
{
m_Op->SetVV(n,pos[0],pos[1],pos[2], 0 );
m_Op->SetVI(n,pos[0],pos[1],pos[2], 0 );
}
} }
} }
} }
@ -193,31 +189,28 @@ bool Operator_Ext_Excitation::BuildExtension()
continue; //skip the last H-Line which is outside the FDTD-domain continue; //skip the last H-Line which is outside the FDTD-domain
if (m_Op->GetYeeCoords(n,pos,curr_coord,true)==false) if (m_Op->GetYeeCoords(n,pos,curr_coord,true)==false)
continue; continue;
for (size_t p=0; p<vec_prop.size(); ++p) CSProperties* prop = CSX->GetPropertyByCoordPriority(curr_coord, vPrims, true);
if (prop)
{ {
prop = vec_prop.at(p);
elec = prop->ToExcitation(); elec = prop->ToExcitation();
if (elec==NULL) if (elec==NULL)
continue; continue;
if (prop->CheckCoordInPrimitive(curr_coord,priority,true)) if ((elec->GetActiveDir(n)) && ( (elec->GetExcitType()==2) || (elec->GetExcitType()==3) ))
{ {
if ((elec->GetActiveDir(n)) && ( (elec->GetExcitType()==2) || (elec->GetExcitType()==3) )) amp = elec->GetWeightedExcitation(n,curr_coord)*m_Op->GetEdgeLength(n,pos,true);// delta[n]*gridDelta;
if (amp!=0)
{ {
amp = elec->GetWeightedExcitation(n,curr_coord)*m_Op->GetEdgeLength(n,pos,true);// delta[n]*gridDelta; curr_vExcit.push_back(amp);
if (amp!=0) curr_vDelay.push_back((unsigned int)(elec->GetDelay()/dT));
{ curr_vDir.push_back(n);
curr_vExcit.push_back(amp); curr_vIndex[0].push_back(pos[0]);
curr_vDelay.push_back((unsigned int)(elec->GetDelay()/dT)); curr_vIndex[1].push_back(pos[1]);
curr_vDir.push_back(n); curr_vIndex[2].push_back(pos[2]);
curr_vIndex[0].push_back(pos[0]); }
curr_vIndex[1].push_back(pos[1]); if (elec->GetExcitType()==3) //hard excite
curr_vIndex[2].push_back(pos[2]); {
} m_Op->SetII(n,pos[0],pos[1],pos[2], 0 );
if (elec->GetExcitType()==3) //hard excite m_Op->SetIV(n,pos[0],pos[1],pos[2], 0 );
{
m_Op->SetII(n,pos[0],pos[1],pos[2], 0 );
m_Op->SetIV(n,pos[0],pos[1],pos[2], 0 );
}
} }
} }
} }