XIAN-FEM-2026June/3D opticsfem-master/material/Material_Interface.cpp

53 lines
1.3 KiB
C++

#include"Material_Base.h"
#include <algorithm>
void MaterialLib::SetNumberMat(int number)
{
if (_mNbrMat > 0)
{
delete[] _mMat;
}
_mNbrMat = number;
_mMat = new Material[number];
}
void MaterialLib::SetMat(int num, string name, int nbrDomain, int* domain, int matType,
complex<double>* epsr, complex<double>* mur, double* sigma, complex<double>* chihe, complex<double>* chieh)
{
_mMat[num].SetName(name);
_mMat[num].SetDomain(nbrDomain, domain);
if (matType == MAT_ISO)
{
_mMat[num].SetEpsr(epsr[0]);
_mMat[num].SetMur(mur[0]);
_mMat[num].SetSimga(sigma[0]);
_mMat[num].SetNK(sqrt(epsr[0]).real(), sqrt(epsr[0]).imag());
_mMat[num].SetChihe(chihe[0], chihe[0], chihe[0]);
_mMat[num].SetChieh(chieh[0], chieh[0], chieh[0]);
}
else if (matType == MAT_DIAG)
{
_mMat[num].SetEpsr(epsr[0], epsr[1], epsr[2]);
_mMat[num].SetMur(mur[0], mur[1], mur[2]);
_mMat[num].SetSimga(sigma[0], sigma[1], sigma[2]);
_mMat[num].SetChihe(chihe[0], chihe[1], chihe[2]);
_mMat[num].SetChieh(chieh[0], chieh[1], chieh[2]);
}
}
void MaterialLib::SetMat(int num, string name, int nbrDomain, int domain[], int matType, double n, double k)
{
_mMat[num].SetName(name);
_mMat[num].SetDomain(nbrDomain, domain);
if (matType == MAT_NEFF)
{
_mMat[num].SetNK(n, k);
}
}
void MaterialLib::GetMat()
{
}