I checked my program and found what was wrong. The PointLocatorTree object 
should be defined after the operations to the mesh.
Thanks for your correction.

Best regards,


> On Jun 23, 2016, at 9:23 PM, 张江 <[email protected]> wrote:
> 
> I found this problem in my own program. Here is the test code example:
> 
> int main(int argc, char** argv)
> {
>   LibMeshInit init(argc, argv);
> 
>   UnstructuredMesh *mesh;
>   ExodusII_IO *exio;
>   EquationSystems *eqsys;
>   System *asys;
>   libMesh::PointLocatorTree *locator;
> 
>   mesh = new Mesh(init.comm());
>   exio = new ExodusII_IO(*mesh);
>   locator = new PointLocatorTree(*mesh);
>   exio->read("res.e");
>   mesh->allow_renumbering(false);
>   mesh->prepare_for_use();
> 
>   float pt[3] = {0, 0, 0};
>   for (int i=0; i<20; i++)
>   {
>     Point p(pt[0]+(float)i/100., pt[1]+(float)i/100., pt[2]+(float)i/100.);
> 
>     const Elem *e = (*locator)(p); // it takes much time (at least 1s or even 
> 100s)
> 
>     if (e != NULL) fprintf(stderr, "point locate cell: %d\n", e->id());
>     else fprintf(stderr, "locate NULL\n");
>   }
> 
>   return 0;
> }
> 
> I just selected 20 points and located the cells they were in. The locator 
> took much time every time. 
> The points can be found in elements when executing. But when enabling 
> _out_of_mesh_mode, the elements can not be located. 
> So It seems that the locator always falls into perform_linear_search 
> <http://libmesh.github.io/doxygen/classlibMesh_1_1PointLocatorTree.html#acd313428c9a4551d7e1aaa141e7ae8e7>
>  function when executing operator() 
> <http://libmesh.github.io/doxygen/classlibMesh_1_1PointLocatorTree.html#a08990e437871fc26e3043806aef8dfaa>.
>  
> 
>> On Jun 23, 2016, at 5:42 PM, John Peterson <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> 
>> 
>> On Thu, Jun 23, 2016 at 4:23 PM, 张江 <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Hi,
>> 
>> I am using libmesh to read a large unstructured grid data. The mesh info is 
>> below:
>> 
>> Mesh Information:
>>   elem_dimensions()={3}
>>   spatial_dimension()=1
>>   n_nodes()=67855938
>>     n_local_nodes()=0
>>   n_elem()=181423412
>>     n_local_elem()=0
>>     n_active_elem()=181423412
>>   n_subdomains()=0
>>   n_partitions()=1
>>   n_processors()=1
>>   n_threads()=1
>>   processor_id()=0
>> 
>> I found that when locating a point by PointLocatorTree, it always took much 
>> time (about 50s or even more).
>> 
>> How many points did you look for?  The cost to initially build the 
>> PointLocator is expensive, but it's amortized by the fact that you can use 
>> it multiple times once it's built... 
>> 
>>  
>> It seems that the locator always falls into perform_linear_search 
>> <http://libmesh.github.io/doxygen/classlibMesh_1_1PointLocatorTree.html#acd313428c9a4551d7e1aaa141e7ae8e7
>>  
>> <http://libmesh.github.io/doxygen/classlibMesh_1_1PointLocatorTree.html#acd313428c9a4551d7e1aaa141e7ae8e7>>
>>  function when executing operator()
>> 
>> It "seems"?  The linear search should only happen if the point fails to be 
>> found.  If the point is not being found in any element, you should look into 
>> why that happens first...
>> 
>> -- 
>> John
> 

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to