I am writing here in the hope that I can get a solution to the problem that I am having.
I'll start with a little background. My objective is to make a program that can cut a solid, read from a STEP file, into a number of sections. The best way that come to my mind was to use Boolean operations (Cut or Common) to cut the geometry. However, for very complex CAD files this takes a very long time. Since the cutting operations are independent, I was thinking to try to do the cutting in parallel. However, I have ran into trouble.
I attach a simplified version of the program that I am currently using. In this version, the number of cuts done on X,Y and Z axis are chosen via a #define statement. Then, inside for loops, I make a solid box corresponding to the bounding box for each section, which I then use in a BRepAlgoAPI_Common operation with my main shape to obtain the section. I know this is not very efficient, and in the longer version of the software I am taking a recursive approach, but that is more difficult to parallelize, and for start I want to keep it simple. I will do that as the next step.
So I tried to use TBB tasks to parallelize the CAD cutting operations. The reason for the tasks is that I think they are the way to go for parallelizing the recursive case. However, more often than not my program crashes or freezes.
I've read the previous posts http://www.opencascade.org/org/forum/thread_21248/ and learned that I should set MMGT_OPT=0. I have also tried MMTT_REENTRANT=1. Basically:
MMGT_OPT=1, MMTT_REENTRANT=0 --> instant crash
MMGT_OPT=1, MMTT_REENTRANT=1 --> sometimes crashes and sometimes works
MMGT_OPT=0, MMTT_REENTRANT=0 --> always freezes or crashes
MMGT_OPT=0, MMTT_REENTRANT=1 --> always freezes or crashes
I am using TBB 4.0 and MSVC 2010, 32bit compilation on a 64bit Win7 machine.
Any suggestions? Any experience with such things?