I’m testing a Parallel Foreach C# node to test for curve containment. Basically extracting the discontinuity of each polyline curve and test if at least one point lies within the boundary curve. This works well while the data set is small, but becomes quite slow when a large number of curves are tested.
As I try to write a parallel process, it seems to work, but the order of these discontinuities get messed up so the resulting curves (organized as one curve per branch) are not connected properly. I could obviously cull the initial input with the test output without reconstructing the curves with points, but would still love to know how I would’ve done this for future/other data sets.
I understand that somehow it is related to how parallel processes need to be thread-safe, but am unsure how to fix this…I read through the post below but I believe the difference is that my data structure is a tree with branches containing multiple values themselves:
Attaching the file and below are screenshots of when the parallel boolean is set to False, and then True, and the gh setup with the code in the C# node. Any help is much appreciated!
containment_par_v3_test.gh (71.9 KB)