Changeset 13991


Ignore:
Timestamp:
11/20/12 12:10:23 (12 years ago)
Author:
jschierm
Message:

CHG: Eliminate conversion of python int and bool before module input.

Location:
issm/trunk-jpl/src/m
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py

    r13984 r13991  
    2525                if not os.path.exists(icefrontfile):
    2626                        raise IOError("SetIceShelfBC error message: ice front file '%s' not found." % icefrontfile)
    27                 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements.astype(float),md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2)
     27                [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements,md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2)
    2828                nodeonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1))
    2929        else:
  • issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py

    r13984 r13991  
    2727                if not os.path.exists(icefrontfile):
    2828                        raise IOError("SetMarineIceSheetBC error message: ice front file '%s' not found." % icefrontfile)
    29                 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements.astype(float),md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2)
     29                [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements,md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2)
    3030                vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1))
    3131        else:
  • issm/trunk-jpl/src/m/classes/dependent.py

    r13984 r13991  
    4545                        #process the file and retrieve segments
    4646                        mesh=options.getfieldvalue('mesh')
    47                         self.segments=MeshProfileIntersection(mesh.elements.astype(float),mesh.x,mesh.y,self.exp)
     47                        self.segments=MeshProfileIntersection(mesh.elements,mesh.x,mesh.y,self.exp)
    4848        # }}}
    4949
  • issm/trunk-jpl/src/m/classes/model/model.py

    r13984 r13991  
    361361                #recreate segments
    362362                if md1.mesh.dimension==2:
    363                         [md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements.astype(float),md2.mesh.numberofvertices)
     363                        [md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices)
    364364                        md2.mesh.vertexconnectivity=md2.mesh.vertexconnectivity.astype(int)
    365                         [md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements.astype(float),md2.mesh.vertexconnectivity.astype(float))
     365                        [md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements,md2.mesh.vertexconnectivity)
    366366                        md2.mesh.elementconnectivity=md2.mesh.elementconnectivity.astype(int)
    367367                        md2.mesh.segments=contourenvelope(md2)
     
    370370                else:
    371371                        #First do the connectivity for the contourenvelope in 2d
    372                         [md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements2d.astype(float),md2.mesh.numberofvertices2d)
     372                        [md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d)
    373373                        md2.mesh.vertexconnectivity=md2.mesh.vertexconnectivity.astype(int)
    374                         [md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements2d.astype(float),md2.mesh.vertexconnectivity.astype(float))
     374                        [md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity)
    375375                        md2.mesh.elementconnectivity=md2.mesh.elementconnectivity.astype(int)
    376376                        md2.mesh.segments=contourenvelope(md2)
     
    379379                        md2.mesh.vertexonboundary=numpy.tile(md2.mesh.vertexonboundary,md2.mesh.numberoflayers)
    380380                        #Then do it for 3d as usual
    381                         [md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements.astype(float),md2.mesh.numberofvertices)
     381                        [md2.mesh.vertexconnectivity]=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices)
    382382                        md2.mesh.vertexconnectivity=md2.mesh.vertexconnectivity.astype(int)
    383                         [md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements.astype(float),md2.mesh.vertexconnectivity.astype(float))
     383                        [md2.mesh.elementconnectivity]=ElementConnectivity(md2.mesh.elements,md2.mesh.vertexconnectivity)
    384384                        md2.mesh.elementconnectivity=md2.mesh.elementconnectivity.astype(int)
    385385
  • issm/trunk-jpl/src/m/geometry/FlagElements.py

    r13984 r13991  
    4343                                raise RuntimeError("FlagElements.py calling basinzoom.py is not complete.")
    4444                                xlim,ylim=basinzoom('basin',region)
    45                                 flag_nodes=numpy.logical_and(numpy.logical_and(md.mesh.x<xlim[1],md.mesh.x>xlim[0]),numpy.logical_and(md.mesh.y<ylim[1],md.mesh.y>ylim[0])).astype(float)
    46                                 flag=numpy.prod(flag_nodes[md.mesh.elements],axis=1).astype(bool)
     45                                flag_nodes=numpy.logical_and(numpy.logical_and(md.mesh.x<xlim[1],md.mesh.x>xlim[0]),numpy.logical_and(md.mesh.y<ylim[1],md.mesh.y>ylim[0]))
     46                                flag=numpy.prod(flag_nodes[md.mesh.elements].astype(float),axis=1).astype(bool)
    4747                        else:
    4848                                #ok, flag elements
    49                                 [flag,dum]=ContourToMesh(md.mesh.elements[:,0:3].astype(float),md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),region,'element',1)
     49                                [flag,dum]=ContourToMesh(md.mesh.elements[:,0:3],md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),region,'element',1)
    5050                                flag=flag.astype(bool)
    5151
  • issm/trunk-jpl/src/m/mesh/bamg.py

    r13984 r13991  
    276276                else:
    277277                        bamg_mesh.Vertices=numpy.hstack((md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),numpy.ones((md.mesh.numberofvertices,1))))
    278                         bamg_mesh.Triangles=numpy.hstack((md.mesh.elements.astype(float),numpy.ones((md.mesh.numberofelements,1))))
     278                        bamg_mesh.Triangles=numpy.hstack((md.mesh.elements,numpy.ones((md.mesh.numberofelements,1))))
    279279
    280280                if isinstance(md.rifts.riftstruct,dict):
  • issm/trunk-jpl/src/m/mesh/meshconvert.py

    r13984 r13991  
    2727
    2828        #call Bamg
    29         bamgmesh_out,bamggeom_out=BamgConvertMesh(index.astype(float),x,y)
     29        bamgmesh_out,bamggeom_out=BamgConvertMesh(index,x,y)
    3030
    3131        # plug results onto model
  • issm/trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py

    r13984 r13991  
    1616       
    1717                #first, flag nodes that belong to the domain outline
    18                 flags=ContourToMesh(md.mesh.elements.astype(float),md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),domainoutline,'node',0)
     18                flags=ContourToMesh(md.mesh.elements,md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),domainoutline,'node',0)
    1919
    2020                tips=rift.tips
  • issm/trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py

    r13984 r13991  
    2222
    2323        #Call MEX file
    24         [md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers,md.rifts.riftstruct]=TriMeshProcessRifts(md.mesh.elements.astype(float),md.mesh.x,md.mesh.y,md.mesh.segments.astype(float),md.mesh.segmentmarkers.astype(float))
     24        [md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers,md.rifts.riftstruct]=TriMeshProcessRifts(md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers)
    2525        md.mesh.elements=md.mesh.elements.astype(int)
    2626        md.mesh.x=md.mesh.x.reshape(-1)
     
    4949
    5050        #In case we have rifts that open up the domain outline, we need to open them:
    51         [flags,dum]=ContourToMesh(md.mesh.elements.astype(float),md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),domainoutline,'node',0)
     51        [flags,dum]=ContourToMesh(md.mesh.elements,md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),domainoutline,'node',0)
    5252        found=0
    5353        for rift in md.rifts.riftstruct:
  • issm/trunk-jpl/src/m/mesh/triangle.py

    r13984 r13991  
    6060
    6161        #Now, build the connectivity tables for this mesh.
    62         [md.mesh.vertexconnectivity]= NodeConnectivity(md.mesh.elements.astype(float), md.mesh.numberofvertices)
     62        [md.mesh.vertexconnectivity]= NodeConnectivity(md.mesh.elements, md.mesh.numberofvertices)
    6363        md.mesh.vertexconnectivity=md.mesh.vertexconnectivity.astype(int)
    64         [md.mesh.elementconnectivity] = ElementConnectivity(md.mesh.elements.astype(float), md.mesh.vertexconnectivity.astype(float))
     64        [md.mesh.elementconnectivity] = ElementConnectivity(md.mesh.elements, md.mesh.vertexconnectivity)
    6565        md.mesh.elementconnectivity=md.mesh.elementconnectivity.astype(int)
    6666
  • issm/trunk-jpl/src/m/parameterization/contourenvelope.py

    r13984 r13991  
    4040        #Computing connectivity
    4141        if numpy.size(md.mesh.vertexconnectivity,axis=0)!=md.mesh.numberofvertices and numpy.size(md.mesh.vertexconnectivity,axis=0)!=md.mesh.numberofvertices2d:
    42                 [md.mesh.vertexconnectivity]=NodeConnectivity(md.mesh.elements.astype(float),md.mesh.numberofvertices)
     42                [md.mesh.vertexconnectivity]=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices)
    4343                md.mesh.vertexconnectivity=md.mesh.vertexconnectivity.astype(int)
    4444        if numpy.size(md.mesh.elementconnectivity,axis=0)!=md.mesh.numberofelements and numpy.size(md.mesh.elementconnectivity,axis=0)!=md.mesh.numberofelements2d:
    45                 [md.mesh.elementconnectivity]=ElementConnectivity(md.mesh.elements.astype(float),md.mesh.vertexconnectivity.astype(float))
     45                [md.mesh.elementconnectivity]=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity)
    4646                md.mesh.elementconnectivity=md.mesh.elementconnectivity.astype(int)
    4747
     
    6565                if isfile:
    6666                        #get flag list of elements and nodes inside the contour
    67                         nodein=ContourToMesh(mesh.elements.astype(float),mesh.x,mesh.y,file,'node',1)
     67                        nodein=ContourToMesh(mesh.elements,mesh.x,mesh.y,file,'node',1)
    6868                        elemin=(numpy.sum(nodein(mesh.elements),axis=1)==numpy.size(mesh.elements,axis=1))
    6969                        #modify element connectivity
     
    9090        if len(args)==1:
    9191                flag[numpy.nonzero(flag)]=elemin[flag[numpy.nonzero(flag)]]
    92         elementonboundary=numpy.logical_and(numpy.prod(flag,axis=1)==0,numpy.sum(flag,axis=1)>0).astype(float)
     92        elementonboundary=numpy.logical_and(numpy.prod(flag,axis=1)==0,numpy.sum(flag,axis=1)>0)
    9393
    9494        #Find segments on boundary
Note: See TracChangeset for help on using the changeset viewer.