Thanks, Roy.

I think I found the error at my end that was leading to this behavior.

I am working with a parallel mesh, currently without AMR, and I use a
MeshSerializer to collect all elements on a local processor before creating
a MeshFunction. However, I was destroying and recreating the serializer
object repeatedly without clearing the point locator. As a result, the
cached element pointer in point locator pointed to an element that was
destroyed, leading to a seg-fault.

Now I am doing this a little more carefully, and things seem to be working
alright.

-Manav

On Thu, Aug 29, 2013 at 11:07 PM, Roy Stogner <[email protected]>wrote:

>
>
> On Thu, 29 Aug 2013, Manav Bhatia wrote:
>
>   The mesh.sub_point_locator() method, however, warns that this
>>   should not be used in a multithreaded or non-parallel_only code.
>>
>
> That's not the full sentence; read that comment again.
>
> "This should not be used in threaded or non-parallel_only code
>
> ...
> unless the master has already been constructed."
>
> So you make sure a master point locator gets constructed.
>
> Basically, call sub_point_locator() once in a part of the code which
> isn't multi-threaded and is being run simultaneously on all processors
> (that's what the parallel_only terminology is about), and that will do
> the non-thread-safe parallel-synchronization-**required work of creating
> a master point locator.  After that's done then you (or classes you
> use, like MeshFunction) can call sub_point_locator() from inside
> threaded or asynchronous parallel code and safely use the result.
>
> If you change the mesh afterward (refinement, read from new file,
> whatever) then you'll need to construct a new master point locator
> under the same restrictions.
> ---
> Roy
>
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to