-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Computation progress #26
Comments
I'm open to suggestions. Have you done any benchmarks to find the hot spots in the code? I guess, the triangulation will be dominating the running time, but I never did a separate benchmark of the segment insertion and Delaunay refinement code. |
Did a quick benchmark on a collection of poly files:
So reporting from the void DivconqRecurse(int left, int right, int axis,
ref Otri farleft, ref Otri farright)
{
// ...
// Merge the two triangulations into one.
MergeHulls(ref farleft, ref innerleft, ref innerright, ref farright, axis);
// NEW PROGRESS REPORTING CODE
// Initializing the step size should be done at the beginning
// of the Triangulate method.
if (progressCounter == 0)
{
// The constant 2.5 is a guess for Dwyer.
progressStep = sortarray.Length / 2.5 / PROGRESS_MAX;
}
progressCounter++;
if (progressCounter >= progressCurrent)
{
progressCurrent += progressStep;
Console.CursorLeft = 0;
// Report progress as percent range [0..100]
Console.Write("{0:0.0 %} ", progressCurrent / progressStep / PROGRESS_MAX);
}
}
}
// https://www.codeproject.com/Tips/1130088/Reporting-Progress-the-Right-Way
const int PROGRESS_MAX = 1000;
double progressStep, progressCurrent = 0.0;
int progressCounter = 0; The above code should be encapsulated in a EDIT For the Dwyer code it's hard to predict the exact number of steps, since we don't know, how often the |
Took a second look at the benchmark - seems I measured only the triangulation time:
So it seems the progress reporting should also take the segment insertion and Delaunay refinement into account. |
Ok, so here most of the time is spent for refinement. Since the refinement process is dynamic - meaning that the list of bad quality triangles isn't fixed and new triangles might be added to the queue dynamically - it will be hard to come up with a good approach to report process reliably. One way would be to just report the number of remaining triangles in the queue, which obviously isn't suitable for being displayed in a progress bar or the like. I currently don't have the time (and motivation) to implement this. To get started, just add an |
Sorry for the late reply, and once again, thank you so much for all of your valuable insights and considerations. I just thought this was something at least worth mentioning for some real-world applications. As far as I am concerned, this issue may be closed now. |
On large sets of data, some procedures in Triangle.NET may turn out to be reasonably efficient, but not immediate. For example, I'm working with
GenericMesher.Triangulate
at the moment. Could its implementation be enriched so as to inform its calling code about progress in the computation? Perhaps one idiomatic way to achieve this would be making use of the Progress Class from the System namespace.The text was updated successfully, but these errors were encountered: