コード例 #1
0
ファイル: operator.cpp プロジェクト: ho-y/openEMS
void Operator::CalcPEC_Range(unsigned int startX, unsigned int stopX, unsigned int* counter)
{
	double coord[3];
	unsigned int pos[3];
	for (pos[0]=startX; pos[0]<=stopX; ++pos[0])
	{
		for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
		{
			for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
			{
				for (int n=0; n<3; ++n)
				{
					GetYeeCoords(n,pos,coord,false);
					CSProperties* prop = CSX->GetPropertyByCoordPriority(coord, (CSProperties::PropertyType)(CSProperties::MATERIAL | CSProperties::METAL), true);
					if (prop)
					{
						if (prop->GetType()==CSProperties::METAL) //set to PEC
						{
							SetVV(n,pos[0],pos[1],pos[2], 0 );
							SetVI(n,pos[0],pos[1],pos[2], 0 );
							++counter[n];
						}
					}
				}
			}
		}
	}
}
コード例 #2
0
bool Operator_Ext_Cylinder::BuildExtension()
{
	delete[] vv_R0;
	vv_R0=NULL;
	delete[] vi_R0;
	vi_R0=NULL;

	//if r=0 is not included -> obviously no special treatment for r=0
	//if alpha direction is not closed, PEC-BC at r=0 necessary and already set...
	if (CC_R0_included==false)
		return true;

	vv_R0 = new FDTD_FLOAT[m_Op->GetNumberOfLines(2,true)];
	vi_R0 = new FDTD_FLOAT[m_Op->GetNumberOfLines(2,true)];

	unsigned int pos[3];
	double coord[3];
	double inEC[4];
	double dT = m_Op->GetTimestep();
	pos[0]=0;
	vector<CSPrimitives*> vPrims_metal = m_Op->GetPrimitivesBoundBox(pos[0], -1, -1, (CSProperties::PropertyType)(CSProperties::MATERIAL | CSProperties::METAL));
	for (pos[2]=0; pos[2]<m_Op->GetNumberOfLines(2,true); ++pos[2])
	{
		double C=0;
		double G=0;
		vector<CSPrimitives*> vPrims_mat   = m_Op->GetPrimitivesBoundBox(pos[0], -1, pos[2], CSProperties::MATERIAL);
		for (pos[1]=0; pos[1]<m_Op->GetNumberOfLines(1,true)-2; ++pos[1])
		{
			m_Op_Cyl->Calc_ECPos(2,pos,inEC,vPrims_mat);
			C+=inEC[0];
			G+=inEC[1];
		}
		m_Op->SetVV(2,0,0,pos[2], 1);
		vv_R0[pos[2]] = (1-dT*G/2/C)/(1+dT*G/2/C);
		vi_R0[pos[2]] = (dT/C)/(1+dT*G/2/C);

		for (unsigned int i=0; i<m_Op->GetNumberOfLines(1,true); ++i)
		{
			m_Op->EC_C[2][m_Op->MainOp->SetPos(0,i,pos[2])] = C;
			m_Op->EC_G[2][m_Op->MainOp->SetPos(0,i,pos[2])] = G;
		}

		//search for metal on z-axis
		m_Op_Cyl->GetYeeCoords(2,pos,coord,false);
		CSProperties* prop = m_Op->CSX->GetPropertyByCoordPriority(coord, vPrims_metal, true);
		if (prop)
		{
			if (prop->GetType()==CSProperties::METAL) //set to PEC
			{
				m_Op->SetVV(2,0,0,pos[2], 0);
				vv_R0[pos[2]] = 0;
				vi_R0[pos[2]] = 0;
				m_Op->EC_C[2][m_Op->MainOp->SetPos(0,0,pos[2])] = 0;
				m_Op->EC_G[2][m_Op->MainOp->SetPos(0,0,pos[2])] = 0;
			}
		}
	}
	return true;
}