Wed 19 Feb 2014 10:53:40 AM UTC, comment #4:
I have tested the new implementation on my cases (including read/write .pgf) and it works fine!
Two questions:
1) why geometry.addField() and geometry.convertField() do not have an explicit return unlike most pyFormex functions? This makes not possible to concatenate methods.
If an explicit return would be added, the deprecated method Mesh.nodalToElement(VAL) could be directly replaced by
self.addField(fldtype='node',data=VAL,fldname='nval').convertField(fldname='nval',totype='elemc',toname='eval').fields['eval'].data.reshape(-1)
and mesh_ext Mesh.elementToNodal(VAL) by
self.addField(fldtype='elemc',data=eval,fldname='eval').convertField(fldname='eval',totype='node',toname='nval').fields['nval'].data.reshape(-1)
2) to read the fields of a geometry G the user need to write:
utils.formatDict(G.fields)
Could we use something simpler like
print (G.fields) ?
Also, it would be nice to give the fields info (without data) when printing a geometry:
print (G)
Mesh: 8 nodes, 3 elems, plexitude 4, ndim 2, eltype: quad4
BBox: [ 0. 0. 0.], [ 1. 1. 0.]
Size: [ 1. 1. 0.]
nval = Field 'nval', type 'node', shape (8,)
eval = Field 'eval', type 'elemc', shape (3,)
|