/// <summary> /// <see cref="DGField.FieldInitializer"/> /// </summary> /// <param name="tsi"></param> /// <param name="data"></param> /// <param name="loadedObjects"></param> public override void LoadData(ITimestepInfo tsi, IList <CellFieldDataSet> data, HashSet <object> loadedObjects) { if (loadedObjects.Contains(this)) { return; } this.Basis.Tracker.LoadData(tsi, data, loadedObjects); int MyIndex = tsi.FieldInitializers.IndexOf( this.Initializer, (a, b) => a.Identification.Equals(b.Identification)); XDGFieldInitializer myInfo = (XDGFieldInitializer)tsi.FieldInitializers.Single(info => info.Identification.Equals(this.Identification)); if (this.Basis.Degree == myInfo.BasisInfo.Degree) { XDGField dis = this; LoadCoordinates(data, MyIndex, dis); } else { XDGField Temp = new XDGField(new XDGBasis(this.Basis.Tracker, myInfo.BasisInfo.Degree)); LoadCoordinates(data, MyIndex, Temp); this.Clear(); this.AccLaidBack(1.0, Temp); } loadedObjects.Add(this); }
/// <summary> /// <see cref="DGField.FieldInitializer"/> /// </summary> /// <param name="tsi"></param> /// <param name="data"></param> /// <param name="loadedObjects"></param> public override void LoadData(ITimestepInfo tsi, IList <CellFieldDataSet> data, HashSet <object> loadedObjects) { if (loadedObjects.Contains(this)) { return; } this.Basis.Tracker.LoadData(tsi, data, loadedObjects); int MyIndex = tsi.FieldInitializers.IndexOf( this.Initializer, (a, b) => a.Identification.Equals(b.Identification)); XDGFieldInitializer myInfo = (XDGFieldInitializer)tsi.FieldInitializers.Single(info => info.Identification.Equals(this.Identification)); if (MyIndex >= 0) { int J = this.GridDat.iLogicalCells.NoOfLocalUpdatedCells; for (int j = 0; j < J; j++) { //double[] coords_j = data[j].DGCoordinateData[MyIndex]; //double[] coords_j = data[j].DGCoordinateData[MyIndex].Data; double[] coords_j = data[j].GetDGCoordinates(MyIndex); Debug.Assert(data[j].GlobalID == this.GridDat.iLogicalCells.GetGlobalID(j)); this.DeserializeDGcoords(j, coords_j); } } else { Console.Error.WriteLine("Unable to load field '{0}'; initializing with zeros.", this.Identification); this.Coordinates.Clear(); } /* * if (this.Basis.Degree == myInfo.BasisInfo.Degree) { * XDGField dis = this; * LoadCoordinates(data, MyIndex, dis); * } else { * XDGField Temp = new XDGField(new XDGBasis(this.Basis.Tracker, myInfo.BasisInfo.Degree)); * LoadCoordinates(data, MyIndex, Temp); * this.Clear(); * this.AccLaidBack(1.0, Temp); * }*/ loadedObjects.Add(this); }
/// <summary> /// Compares the given object <paramref name="other"/> with respect /// to the /// <see cref="XDGFieldInitializer.Identification"/> and the /// <see cref="FieldInitializer.BasisInfo"/>. /// </summary> /// <returns></returns> public override bool Equals(Initializer <DGField> other) { XDGFieldInitializer initializer = other as XDGFieldInitializer; if (initializer == null) { return(false); } if (!base.BasisInfo.Equals(initializer.BasisInfo)) { return(false); } if (!base.Identification.Equals(initializer.Identification)) { return(false); } return(true); }