protected string _getFormatedComplexField(T pRowData, ComplexField pField) { string formatedString = ""; for (int i = 0; i < pField.Fields.Count; i++) { if (pField.Fields[i] is Field) { formatedString += _getFormatedField(pRowData, pField.Fields[i] as Field); } else if (pField.Fields[i] is CustomField) { formatedString += ((CustomField)pField.Fields[i]).Format(); } else if (pField.Fields[i] is ComplexField) { formatedString += _getFormatedComplexField(pRowData, pField.Fields[i] as ComplexField); } if (i < pField.Fields.Count - 1) { formatedString += " "; } } return(formatedString); }
public FDTDPropagator(DiscretisationInfo discretisationInfo, ComplexField EField, ComplexField HField, IStructure structure) { this.discretisationInfo = discretisationInfo; this.EField = EField; this.HField = HField; Structure = structure; }
public void SetComplexFieldValue(string fieldId, ComplexValue complexValue) { ComplexField field = new ComplexField(); field.Id = fieldId; field.SetComplexValue(complexValue); this.fieldMap[fieldId] = field; }
public ComplexValue GetComplexFieldValue(string fieldId) { Field field = this.fieldMap[fieldId]; if (field == null || !field.Type.Equals(FieldTypeEnum.COMPLEX)) { return(null); } ComplexField cfield = (ComplexField)field; return(cfield.GetComplexValue()); }
public void InitializeFieldAndPoints() { BigInt xA = new BigInt("79e7128ff9ea31d83fcad7522eeaf8ef5dcddf2026dd8b61f31cb42c99f0b53e36f6879ea556d459f551b7ac87827b64a172cc3f5170acba502d3d4334ce6ae0", 16); BigInt yA = new BigInt("2dfab43956cfa22ab888f29f3f0de15117476e7ebe56ec0f56344cb848dc60b0d27960ec82fb217d6bc17e873f265139fb6d88080ce15d642f0b6c88f6eb5b93", 16); BigInt xB = new BigInt("488af43b1f7896f448eb9b2b0d8d08609fae80378331a2f46eff498ff74587c9faee194750fa83dab39c249af427ee35eca11c85ae040c251b0c3e2d42867a6c", 16); BigInt yB = new BigInt("2fc1857562f9d8a35157eadecfd990157f8a064038d7d7c9d721c57202de9d8f1456295983f0cb61332084f3df37e9d6d24aba24e563df2a82b6a851038dbf2e", 16); BigInt p = new BigInt("7401141187874108427630978940572992096905023977763437457544729409920516808700177140037470732982461341936680397619662697052215095603718060674210397061385939", 10); field = new Fp(p); f = new ComplexField(field); a = new Complex(field, xA, yA); b = new Complex(field, xB, yB); }
static void Main(string[] args) { var dx = 0.58652 * u / 40.0; var dy = 0.58652 * u / 40.0; //calculating the time step using Corant Limit formula var dt = 0.9 * CalculateTimeStepUsingCourantLimit(dx, dy); var discretisationInfo = new DiscretisationInfo(dx, dy, dt); var unitCellDetails = new UnitCellDetails( xPeriod: 0.58652 * u, yPeriod: 0.58652 * u, dielectricBackground: Eps0, rodholeDielectric: 3.4 * 3.4 * Eps0, rodHoleRadius: 0.2 * 0.58652 * u, discretisationInfo: discretisationInfo); //creating the structure to be simulated var structure = CreateAndSaveStructure(unitCellDetails, discretisationInfo); //creating the source to be used to excite the structure int timeSteps = 200000; Source source = CreateSource(discretisationInfo, timeSteps); var EField = new ComplexField(structure.XCells, structure.YCells); var HField = new ComplexField(structure.XCells, structure.YCells); var fdtdPropagator = new FDTDPropagator(discretisationInfo, EField, HField, structure); fdtdPropagator.OnMultipleReached += (t) => Messenger.SimulationTimeInfos(timeSteps, t); var detector1 = new Detector(20, 20); var detector2 = new Detector(unitCellDetails.XPeriod / 3.0, unitCellDetails.YPeriod * 0.8, discretisationInfo.Dx, discretisationInfo.Dy); var detectors = new List <Detector> { detector1, detector2 }; WriteLine(); Messenger.PrintSimulationRunDetails(timeSteps, timeSteps * discretisationInfo.Dt); var watch = Stopwatch.StartNew(); fdtdPropagator.Propagate(timeSteps, source, detectors); Messenger.ElapsedTime(watch); WriteLine(); SaveDetectors(detectors); WriteLine("Press Enter to terminate"); ReadLine(); }
private Field DigestField(XPathNavigator nav, IFactoryFarm factoryFarm) { nav.MoveToFirstChild(); // literalField, tableField, addition, multiplication FieldTypes fieldType; if (!Enum.TryParse <FieldTypes>(nav.Name, out fieldType)) { throw new AccountingModuleException("Field type is not supported. Field type was: {0}", nav.Name); } switch (fieldType) { case FieldTypes.literalField: return(DigestLiteralField(nav.Clone(), factoryFarm)); case FieldTypes.tableField: return(DigestTableField(nav.Clone(), factoryFarm)); case FieldTypes.specialField: return(DigestSpecialField(nav.Clone(), factoryFarm)); case FieldTypes.addition: case FieldTypes.multiplication: { ComplexField complexField = null; switch (fieldType) { case FieldTypes.addition: complexField = factoryFarm.FieldFactory.CreateAdditionField(); break; case FieldTypes.multiplication: complexField = factoryFarm.FieldFactory.CreateMultiplicationField(); break; } nav.MoveToFirstChild(); // literalField, tableField, addition, multiplication do { complexField.AddField(DigestField(nav.Clone(), factoryFarm)); } while (nav.MoveToNext()); return(complexField); } default: throw new AccountingModuleException("Field type is not supported. Field type was: {0}", fieldType.ToString()); } }
private void regroupToolStripMenuItem_Click(object sender, EventArgs e) { ComplexField complexField = new ComplexField(); foreach (IField field in olvSelectedFields.SelectedObjects) { complexField.Fields.Add(field); } ComplexFieldPropertiesForm frm = new ComplexFieldPropertiesForm { UseSpecificLength = _useSpecficLenght, DefaultFields = _defaultList, ComplexField = complexField }; if (frm.ShowDialog() == DialogResult.OK) { olvSelectedFields.RemoveObjects(olvSelectedFields.SelectedObjects); _addField(frm.ComplexField); } }
public static Field CreateField(FieldTypeEnum fieldEnum) { Field field = null; switch (fieldEnum) { case FieldTypeEnum.INPUT: field = new InputField(); break; case FieldTypeEnum.MULTIINPUT: field = new MultiInputField(); break; case FieldTypeEnum.SINGLECHECK: field = new SingleCheckField(); break; case FieldTypeEnum.MULTICHECK: field = new MultiCheckField(); break; case FieldTypeEnum.COMPLEX: field = new ComplexField(); break; case FieldTypeEnum.MULTICOMPLEX: field = new MultiComplexField(); break; case FieldTypeEnum.LABEL: field = new LabelField(); break; } return(field); }
private static ComplexField ElementToComplexField(XmlElement fieldElm, string fieldId, string fieldName) { if (fieldElm == null) { return(null); } ComplexField complexField = (ComplexField)SchemaFactory.CreateField(FieldTypeEnum.COMPLEX); complexField.Id = fieldId; complexField.Name = fieldName; XmlElement fieldsEle = XmlUtils.GetChildElement(fieldElm, "fields"); if (fieldsEle != null) { List <XmlElement> fieldEleList = XmlUtils.GetChildElements(fieldsEle, "field"); foreach (XmlElement subFieldEle in fieldEleList) { Field fieldFromEle = ElementToField(subFieldEle); complexField.Add(fieldFromEle); } } //rules XmlElement rulesEle = XmlUtils.GetChildElement(fieldElm, "rules"); if (rulesEle != null) { List <XmlElement> ruleEleList = XmlUtils.GetChildElements(rulesEle, "rule"); foreach (XmlElement ruleEle in ruleEleList) { Rule rule = ElementToRule(ruleEle, complexField.Id); complexField.Add(rule); } } //property XmlElement propertiesEle = XmlUtils.GetChildElement(fieldElm, "properties"); if (propertiesEle != null) { List <XmlElement> propertyEleList = XmlUtils.GetChildElements(propertiesEle, "property"); foreach (XmlElement propertyEle in propertyEleList) { Property.Property property = ElementToProperty(propertyEle, complexField.Id); complexField.Add(property); } } //default-complex-value XmlElement defaultComplexValueEle = XmlUtils.GetChildElement(fieldElm, "default-complex-values"); if (defaultComplexValueEle != null) { List <XmlElement> defaultValuesSubFieldList = XmlUtils.GetChildElements(defaultComplexValueEle, "field"); ComplexValue defaultCvalue = new ComplexValue(); foreach (XmlElement subFiledValueEle in defaultValuesSubFieldList) { Field field = ElementToField(subFiledValueEle); defaultCvalue.Put(field); } complexField.SetDefaultValue(defaultCvalue); } //complex-value XmlElement complexValueEle = XmlUtils.GetChildElement(fieldElm, "complex-values"); if (complexValueEle != null) { List <XmlElement> valuesSubFieldList = XmlUtils.GetChildElements(complexValueEle, "field"); ComplexValue cvalue = new ComplexValue(); foreach (XmlElement subFiledValueEle in valuesSubFieldList) { Field field = ElementToField(subFiledValueEle); cvalue.Put(field); } complexField.SetComplexValue(cvalue); } return(complexField); }