bugpyFormex - Bugs: bug #40394, improving Mesh.withoutProp

 
 

bug #40394: improving Mesh.withoutProp

Submitted by:  gianluca de santis <gianlucadesi>
Submitted on:  Mon 28 Oct 2013 12:46:11 PM UTC  
 
Category: NoneSeverity: 2 - Minor
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 28 Oct 2013 12:46:11 PM UTC, comment #2:

This item has been reassigned from the project pyFormex support tracker to your tracker.

The original report is still available at support #108423

Following are the information included in the original report:

[field #0] Item ID: 108423
[field #1] Group ID: 10866
[field #2] Open/Closed: Open
[field #3] Severity: 2 - Minor
[field #4] Privacy: Public
[field #9] Category: None
[field #10] Submitted by: gianlucadesi
[field #11] Assigned to: None
[field #12] Submitted on: Mon 28 Oct 2013 11:14:37 AM CET
[field #13] Summary: improving Mesh.withoutProp
[field #14] Original Submission: Mesh.withoutProps fails if val is [] or array([]).
Mesh.withProp works if val is [] or array([]).
Also, to check 'what prop is not in val' we could use
the numpy.in1d instead of a for loop.
Below there is a possible version:

def withoutProp(self, val):
"""Return a Mesh without the elements with property `val`.

This is the complementary method of Mesh.withProp().
val is either a single integer, or a list/array of integers.
The return value is a Mesh holding all the elements that do not
have the property val, resp. one of the values in val.
The returned Mesh inherits the matching properties.

If the Mesh has no properties, a copy with all elements is returned.
"""
ps = self.propSet()
val = checkArray1D(val)
if len(val)==0:
return self
mask = in1d(ar1=ps, ar2=val)
return self.withProp(ps[~mask])
[field #16] Item Group: None
[field #17] Status: None
[field #18] Component Version: None
[field #19] Operating System: None
[field #20] Reproducibility: None
[field #21] Size (loc): None
[field #22] Fixed Release: None
[field #23] Planned Release: None
[field #24] Effort: 0.00
[field #28] Priority: 5 - Normal
[field #31] Percent Complete: 0%
[field #33] Release: None
[field #58] Custom Select Box #1: None
[field #59] Custom Select Box #2: None
[field #60] Custom Select Box #3: None
[field #61] Custom Select Box #4: None
[field #62] Custom Select Box #5: None
[field #63] Custom Select Box #6: None
[field #64] Custom Select Box #7: None
[field #65] Custom Select Box #8: None
[field #66] Custom Select Box #9: None
[field #67] Custom Select Box #10: None

Benedict Verhegghe <bverheg>
Project Administrator
Mon 28 Oct 2013 12:26:50 PM UTC, comment #1:

I think it would be better to create a method whereProp(val) returning the element numbers, and then apply a select/cselect to get the elements. It already exists for a Formex. It could be implemented on Geometry level, and thus work for Formex or Mesh at the same time.

Then withProp could become

or maybe renamed selectProp, or left out completely.
I certainly want to do away with the improperly named withoutProp. selectProp and cselectProp would be consistent.

Benedict Verhegghe <bverheg>
Project Administrator
Mon 28 Oct 2013 12:46:11 PM UTC, original submission:

Mesh.withoutProps fails if val is [] or array([]).
Mesh.withProp works if val is [] or array([]).
Also, to check 'what prop is not in val' we could use
the numpy.in1d instead of a for loop.
Below there is a possible version:

def withoutProp(self, val):
"""Return a Mesh without the elements with property `val`.

This is the complementary method of Mesh.withProp().
val is either a single integer, or a list/array of integers.
The return value is a Mesh holding all the elements that do not
have the property val, resp. one of the values in val.
The returned Mesh inherits the matching properties.

If the Mesh has no properties, a copy with all elements is returned.
"""
ps = self.propSet()
val = checkArray1D(val)
if len(val)==0:
return self
mask = in1d(ar1=ps, ar2=val)
return self.withProp(ps[~mask])

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 13 Nov 2013 11:18:31 AM UTCgianlucadesiStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 28 Oct 2013 12:46:11 PM UTCbverhegReassign itempyFormex, sr #108423=>pyFormex, bug #40394

    Back to the top


    Powered by Savane 3.1-cleanup1