diff --git a/FDTD/cartoperator.cpp b/FDTD/cartoperator.cpp index e361323..3cde987 100644 --- a/FDTD/cartoperator.cpp +++ b/FDTD/cartoperator.cpp @@ -431,7 +431,7 @@ unsigned int CartOperator::GetVoltageExcitation(unsigned int* &index, FDTD_FLOAT if (prop) { CSPropElectrode* elec = prop->ToElectrode(); - if (elec->GetType()==0) + if (elec->GetExcitType()==0) { vIndex.push_back(ipos); for (int n=0;n<3;++n) @@ -444,5 +444,5 @@ unsigned int CartOperator::GetVoltageExcitation(unsigned int* &index, FDTD_FLOAT } } } - cerr << "size:" << vIndex.size() << endl; + cerr << "size: " << vIndex.size() << endl; } diff --git a/main.cpp b/main.cpp index 63bdfd7..6d4e2ea 100644 --- a/main.cpp +++ b/main.cpp @@ -5,15 +5,16 @@ using namespace std; +void BuildMSL(ContinuousStructure &CSX); + int main(int argc, char *argv[]) { - cout << "Hello World" << endl; - fprintf(stderr,"%e\n",1.4456); + ContinuousStructure CSX; time_t startTime=time(NULL); - ContinuousStructure CSX; - CSX.ReadFromXML("csx-files/1Mill.xml"); +// CSX.ReadFromXML("csx-files/MSL.xml"); + BuildMSL(CSX); CartOperator cop; cop.SetGeometryCSX(&CSX); @@ -32,3 +33,48 @@ int main(int argc, char *argv[]) return 0; } + +void BuildMSL(ContinuousStructure &CSX) +{ + CSPropMaterial* mat = new CSPropMaterial(CSX.GetParameterSet()); + mat->SetEpsilon(3.6); + CSX.AddProperty(mat); + + CSPrimBox* box = new CSPrimBox(CSX.GetParameterSet(),mat); + box->SetCoord(0,-200.0);box->SetCoord(1,200.0); + box->SetCoord(2,0.0);box->SetCoord(3,50.0); + box->SetCoord(4,-1000.0);box->SetCoord(5,1000.0); + CSX.AddPrimitive(box); + + CSPropMaterial* MSL = new CSPropMaterial(CSX.GetParameterSet()); + MSL->SetKappa(56e6); + CSX.AddProperty(MSL); + + box = new CSPrimBox(CSX.GetParameterSet(),MSL); + box->SetCoord(0,-20.0);box->SetCoord(1,20.0); + box->SetCoord(2,0.0);box->SetCoord(3,50.0); + box->SetCoord(4,-1000.0);box->SetCoord(5,1000.0); + CSX.AddPrimitive(box); + + CSPropElectrode* elec = new CSPropElectrode(CSX.GetParameterSet()); + elec->SetExcitation(1,1); + elec->SetExcitType(0); + CSX.AddProperty(elec); + + box = new CSPrimBox(CSX.GetParameterSet(),elec); + box->SetCoord(0,-20.0);box->SetCoord(1,20.0); + box->SetCoord(2,0.0);box->SetCoord(3,50.0); + box->SetCoord(4,0.0);box->SetCoord(5,0.0); + CSX.AddPrimitive(box); + + CSRectGrid* grid = CSX.GetGrid(); + + for (int n=-1000;n<=1000;n+=20) + grid->AddDiscLine(2,(double)n); + for (int n=-200;n<=200;n+=10) + grid->AddDiscLine(0,(double)n); + for (int n=0;n<=300;n+=10) + grid->AddDiscLine(1,(double)n); + + CSX.Write2XML("csx-files/MSL.xml"); +}