getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Getfem-users] Convex of a point


From: Roman Putanowicz
Subject: Re: [Getfem-users] Convex of a point
Date: Fri, 29 Apr 2011 04:51:27 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Dear Yves and Kostas,

Thank you for your hints.
> I would like to ask if someone has a ready piece of code
> to share which searches for a convex enclosing given 
> geometric point?

After looking at the source code of the classes:

getfem::interpolator_on_mesh_fem 
and
getfem::interpolated_fem

I have found in them a similarly looking method:
bool find_a_point(base_node pt, base_node &ptr, size_type &cv)

which implements the algorithm I needed.

With some copy and paste from other classes :-) (mostly mesh_fem)
I ended up with the class convext_locator for which the source code
I send in the appendix, for those interested with it.
(I am not sure if I maintain context dependencies properly with this class
but it seems to work).

Here is an example of the use of convex_locator to refine a mesh 
around a fixed geometric location couple of times:

  getfem::mesh myMesh;
  
  /*  ... initialize myMesh */

  dal::bit_vector e;
  getfem::convex_locator locator(myMesh);
  bgeot::base_node pt;bgeot::sc(pt) = 0.5, 0.3;
  
  for (int i=0; i<3; i++) {
    e.clear();
    int i = locator.find_all_convexes(pt, e);
    std::cout << "Found " << i << "convexes\n";
    myMesh.Bank_refine(e);
  }

I think that a comment is needed here. The convex search in 
convex_locator is probably not 100% bullet proof -- consider for
instance point on the convex facet.  I haven't looked at
the implementation of bgeot::geotrans_inv_convex used in the
convex search algorithm but I suspect that as with most of the
geometric predicates based on standard floating point arithmetic
there is a chance of some erratic behaviour of the predicate implementation.
Most of the time we can live with that but for some applications (mesh
generation or contact zone search) this might be an important issue.

Regards,

Roman

PS. Yves, if you think it is worth to add convex_locator to GetFEM
I can add proper documentation for it and test code. 
-- 
Roman Putanowicz, PhD  < address@hidden  >
Institute for Computational Civil Engng (L-5)
Dept. of Civil Engng, Cracow Univ. of Technology
www.l5.pk.edu.pl, tel. +48 12 628 2569, fax 2034

Attachment: convex_locator.cxx
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]