← Back to team overview

dolfin team mailing list archive

Re: [Question #101686]: [Question #101686]: cell.intersects() functionality in 0.9.7? (i.e. GTS dependencies)

 

Question #101686 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/101686

Anders Logg proposed the following answer:
On Sat, Feb 20, 2010 at 05:54:18PM -0000, Andre Massing wrote:
> Question #101686 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/101686
>
> Andre Massing proposed the following answer:
>
> Anders Logg wrote:
> > Question #101686 on DOLFIN changed:
> > https://answers.launchpad.net/dolfin/+question/101686
> >
> > Anders Logg proposed the following answer:
> > On Sat, Feb 20, 2010 at 01:06:17AM -0000, Andre Massing wrote:
> >> Question #101686 on DOLFIN changed:
> >> https://answers.launchpad.net/dolfin/+question/101686
> >>
> >> Andre Massing proposed the following answer:
> >>
> >> Garth N. Wells wrote:
> >>> Andre Massing wrote:
> >>>> Question #101686 on DOLFIN changed:
> >>>> https://answers.launchpad.net/dolfin/+question/101686
> >>>>
> >>>>     Status: Open => Answered
> >>>>
> >>>> Andre Massing proposed the following answer:
> >>>> On Friday 19. February 2010 18.33.47 marc spiegelman wrote:
> >>>>  > New question #101686 on DOLFIN:
> >>>>  > https://answers.launchpad.net/dolfin/+question/101686
> >>>>  >
> >>>>  > Hi All,
> >>>>  >    I've implemented a rather nifty semi-lagrangian advection scheme in
> >>>>  >  dolfin that requires rapid checking to see if a point intersects a
> >>>>  >  cell
> >>>>  >  (without necessarily firing up the full intersection operator).  Pre
> >>>>  >  0.9.7
> >>>>  >  this was implemented as cell.intersects(point).
> >>>>  >
> >>>>  > Everything works fine in 0.9.6   with the new CGAL intersection
> >>>>  > operator
> >>>>  > replacing the GTS intersection operator (with about a 20% speedup).
> >>>>
> >>>> Did you only use the intersection between meshentities and points or did
> >>>> you
> >>>> use also the new mesh intersection operator? Just curious, because the
> >>>> former
> >>>> code for intersection between points og e.g. triangles did not change.
> >>>>
> >>>>  >  However, in 0.9.7 the code breaks because  cell.intersects() has been
> >>>>  >  removed as a GTS dependency (actually, looking at
> >>>>  >  TriangleCell.intersects(point), it looks like it simply reproduces
> >>>>  >  GTS
> >>>>  >  code but wasn't actually dependent on GTS)
> >>>>
> >>>> Yep that's true, the intersection functions was removed and there is a new
> >>>> PrimitiveIntersector class in C++ with two static functions. These computes
> >>>> the intersection between rather arbitrary mesh entities (exact or only
> >>>> using
> >>>> doubling precision). The functions are exposed as do_intersect and
> >>>> do_intersect_exact in the python interface. But you are right, a point -
> >>>> meshentity intersection is not provided. I attached a patch against the
> >>>> recent
> >>>> 0.9.7 release. Could you can apply to you sources and see whether it
> >>>> works for
> >>>> you?
> >>>>
> >>> Andre: Did you forget to attach it?
> >> Hmm, I did not, at least in my sent box it also appeared with
> >> attachment. Strange... resend it (CC to the DOLFIN-ml).
> >
> > We also need to add back the simple interface
> >
> >   bool MeshEntity::intersects(const Foo& foo) const;
> >
> > where foo can be either a Point or another MeshEntity.
>
> Of course we can do this. But before I removed it, we discussed it a bit
> and concluded that intersects should not be a member function of an
> entity (IIRC :), because it is a symmetric operation between geometric
> objects and calculation of intersection detection is dependent on both
> involved types.
>
> >
> > do_intersect looks a bit strange to me. (But it might be good for the
> > low-level interface that interacts with the CGAL templates.)
>
> Why exactly? It takes two entities or an entity and a point and just
> returns a boolean value, stating, whether to entities "do intersect" :)
> But what might be a better, more meaningful name? Just "intersects"?  Or
> what did you think of?

I'm thinking we should reserve free functions for a few main
operations like assemble, solve, plot, refine. It would be more
natural to have intersects() as a member function in MeshEntity and
Point. They can be inlined and just call
PrimitiveIntersector::do_intersect.

--
Anders

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.