← Back to team overview

dolfin team mailing list archive

Re: intersect_any() and intersects_exactly(): bug or misunderstanding?

 

Hi all,

I think I have it figured out. The point you chose is on the edge joining
nodes 0 (0,0,0) and 7 (1,1,1) which is found in all the cells.

In [29]: mesh.coordinates()
Out[29]:
array([[ 0.,  0.,  0.],
       [ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 1.,  1.,  0.],
       [ 0.,  0.,  1.],
       [ 1.,  0.,  1.],
       [ 0.,  1.,  1.],
       [ 1.,  1.,  1.]])

In [30]: mesh.cells()
Out[30]:
array([[0, 1, 3, 7],
       [0, 1, 5, 7],
       [0, 4, 5, 7],
       [0, 2, 3, 7],
       [0, 4, 6, 7],
       [0, 2, 6, 7]], dtype=int32)

--
Evan Lezar

Computational Electromagnetics Group
Department of Electrical and Electronic Engineering
University of Stellenbosch
Stellenbosch
South Africa

www.evanlezar.com

GoogleTalk: evanlezar
Skype: evanlezar


On Thu, Apr 21, 2011 at 6:32 PM, Neilen Marais <nmarais@xxxxxxxxx> wrote:

> Hi,
>
> I understand the definition of cell.intersects_exaclty(point) to be
> such that it will return true if point is inside cell, and false if it
> is outside. However, the following code results in a point marked as
> intersecting with all elements in the mesh. This AFAIK could only be
> true if point was coincident with a vertex that all the cells in the
> mesh were connected to. Am I misunderstanding, or is it a bug?
>
> from __future__ import division
>
> import numpy as N
> from dolfin import *
>
> # Define mesh
> mesh = UnitCube(1,1,1)
> source_coords = N.array([1/20, 1/20, 1/20], dtype='d')
> source_pt = Point(*source_coords)
> intersected_elements = mesh.all_intersected_entities(source_pt)
> for cell_index in intersected_elements:
>    c = Cell(mesh, cell_index)
>    # Check that the source point is in this element
>    assert(c.intersects_exactly(source_pt))
> print intersected_elements
>
> returns:
>
> In [15]: run list_example.py
> [0 1 2 3 4 5]
>
> Cheers
> Neilen
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References