bugpyFormex - Bugs: bug #45382, drawField gives wrong colors for...

 
 

bug #45382: drawField gives wrong colors for nodal fields

Submitter:  gianluca de santis <gianlucadesi>
Submitted:  Tue 23 Jun 2015 03:00:15 PM UTC
   
 
Category:  Rendering Severity:  2 - Minor
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 23 Jun 2015 07:23:53 PM UTC, comment #2: 

Sounds very reasonable. There is one catch though: the Field documentation states that the geometry can be a Formex or a Mesh.
Then using fld.geometry.elems would be problematic.

However, the Field defined on Formex seems to be not implemented (yet). A pyformex search for 'fieldtype' gives


pysea fieldtype
SEARCH = [fieldtype]
pyformex/field.py:        if not hasattr(geometry,'fieldtypes') or fldtype not in geometry.fieldtypes:
pyformex/field.py:        if totype in self.geometry.fieldtypes:
pyformex/geometry.py:        if not hasattr(self,'fieldtypes') or fldtype not in self.fieldtypes:
pyformex/mesh.py:    fieldtypes = ['node','elemc','elemn']


Then the Formex field, if/when implemented should be, as already documented, only of type 'elemc' or 'elemn' (or other elem...).
As the Formex has no info about element coherence, it can not accept data on fused nodes. Thus it would be save to just test for the fieldtype 'node' and expect geometry.elems to exist.
Though we should watch out if we implement other data models.

Finally, there is already use of geometry.elems in the implementation of the Field.convert method. It is there twice: in the conversion from 'node' type to another, and the convert from another to 'node' type. By the same reasoning as above, it can not go wrong, if Formex does not have the 'node' in its
fieldtypes.

So I implemented this in c129817.
And added it to the FieldDraw example.

Benedict Verhegghe <bverheg>
Group administrator
Tue 23 Jun 2015 03:12:46 PM UTC, comment #1: 

In addition to nodal fields we could also the name of the field using drawtext on top of the color legend

gianluca de santis <gianlucadesi>
Group Member
Tue 23 Jun 2015 03:00:15 PM UTC, original submission:  

In opengl.draw.py there is drawfield(), which is used in the example FieldDraw.py

The plot is wrong if the fld is nodal
You can see this replacing in the example:

drawField(M.getField('dist'))


One solution would be to let the drawfield() check what type of field (fld.fldtype) and if the fldtype is nodal:

draw(fld.geometry, color=cval[fld.geometry.elems])

gianluca de santis <gianlucadesi>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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
    2015-09-15 gianlucadesi StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code