~ubuntu-branches/ubuntu/trusty/yade/trusty

« back to all changes in this revision

Viewing changes to py/ymport.py

  • Committer: Package Import Robot
  • Author(s): Anton Gladky, cf3f8d9
  • Date: 2013-10-30 20:56:33 UTC
  • mfrom: (20.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20131030205633-1f01r7hjce17d723
Tags: 1.05.0-2
[cf3f8d9] Pass -ftrack-macro-expansion=0 only if gcc>=4.8. (Closes: #726009)

Show diffs side-by-side

added added

removed removed

Lines of Context:
337
337
                :param float scale: factor scales the given data.
338
338
                :param \*\*kw: (unused keyword arguments) is passed to :yref:`yade.utils.facet`
339
339
                :param bool returnConnectivityTable: if True, apart from facets returns also nodes (list of (x,y,z) nodes coordinates) and elements (list of (id1,id2,id3) element nodes ids). If False (default), returns only facets
340
 
        
341
 
        Example: :ysrc:`examples/test/unv-read/unvRead.py`."""
 
340
        """
342
341
        nodes,elems = [],[]
343
342
        f = open(fileName)
344
343
        for line in f:
345
 
                if line.startswith('134'): # read nodes coordinates
 
344
                if line.startswith('134,'): # read nodes coordinates
346
345
                        ls = line.split(',')
347
346
                        v = Vector3(
348
347
                                float(ls[1])*scale + shift[0],
350
349
                                float(ls[3])*scale + shift[2]
351
350
                        )
352
351
                        nodes.append(v)
353
 
                if line.startswith('136'): # read elements
 
352
                if line.startswith('136,'): # read elements
354
353
                        ls = line.split(',')
355
 
                        i1,i2,i3 = int(ls[3])/2, int(ls[4])/2, int(ls[5])/2 # the numbering of nodes is 1,3,5,7,..., hense this int(ls[*])/2
 
354
                        i1,i2,i3 = int(ls[3])/2, int(ls[4])/2, int(ls[5])/2 # the numbering of nodes is 1,3,5,7,..., hence this int(ls[*])/2
356
355
                        elems.append( (i1,i2,i3) )
357
356
        facets = [utils.facet( ( nodes[e[0]], nodes[e[1]], nodes[e[2]] ), **kw) for e in elems]
358
357
        if returnConnectivityTable: