bool CSPropExcitation::ReadFromXML(TiXmlNode &root) { if (CSProperties::ReadFromXML(root)==false) return false; TiXmlElement *prop = root.ToElement(); if (prop==NULL) return false; int iHelp; if (prop->QueryIntAttribute("Number",&iHelp)!=TIXML_SUCCESS) uiNumber=0; else uiNumber=(unsigned int)iHelp; if (prop->QueryIntAttribute("Type",&iExcitType)!=TIXML_SUCCESS) return false; if (ReadVectorTerm(Excitation,*prop,"Excite",0.0)==false) return false; ReadTerm(m_Frequency,*prop,"Frequency"); ReadTerm(Delay,*prop,"Delay"); TiXmlElement *weight = prop->FirstChildElement("Weight"); if (weight!=NULL) { ReadTerm(WeightFct[0],*weight,"X"); ReadTerm(WeightFct[1],*weight,"Y"); ReadTerm(WeightFct[2],*weight,"Z"); } ReadVectorTerm(PropagationDir,*prop,"PropDir",0.0); return true; }
bool CSPropMaterial::ReadFromXML(TiXmlNode &root) { if (CSProperties::ReadFromXML(root)==false) return false; TiXmlElement* prop=root.ToElement(); if (prop==NULL) return false; int attr=1; prop->QueryIntAttribute("Isotropy",&attr); bIsotropy = attr>0; /*************** 3D - Properties *****************/ TiXmlElement* matProp=prop->FirstChildElement("Property"); if (matProp!=NULL) { ReadVectorTerm(Epsilon,*matProp,"Epsilon",1.0); ReadVectorTerm(Mue,*matProp,"Mue",1.0); ReadVectorTerm(Kappa,*matProp,"Kappa"); ReadVectorTerm(Sigma,*matProp,"Sigma"); ReadTerm(Density,*matProp,"Density",0.0); } /********** 3D - Properties Weight **************/ TiXmlElement *weight = prop->FirstChildElement("Weight"); if (weight!=NULL) { ReadVectorTerm(WeightEpsilon,*weight,"Epsilon",1.0); ReadVectorTerm(WeightMue,*weight,"Mue",1.0); ReadVectorTerm(WeightKappa,*weight,"Kappa",1.0); ReadVectorTerm(WeightSigma,*weight,"Sigma",1.0); ReadTerm(WeightDensity,*weight,"Density",1.0); } return true; }
bool CSPropDebyeMaterial::ReadFromXML(TiXmlNode &root) { if (CSPropDispersiveMaterial::ReadFromXML(root)==false) return false; TiXmlElement* prop=root.ToElement(); if (prop==NULL) return false; // count m_Order TiXmlElement* matProp=prop->FirstChildElement("Property"); if (matProp!=NULL) { m_Order=1; while (1) { if (matProp->Attribute("EpsilonDelta_"+ConvertInt(m_Order+1))) ++m_Order; else if (matProp->Attribute("MueDelta_"+ConvertInt(m_Order+1))) ++m_Order; else break; } } else return false; InitValues(); if (ReadVectorTerm(EpsDelta[0],*matProp,"EpsilonDelta_1",0.0)==false) ReadVectorTerm(EpsDelta[0],*matProp,"EpsilonDelta",0.0); if (ReadVectorTerm(EpsRelaxTime[0],*matProp,"EpsilonRelaxTime_1",0.0)==false) ReadVectorTerm(EpsRelaxTime[0],*matProp,"EpsilonRelaxTime",0.0); TiXmlElement* weightProp=prop->FirstChildElement("Weight"); if (weightProp) { if (ReadVectorTerm(WeightEpsDelta[0],*weightProp,"EpsilonDelta_1",1.0)==false) ReadVectorTerm(WeightEpsDelta[0],*weightProp,"EpsilonDelta",1.0); if (ReadVectorTerm(WeightEpsRelaxTime[0],*weightProp,"EpsilonRelaxTime_1",1.0)==false) ReadVectorTerm(WeightEpsRelaxTime[0],*weightProp,"EpsilonRelaxTime",1.0); } for (int o=1;o<m_Order;++o) { ReadVectorTerm(EpsDelta[o],*matProp,"EpsilonDelta_"+ConvertInt(o+1),0.0); ReadVectorTerm(EpsRelaxTime[o],*matProp,"EpsilonRelaxTime_"+ConvertInt(o+1),0.0); if (weightProp) { ReadVectorTerm(WeightEpsDelta[o],*weightProp,"EpsilonDelta_"+ConvertInt(o+1),1.0); ReadVectorTerm(WeightEpsRelaxTime[o],*weightProp,"EpsilonRelaxTime_"+ConvertInt(o+1),1.0); } } return true; }
bool ReadVectorTerm(ParameterScalar PS[3], TiXmlElement &elem, string attr, double val, const char delimiter) { return ReadVectorTerm(PS, elem, attr.c_str(), val, delimiter); }