bugpyFormex - Bugs: bug #56642, Mesh.hits() returns wrong values


bug #56642: Mesh.hits() returns wrong values

Submitter:  gianluca de santis <gianlucadesi>
Submitted:  Wed 17 Jul 2019 02:24:39 PM UTC
Category:  Core Severity:  4 - Important
Item Group:  Functionality error Status:  None
Privacy:  Public Assigned to:  bverheg
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Tue 06 Aug 2019 06:17:46 AM UTC, comment #2: 

In commit e702e996 we have removed the possibility of using level!=0 in Mesh.hits, for the reason mentioned in [comment #1].

The following could be useful to replace it:

Mesh.getEdges() # construct the edges table
edge_selection = ...

or similarly with faces.

Then, keeping the Mesh.hits method only for level=0 is overkill, as one can just do Mesh.elems.hits(), which is nicely analoguous to the Mesh.edges.hits() and Mesh.faces.hits() explained above. So the Mesh.hits(level=0) has been deprecated (but not yet removed).

Benedict Verhegghe <bverheg>
Group administrator
Wed 17 Jul 2019 03:08:03 PM UTC, comment #1: 

The difference is due to the node numbering. As stated in the methods doc string:

The numbering of the entities corresponds to self.insertLevel(level).

And it turns out that self.insertLevel(0) renumbers the nodes.
The new numbering is given in the lo from

hi,lo = self.insertLevel(0)

You can avoid the renumbering by using directly Mesh.elems.hits().

In the current form the Mesh.hits is not very useful. It could convert the node numbers itself, but that will only work for level 0. For other levels, users would still be required to know the edge or face numbering (could be the stored edges/faces).

Or we can just drop the Mesh.hits and let the user directly work on a connectivity table.

Benedict Verhegghe <bverheg>
Group administrator
Wed 17 Jul 2019 02:24:39 PM UTC, original submission:  

The Mesh.hits() is not counting correctly. See example.

gianluca de santis <gianlucadesi>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #47231:  hits_works_bad.py added by gianlucadesi (861B - text/x-python)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by gianlucadesi (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-17 bverheg SummaryMesh.hits() returs wrong values Mesh.hits() returns wrong values
    2019-07-17 gianlucadesi Attached File- Added hits_works_bad.py, #47231

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code