bugpyFormex - Bugs: bug #36668, sortAdjacency fails on empty...

 
 

bug #36668: sortAdjacency fails on empty adjacency tables

Submitted by:  gianluca de santis <gianlucadesi>
Submitted on:  Sat 16 Jun 2012 01:38:41 PM UTC  
 
Category: NoneSeverity: 4 - Important
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Benedict Verhegghe <bverheg>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 27 Jun 2012 06:44:26 PM UTC, comment #1:

This has been solved in rev 2345

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Sat 16 Jun 2012 01:38:41 PM UTC, original submission:

adjacency fails in this special case:
"
import elements
h0=Mesh(elements.Hex8)
h=h0+h0.translate([2., 0., 0.])
print h.adjacency()
"
the error message ends with:
"
adj = sortAdjacency(adj)
File "/home/gianluca/gpyformex/pyformex/connectivity.py", line 1179, in sortAdjacency

adj = adj[:,maxc>=0] # retain columns with non-negative maximum
IndexError
:
invalid index
"

Indeed, the sortAdjacency function fails if adj is an empty array [[],[]]. To correct it 2 lines should be added in sortAdjacency:

def sortAdjacency(adj):
"""
if adj.shape[1]==0:#NEW LINE
return adj#NEW LINE
adj.sort(axis=-1) # sort rows
maxc = adj.max(axis=0) # find maximum per column
adj = adj[:,maxc>=0] # retain columns with non-negative maximum
return adj
"""

May I make this little change in connectivity.py?

gianluca de santis <gianlucadesi>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 27 Jun 2012 06:44:26 PM UTCbverhegStatusNone=>Fixed
      Open/ClosedOpen=>Closed
      SummarysortAdjacency=>sortAdjacency fails on empty adjacency tables

    Back to the top


    Powered by Savane 3.1-cleanup1