Changeset 13991
- Timestamp:
- 11/20/12 12:10:23 (12 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
r13984 r13991 25 25 if not os.path.exists(icefrontfile): 26 26 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) 28 28 nodeonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1)) 29 29 else: -
issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
r13984 r13991 27 27 if not os.path.exists(icefrontfile): 28 28 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) 30 30 vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1)) 31 31 else: -
issm/trunk-jpl/src/m/classes/dependent.py
r13984 r13991 45 45 #process the file and retrieve segments 46 46 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) 48 48 # }}} 49 49 -
issm/trunk-jpl/src/m/classes/model/model.py
r13984 r13991 361 361 #recreate segments 362 362 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) 364 364 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) 366 366 md2.mesh.elementconnectivity=md2.mesh.elementconnectivity.astype(int) 367 367 md2.mesh.segments=contourenvelope(md2) … … 370 370 else: 371 371 #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) 373 373 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) 375 375 md2.mesh.elementconnectivity=md2.mesh.elementconnectivity.astype(int) 376 376 md2.mesh.segments=contourenvelope(md2) … … 379 379 md2.mesh.vertexonboundary=numpy.tile(md2.mesh.vertexonboundary,md2.mesh.numberoflayers) 380 380 #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) 382 382 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) 384 384 md2.mesh.elementconnectivity=md2.mesh.elementconnectivity.astype(int) 385 385 -
issm/trunk-jpl/src/m/geometry/FlagElements.py
r13984 r13991 43 43 raise RuntimeError("FlagElements.py calling basinzoom.py is not complete.") 44 44 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) 47 47 else: 48 48 #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) 50 50 flag=flag.astype(bool) 51 51 -
issm/trunk-jpl/src/m/mesh/bamg.py
r13984 r13991 276 276 else: 277 277 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)))) 279 279 280 280 if isinstance(md.rifts.riftstruct,dict): -
issm/trunk-jpl/src/m/mesh/meshconvert.py
r13984 r13991 27 27 28 28 #call Bamg 29 bamgmesh_out,bamggeom_out=BamgConvertMesh(index .astype(float),x,y)29 bamgmesh_out,bamggeom_out=BamgConvertMesh(index,x,y) 30 30 31 31 # plug results onto model -
issm/trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py
r13984 r13991 16 16 17 17 #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) 19 19 20 20 tips=rift.tips -
issm/trunk-jpl/src/m/mesh/rifts/meshprocessrifts.py
r13984 r13991 22 22 23 23 #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) 25 25 md.mesh.elements=md.mesh.elements.astype(int) 26 26 md.mesh.x=md.mesh.x.reshape(-1) … … 49 49 50 50 #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) 52 52 found=0 53 53 for rift in md.rifts.riftstruct: -
issm/trunk-jpl/src/m/mesh/triangle.py
r13984 r13991 60 60 61 61 #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) 63 63 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) 65 65 md.mesh.elementconnectivity=md.mesh.elementconnectivity.astype(int) 66 66 -
issm/trunk-jpl/src/m/parameterization/contourenvelope.py
r13984 r13991 40 40 #Computing connectivity 41 41 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) 43 43 md.mesh.vertexconnectivity=md.mesh.vertexconnectivity.astype(int) 44 44 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) 46 46 md.mesh.elementconnectivity=md.mesh.elementconnectivity.astype(int) 47 47 … … 65 65 if isfile: 66 66 #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) 68 68 elemin=(numpy.sum(nodein(mesh.elements),axis=1)==numpy.size(mesh.elements,axis=1)) 69 69 #modify element connectivity … … 90 90 if len(args)==1: 91 91 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) 93 93 94 94 #Find segments on boundary
Note:
See TracChangeset
for help on using the changeset viewer.