public int[] GetCounts(KPoint key, int linePtr) { if (_hiRez) { if (_countsRepoHiRez.ReadParts(key, _workResultHiRez)) { return(GetOneLineFromCountsBlock(_workResultHiRez.Counts, linePtr)); } else { return(null); } } else { if (_countsRepo.ReadParts(key, _workResult)) { return(GetOneLineFromCountsBlock(_workResult.Counts, linePtr)); } else { return(null); } } }
public bool RetrieveWorkResultFromRepo(KPoint key, MapSectionWorkResult workResult) { // When writing include the Area's offset. KPoint transKey = key.ToGlobal(_position); lock (_repoLock) { bool result = _countsRepo.ReadParts(transKey, workResult); return(result); } }
public bool RetrieveWorkResultFromRepo(KPoint riKey, SubJobResult workResult) { // When writing include the Area's offset. KPoint transKey = riKey.ToGlobal(_position); lock (_repoLock) { if (Closed) { return(false); } bool result = _countsRepo.ReadParts(transKey, workResult); return(result); } }
public void GetHistogramTest() { int w = 108; // blocks int h = 72; CanvasSize imageSize = new CanvasSize(w * 100, h * 100); string fn = "17"; string filename = $"MandlebrodtMapInfo ({fn})"; string imagePath = Path.Combine(BasePath, $"MBB({fn})_{imageSize.Width}.png"); IDictionary <int, int> hist = new Dictionary <int, int>(); ValueRecords <RectangleInt, MapSectionWorkResult> countsRepo = new ValueRecords <RectangleInt, MapSectionWorkResult>(filename, useHiRezFolder: false); RectangleInt key = new RectangleInt(new PointInt(0, 0), new SizeInt(100, 100)); MapSectionWorkResult workResult = new MapSectionWorkResult(10000, hiRez: false, includeZValuesOnRead: false); for (int vBPtr = 0; vBPtr < h; vBPtr++) { key.Point.Y = vBPtr * 100; for (int hBPtr = 0; hBPtr < w; hBPtr++) { key.Point.X = hBPtr * 100; if (countsRepo.ReadParts(key, workResult)) { foreach (int cntAndEsc in workResult.Counts) { int cnt = cntAndEsc / 10000; if (hist.TryGetValue(cnt, out int occurances)) { hist[cnt] = occurances + 1; } else { hist[cnt] = 1; } } } } } Debug.WriteLine($"The histogram has {hist.Count} entries."); }
public void TestMethod1() { string filename = "Center1"; using (ValueRecords <RectangleInt, MapSectionWorkResult> repo = new ValueRecords <RectangleInt, MapSectionWorkResult>(filename, useHiRezFolder: false)) { RectangleInt key = new RectangleInt(new PointInt(0, 0), new SizeInt(100, 100)); MapSectionWorkResult val = BuildMSWR(100 * 100); repo.Add(key, val); MapSectionWorkResult val2 = new MapSectionWorkResult(100 * 100, hiRez: false, includeZValuesOnRead: true); repo.ReadParts(key, val2); } using (ValueRecords <RectangleInt, MapSectionWorkResult> repo = new ValueRecords <RectangleInt, MapSectionWorkResult>(filename, useHiRezFolder: false)) { RectangleInt key = new RectangleInt(new PointInt(0, 0), new SizeInt(100, 100)); MapSectionWorkResult val2 = new MapSectionWorkResult(100 * 100, hiRez: false, includeZValuesOnRead: true); repo.ReadParts(key, val2); } }