public new Seed_DEPRECATED Clone() { List <Point> temp = new List <Point>(points.Count); foreach (Point p in points) { temp.Add(p.Clone()); } Seed_DEPRECATED s = new Seed_DEPRECATED(base.Clone(), temp, radius); s.FTLE = FTLE; return(s); }
public void AddPoint(Seed_DEPRECATED s, int StreamID) { if (streamLines.TryGetValue(StreamID, out StreamLine_DEPRECATED line)) { line.AddPoint(s); } else { StreamLine_DEPRECATED _line = new StreamLine_DEPRECATED(); _line.AddPoint(s); streamLines.Add(StreamID, _line); } }
public void AddPoint(Seed_DEPRECATED newseed) { if (points.Count > 0) { if (points[0].FTLE > newseed.FTLE) { newseed.FTLE = points[0].FTLE; } else { foreach (Seed_DEPRECATED s in points) { s.FTLE = newseed.FTLE; } } } points.Add(newseed); }
private void CalculateSeed(object ID_Point_Steps_dt_radius) { List <object> param = (List <object>)ID_Point_Steps_dt_radius; int ID = (int)param[0]; Point entry = (Point)param[1]; int steps = (int)param[2]; double dt = (double)param[3]; float radius = (float)param[4]; Seed_DEPRECATED seed; int startstep = 0; byte[] output = new byte[0]; if (File.Exists(folder + "/ID_" + ID + ".dat")) { int npoints = 5; int nparam = 6; int pointSize = nparam * sizeof(double); int pointsSize = npoints * pointSize; int lineSize = pointsSize + sizeof(double); byte[] data = File.ReadAllBytes(folder + "/ID_" + ID + ".dat"); int lastStepStart = data.Length - lineSize; startstep = data.Length / lineSize; List <Point> points = new List <Point>(npoints); for (int j = lastStepStart; j < lastStepStart + pointsSize; j += pointSize) { double[] pos = new double[nparam / 2]; double[] vel = new double[nparam / 2]; for (int k = 0; k < nparam / 2; k++) { pos[k] = BitConverter.ToDouble(data, j + sizeof(double) * k); vel[k] = BitConverter.ToDouble(data, j + sizeof(double) * (k + nparam / 2)); } points.Add(new Point(pos, vel)); } seed = new Seed_DEPRECATED(points, radius); Console.WriteLine("File exists. Start with step " + startstep); } else { seed = new Seed_DEPRECATED(entry, radius, DS); } double maxFTLE = double.NegativeInfinity; for (int i = startstep; i < steps; i++) { semaphore.WaitOne(); double FTLE = Math.Log(seed.Calculate(DS, dt)); if (double.IsInfinity(FTLE)) { Console.WriteLine("[WARNING] FTLE is INF for " + ID + " step " + i); FTLE = 0; } if (FTLE > maxFTLE) { maxFTLE = FTLE; seed.FTLE = maxFTLE; } output = output.Concat(seed.Serialize()).ToArray(); output = output.Concat(BitConverter.GetBytes(FTLE)).ToArray(); semaphore.Release(); if ((100 * (float)(i - startstep) / (steps - startstep)) % 25 == 0) { Console.WriteLine(ID + "\t:\t" + (100 * (i - startstep) / (steps - startstep)) + " % Done"); } lock (fdslock) { FDS.AddPoint(seed.Clone(), ID); } } using (FileStream fileStream = new FileStream(folder + "/ID_" + ID + ".dat", FileMode.Append)) { fileStream.Write(output, 0, output.Length); } notifier.Set(); }