Changeset 17480
- Timestamp:
- 03/19/14 18:29:13 (11 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py ¶
r17071 r17480 1 1 import os 2 2 import numpy 3 from ContourToMesh import *3 from ContourToMesh import ContourToMesh 4 4 5 5 def SetIceSheetBC(md): -
TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py ¶
r17071 r17480 1 1 import os 2 2 import numpy 3 from ContourToMesh import *4 from MatlabFuncs import * 3 from ContourToMesh import ContourToMesh 4 import MatlabFuncs as m 5 5 6 6 def SetIceShelfBC(md,icefrontfile=''): … … 44 44 45 45 #First find segments that are not completely on the front 46 if strcmp(md.mesh.meshtype(),'3D'):46 if m.strcmp(md.mesh.meshtype(),'3D'): 47 47 numbernodesfront=4; 48 elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):48 elif m.strcmp(md.mesh.meshtype(),'2Dhorizontal'): 49 49 numbernodesfront=2; 50 50 else: -
TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py ¶
r17477 r17480 1 1 import os 2 2 import numpy 3 from ContourToMesh import *4 from MatlabFuncs import * 3 from ContourToMesh import ContourToMesh 4 import MatlabFuncs as m 5 5 6 6 def SetMarineIceSheetBC(md,icefrontfile=''): … … 53 53 54 54 #First find segments that are not completely on the front 55 if not strcmp(md.mesh.meshtype(),'3D'):55 if not m.strcmp(md.mesh.meshtype(),'3D'): 56 56 numbernodesfront=2 57 57 else: -
TabularUnified issm/trunk-jpl/src/m/classes/clusters/generic.py ¶
r17264 r17480 1 1 import socket 2 import os 2 3 import math 3 4 import subprocess 4 5 from IssmConfig import IssmConfig 5 6 from EnumToString import EnumToString 6 from issmdir import *7 from pairoptions import *8 from issmssh import *9 from issmscpin import *10 from issmscpout import *11 from MatlabFuncs import * 7 from issmdir import issmdir 8 from pairoptions import pairoptions 9 from issmssh import issmssh 10 from issmscpin import issmscpin 11 from issmscpout import issmscpout 12 import MatlabFuncs as m 12 13 13 14 class generic(object): … … 37 38 38 39 #get name 39 self.name= gethostname()40 self.name=socket.gethostname() 40 41 41 42 #initialize cluster using user settings if provided … … 71 72 72 73 #write queuing script 73 if not ispc():74 if not m.ispc(): 74 75 75 76 fid=open(modelname+'.queue','w') … … 123 124 124 125 #write queuing script 125 if not ispc():126 if not m.ispc(): 126 127 127 128 fid=open(modelname+'.queue','w') … … 181 182 def Download(self,dirname,filelist): # {{{ 182 183 183 if ispc():184 if m.ispc(): 184 185 #do nothing 185 186 return -
TabularUnified issm/trunk-jpl/src/m/classes/damage.py ¶
r17401 r17480 2 2 from EnumDefinitions import * 3 3 from StringToEnum import StringToEnum 4 from checkfield import * 5 from WriteData import * 4 from checkfield import checkfield 5 from WriteData import WriteData 6 import MatlabFuncs as m 6 7 7 8 class damage(object): … … 109 110 def defaultoutputs(self,md): # {{{ 110 111 111 if strcmp(md.mesh.meshtype(),'3D'):112 if m.strcmp(md.mesh.meshtype(),'3D'): 112 113 list = ['DamageD'] 113 elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):114 elif m.strcmp(md.mesh.meshtype(),'2Dhorizontal'): 114 115 list = ['DamageD'] 115 elif strcmp(md.mesh.meshtype(),'2Dvertical'):116 elif m.strcmp(md.mesh.meshtype(),'2Dvertical'): 116 117 list = ['DamageD'] 117 118 else: … … 143 144 md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0,1]) 144 145 md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1) 145 elif strcmpi(self.law,'undamaged'):146 elif m.strcmpi(self.law,'undamaged'): 146 147 if (solution==DamageEvolutionSolutionEnum): 147 148 raise RuntimeError('Invalid evolution law (md.damage.law) for a damage solution') -
TabularUnified issm/trunk-jpl/src/m/classes/dependent.py ¶
r14640 r17480 1 1 import os.path 2 2 import numpy 3 from pairoptions import *4 from fielddisplay import *5 from MatlabFuncs import * 3 from pairoptions import pairoptions 4 from fielddisplay import fielddisplay 5 import MatlabFuncs as m 6 6 from EnumDefinitions import * 7 from WriteData import * 8 from MeshProfileIntersection import * 7 from MeshProfileIntersection import MeshProfileIntersection 9 8 10 9 class dependent(object): -
TabularUnified issm/trunk-jpl/src/m/classes/flowequation.py ¶
r17151 r17480 3 3 from fielddisplay import fielddisplay 4 4 from EnumDefinitions import * 5 from checkfield import * 6 from WriteData import * 5 from checkfield import checkfield 6 from WriteData import WriteData 7 import MatlabFuncs as m 7 8 8 9 class flowequation(object): … … 79 80 md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices],'values',[0,1]) 80 81 md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices],'values',[0,1]) 81 if strcmp(md.mesh.meshtype(),'2Dhorizontal'):82 if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'): 82 83 md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',[1,2]) 83 84 md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',[1,2]) 84 elif strcmp(md.mesh.meshtype(),'3D'):85 elif m.strcmp(md.mesh.meshtype(),'3D'): 85 86 md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices],'values',numpy.arange(0,8+1)) 86 87 md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements],'values',numpy.arange(0,8+1)) -
TabularUnified issm/trunk-jpl/src/m/classes/groundingline.py ¶
r17037 r17480 3 3 from EnumDefinitions import * 4 4 from StringToEnum import StringToEnum 5 from checkfield import *6 from WriteData import *7 from MatlabFuncs import * 5 from checkfield import checkfield 6 from WriteData import WriteData 7 import MatlabFuncs as m 8 8 9 9 class groundingline(object): … … 44 44 md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2']) 45 45 46 if not strcmp(self.migration,'None'):46 if not m.strcmp(self.migration,'None'): 47 47 if numpy.any(numpy.isnan(md.geometry.bathymetry)): 48 48 md.checkmessage("requesting grounding line migration, but bathymetry is absent!") -
TabularUnified issm/trunk-jpl/src/m/classes/independent.py ¶
r16815 r17480 1 1 import numpy 2 from pairoptions import *3 from fielddisplay import *4 from MatlabFuncs import * 2 from pairoptions import pairoptions 3 from fielddisplay import fielddisplay 4 import MatlabFuncs as m 5 5 from EnumDefinitions import * 6 from WriteData import *7 6 8 7 class independent(object): -
TabularUnified issm/trunk-jpl/src/m/classes/initialization.py ¶
r16764 r17480 2 2 from fielddisplay import fielddisplay 3 3 from EnumDefinitions import * 4 from checkfield import * 5 from WriteData import * 4 from checkfield import checkfield 5 from WriteData import WriteData 6 import MatlabFuncs as m 6 7 7 8 class initialization(object): … … 65 66 md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices]) 66 67 md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices]) 67 if strcmp(md.mesh.meshtype(),'3D'):68 if m.strcmp(md.mesh.meshtype(),'3D'): 68 69 md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices]) 69 70 md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices]) -
TabularUnified issm/trunk-jpl/src/m/classes/mesh.py ¶
r16764 r17480 2 2 from fielddisplay import fielddisplay 3 3 from EnumDefinitions import * 4 from checkfield import * 5 from MatlabFuncs import * 4 from checkfield import checkfield 5 import MatlabFuncs as m 6 from WriteData import WriteData 6 7 7 8 class mesh(object): … … 131 132 else: 132 133 md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,6]) 133 if numpy.any(numpy.logical_not( ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):134 if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))): 134 135 md.checkmessage("orphan nodes have been found. Check the mesh outline") 135 136 md = checkfield(md,'fieldname','mesh.dimension','values',[2,3]) -
TabularUnified issm/trunk-jpl/src/m/classes/mesh2d.py ¶
r16764 r17480 2 2 from fielddisplay import fielddisplay 3 3 from EnumDefinitions import * 4 from checkfield import *5 from MatlabFuncs import * 4 from checkfield import checkfield 5 import MatlabFuncs as m 6 6 7 7 class mesh2d(object): … … 88 88 md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1)) 89 89 md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3]) 90 if numpy.any(numpy.logical_not( ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):90 if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))): 91 91 md.checkmessage("orphan nodes have been found. Check the mesh outline") 92 92 md = checkfield(md,'fieldname','mesh.numberofelements','>',0) -
TabularUnified issm/trunk-jpl/src/m/classes/pairoptions.py ¶
r15331 r17480 1 1 from collections import OrderedDict 2 from WriteData import *2 from WriteData import WriteData 3 3 4 4 class pairoptions(object): -
TabularUnified issm/trunk-jpl/src/m/classes/plotoptions.py ¶
r15331 r17480 1 1 from collections import OrderedDict, Counter, defaultdict 2 from pairoptions import * 2 import pairoptions 3 3 4 4 class plotoptions(object): -
TabularUnified issm/trunk-jpl/src/m/classes/qmu.py ¶
r16304 r17480 3 3 from fielddisplay import fielddisplay 4 4 from EnumDefinitions import * 5 from checkfield import *6 from WriteData import *7 from MatlabFuncs import * 5 from checkfield import checkfield 6 from WriteData import WriteData 7 import MatlabFuncs as m 8 8 9 9 class qmu(object): … … 56 56 md.checkmessage("for qmu analysis, partitioning vector cannot go over npart, number of partition areas") 57 57 58 if not strcmpi(md.cluster.name,'none'):58 if not m.strcmpi(md.cluster.name,'none'): 59 59 if not md.settings.waitonlock: 60 60 md.checkmessage("waitonlock should be activated when running qmu in parallel mode!") -
TabularUnified issm/trunk-jpl/src/m/classes/results.py ¶
r15131 r17480 1 1 import numpy 2 from pairoptions import *3 from fielddisplay import *4 from MatlabFuncs import * 2 from pairoptions import pairoptions 3 from fielddisplay import fielddisplay 4 import MatlabFuncs as m 5 5 from EnumDefinitions import * 6 from WriteData import *7 6 8 7 class results(object): -
TabularUnified issm/trunk-jpl/src/m/classes/stressbalance.py ¶
r16764 r17480 4 4 from fielddisplay import fielddisplay 5 5 from EnumDefinitions import * 6 from checkfield import *7 from WriteData import *8 from MatlabFuncs import * 6 from checkfield import checkfield 7 from WriteData import WriteData 8 import MatlabFuncs as m 9 9 10 10 class stressbalance(object): … … 110 110 def defaultoutputs(self,md): # {{{ 111 111 112 if strcmp(md.mesh.meshtype(),'3D'):112 if m.strcmp(md.mesh.meshtype(),'3D'): 113 113 list = ['Vx','Vy','Vz','Vel','Pressure'] 114 elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):114 elif m.strcmp(md.mesh.meshtype(),'2Dhorizontal'): 115 115 list = ['Vx','Vy','Vel','Pressure'] 116 elif strcmp(md.mesh.meshtype(),'2Dvertical'):116 elif m.strcmp(md.mesh.meshtype(),'2Dvertical'): 117 117 list = ['Vx','Vy','Vel','Pressure'] 118 118 else: … … 129 129 md = checkfield(md,'fieldname','stressbalance.spcvx','forcing',1) 130 130 md = checkfield(md,'fieldname','stressbalance.spcvy','forcing',1) 131 if strcmp(md.mesh.meshtype(),'3D'):131 if m.strcmp(md.mesh.meshtype(),'3D'): 132 132 md = checkfield(md,'fieldname','stressbalance.spcvz','forcing',1) 133 133 md = checkfield(md,'fieldname','stressbalance.restol','size',[1],'>',0) … … 161 161 md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal") 162 162 #CHECK THAT NO rotation specified for FS Grounded ice at base 163 if strcmp(md.mesh.meshtype(),'3D') and md.flowequation.isFS:163 if m.strcmp(md.mesh.meshtype(),'3D') and md.flowequation.isFS: 164 164 pos=numpy.nonzero(numpy.logical_and(md.mask.groundedice_levelset,md.mesh.vertexonbed)) 165 165 if numpy.any(numpy.logical_not(numpy.isnan(md.stressbalance.referential[pos,:]))): -
TabularUnified issm/trunk-jpl/src/m/classes/toolkits.py ¶
r16192 r17480 1 1 from IssmConfig import IssmConfig 2 from mumpsoptions import *3 from iluasmoptions import *2 from mumpsoptions import mumpsoptions 3 from iluasmoptions import iluasmoptions 4 4 from EnumToString import EnumToString 5 5 from fielddisplay import fielddisplay 6 6 from EnumDefinitions import * 7 from checkfield import * 8 from MatlabFuncs import * 7 from checkfield import checkfield 9 8 10 9 class toolkits(object): -
TabularUnified issm/trunk-jpl/src/m/classes/verbose.py ¶
r15131 r17480 1 from pairoptions import *2 from MatlabFuncs import * 1 from pairoptions import pairoptions 2 import MatlabFuncs as m 3 3 from EnumDefinitions import * 4 from WriteData import *4 from WriteData import WriteData 5 5 6 6 class verbose(object): -
TabularUnified issm/trunk-jpl/src/m/consistency/checkfield.py ¶
r16764 r17480 1 1 import numpy 2 2 import os 3 from pairoptions import *4 from MatlabFuncs import * 3 from pairoptions import pairoptions 4 import MatlabFuncs as m 5 5 6 6 def checkfield(md,*args): … … 107 107 if options.exist('values'): 108 108 fieldvalues=options.getfieldvalue('values') 109 if False in ismember(field,fieldvalues):109 if False in m.ismember(field,fieldvalues): 110 110 if len(fieldvalues)==1: 111 111 md = md.checkmessage(options.getfieldvalue('message',\ -
TabularUnified issm/trunk-jpl/src/m/contrib/bamg/YamsCall.py ¶
r15749 r17480 3 3 import subprocess 4 4 import os 5 from ComputeHessian import * 6 from ComputeMetric import * 7 from MatlabFuncs import * 5 from ComputeHessian import ComputeHessian 6 from ComputeMetric import ComputeMetric 8 7 9 8 def YamsCall(md,field,hmin,hmax,gradation,epsilon): … … 85 84 #call yams 86 85 print "%s\n" % ' call Yams...' 87 if ispc():86 if m.ispc(): 88 87 #windows 89 88 subprocess.call('yams2-win -O 1 -v -0 -ecp -hgrad %g carre0 carre1' % gradation,shell=True) -
TabularUnified issm/trunk-jpl/src/m/exp/expcoarsen.py ¶
r16102 r17480 2 2 import numpy as npy 3 3 from collections import OrderedDict 4 from MatlabFuncs import *5 4 from expread import expread 6 5 from expwrite import expwrite -
TabularUnified issm/trunk-jpl/src/m/exp/expread.py ¶
r13341 r17480 2 2 import numpy 3 3 from collections import OrderedDict 4 from MatlabFuncs import * 4 import MatlabFuncs as m 5 5 6 6 def expread(filename): … … 48 48 break 49 49 A=A.split(None,1) 50 if not (len(A) == 2 and strcmp(A[0],'##') and strncmp(A[1],'Name:',5)):50 if not (len(A) == 2 and m.strcmp(A[0],'##') and strncmp(A[1],'Name:',5)): 51 51 break 52 52 if len(A[1])>5: … … 57 57 #Get Icon 58 58 A=fid.readline().split(None,1) 59 if not (len(A) == 2 and strcmp(A[0],'##') and strncmp(A[1],'Icon:',5)):59 if not (len(A) == 2 and m.strcmp(A[0],'##') and strncmp(A[1],'Icon:',5)): 60 60 break 61 61 62 62 #Get Info 63 63 A=fid.readline().split() 64 if not (len(A) == 4 and strcmp(A[0],'#') andstrcmp(A[1],'Points')):64 if not (len(A) == 4 and m.strcmp(A[0],'#') and m.strcmp(A[1],'Points')): 65 65 break 66 66 … … 72 72 #Get Info 73 73 A=fid.readline().split() 74 if not (len(A) == 5 and strcmp(A[0],'#') and strcmp(A[1],'X') andstrcmp(A[2],'pos') \75 and strcmp(A[3],'Y') andstrcmp(A[4],'pos')):74 if not (len(A) == 5 and m.strcmp(A[0],'#') and m.strcmp(A[1],'X') and m.strcmp(A[2],'pos') \ 75 and m.strcmp(A[3],'Y') and m.strcmp(A[4],'pos')): 76 76 break 77 77 -
TabularUnified issm/trunk-jpl/src/m/extrusion/project3d.py ¶
r17465 r17480 1 1 import numpy 2 from pairoptions import *3 from MatlabFuncs import * 2 from pairoptions import pairoptions 3 import MatlabFuncs as m 4 4 5 5 def project3d(md,*args): … … 27 27 if not md: 28 28 raise TypeError("bad usage") 29 if not strcmp(md.mesh.meshtype(),'3D'):29 if not m.strcmp(md.mesh.meshtype(),'3D'): 30 30 raise TypeError("input model is not 3d") 31 31 … … 45 45 projected_vector=vector2d 46 46 47 elif strcmpi(type,'node'):47 elif m.strcmpi(type,'node'): 48 48 49 49 #Initialize 3d vector … … 64 64 projected_vector[((layer-1)*md.mesh.numberofvertices2d):(layer*md.mesh.numberofvertices2d),:]=vector2d 65 65 66 elif strcmpi(type,'element'):66 elif m.strcmpi(type,'element'): 67 67 68 68 #Initialize 3d vector -
TabularUnified issm/trunk-jpl/src/m/geometry/FlagElements.py ¶
r15998 r17480 1 1 import numpy 2 2 import os 3 #from basinzoom import *4 from ContourToMesh import *5 from MatlabFuncs import * 6 from PythonFuncs import * 3 #from basinzoom import basinzoon 4 from ContourToMesh import ContourToMesh 5 import MatlabFuncs as m 6 import PythonFuncs as p 7 7 8 8 def FlagElements(md,region): … … 26 26 flag=numpy.zeros(md.mesh.numberofelements,bool) 27 27 invert=0 28 elif strcmpi(region,'all'):28 elif m.strcmpi(region,'all'): 29 29 flag=numpy.ones(md.mesh.numberofelements,bool) 30 30 invert=0 31 31 else: 32 32 #make sure that we actually don't want the elements outside the domain outline! 33 if strcmpi(region[0],'~'):33 if m.strcmpi(region[0],'~'): 34 34 region=region[1:] 35 35 invert=1 … … 39 39 #does the region domain outline exist or do we have to look for xlim,ylim in basinzoom? 40 40 if not os.path.exists(region): 41 if len(region)>3 and not strcmp(region[-4:],'.exp'):41 if len(region)>3 and not m.strcmp(region[-4:],'.exp'): 42 42 raise IOError("Error: File 'region' not found!" % region) 43 43 raise RuntimeError("FlagElements.py calling basinzoom.py is not complete.") 44 44 xlim,ylim=basinzoom('basin',region) 45 flag_nodes= logical_and_n(md.mesh.x<xlim[1],md.mesh.x>xlim[0],md.mesh.y<ylim[1],md.mesh.y>ylim[0])45 flag_nodes=p.logical_and_n(md.mesh.x<xlim[1],md.mesh.x>xlim[0],md.mesh.y<ylim[1],md.mesh.y>ylim[0]) 46 46 flag=numpy.prod(flag_nodes[md.mesh.elements],axis=1).astype(bool) 47 47 else: -
TabularUnified issm/trunk-jpl/src/m/mesh/ComputeHessian.py ¶
r13984 r17480 1 1 import numpy 2 from GetNodalFunctionsCoeff import *3 from GetAreas import *4 from MatlabFuncs import * 2 from GetNodalFunctionsCoeff import GetNodalFunctionsCoeff 3 from GetAreas import GetAreas 4 import MatlabFuncs as m 5 5 6 6 def ComputeHessian(index,x,y,field,type): … … 26 26 if numpy.size(field)!=numberofnodes and numpy.size(field)!=numberofelements: 27 27 raise TypeError("ComputeHessian error message: the given field size not supported yet") 28 if not strcmpi(type,'node') and notstrcmpi(type,'element'):28 if not m.strcmpi(type,'node') and not m.strcmpi(type,'element'): 29 29 raise TypeError("ComputeHessian error message: only 'node' or 'element' type supported yet") 30 30 … … 57 57 hessian=numpy.hstack((numpy.sum(gradx[index-1,0]*alpha,axis=1).reshape(-1,1),numpy.sum(grady[index-1,0]*alpha,axis=1).reshape(-1,1),numpy.sum(grady[index-1,0]*beta,axis=1).reshape(-1,1))) 58 58 59 if strcmpi(type,'node'):59 if m.strcmpi(type,'node'): 60 60 #Compute Hessian on the nodes (average of the elements around) 61 61 hessian=numpy.hstack((sparse(line,numpy.ones((linesize,1)),numpy.tile((areas*hessian[:,0]).reshape(-1,1),(3,1)),numberofnodes,1)/weights, \ -
TabularUnified issm/trunk-jpl/src/m/mesh/bamg.py ¶
r16967 r17480 2 2 import numpy 3 3 from collections import OrderedDict 4 from pairoptions import *5 from bamggeom import *6 from bamgmesh import *7 from expread import *8 from expwrite import *9 from SegIntersect import *10 from MatlabFuncs import * 11 from BamgMesher import *12 from ContourToNodes import *4 from pairoptions import pairoptions 5 from bamggeom import bamggeom 6 from bamgmesh import bamgmesh 7 from expread import expread 8 from expwrite import expwrite 9 from SegIntersect import SegIntersect 10 import MatlabFuncs as m 11 from BamgMesher import BamgMesher 12 from ContourToNodes import ContourToNodes 13 13 14 14 def bamg(md,*args): … … 374 374 375 375 #Skip if the two edges already have a vertex in common 376 if any( ismember(geom.Edges[i,0:2],geom.Edges[j,0:2])):376 if any(m.ismember(geom.Edges[i,0:2],geom.Edges[j,0:2])): 377 377 continue 378 378 … … 471 471 472 472 %update edges 473 posedges=find( ismember(geom.Edges,j));473 posedges=find(m.ismember(geom.Edges,j)); 474 474 geom.Edges(posedges)=i; 475 475 posedges=find(geom.Edges>j); -
TabularUnified issm/trunk-jpl/src/m/mesh/rifts/meshprocessoutsiderifts.py ¶
r14098 r17480 1 1 import numpy 2 from ElementsFromEdge import *3 from MatlabFuncs import * 2 from ElementsFromEdge import ElementsFromEdge 3 import MatlabFuncs as m 4 4 5 5 def meshprocessoutsiderifts(md,domainoutline): … … 47 47 edgeelements=ElementsFromEdge(md.mesh.elements,A,B) 48 48 #rule out those we already detected 49 already_detected= ismember(edgeelements,elements)49 already_detected=m.ismember(edgeelements,elements) 50 50 nextelement=edgeelements(numpy.nonzero(numpy.logical_not(already_detected))[0]) 51 51 #add new detected element to the list of elements we are looking for. 52 52 elements=numpy.concatenate((elements,nextelement)) 53 53 #new B: 54 B=md.mesh.elements[nextelement-1,numpy.nonzero(numpy.logical_not( ismember(md.mesh.elements[nextelement-1,:],numpy.array([A,B]))))]54 B=md.mesh.elements[nextelement-1,numpy.nonzero(numpy.logical_not(m.ismember(md.mesh.elements[nextelement-1,:],numpy.array([A,B]))))] 55 55 56 56 #take the list of elements on one side of the rift that connect to the tip, -
TabularUnified issm/trunk-jpl/src/m/mesh/triangle.py ¶
r14018 r17480 1 1 import numpy 2 from TriMesh import *3 from NodeConnectivity import *4 from ElementConnectivity import *5 from MatlabFuncs import * 2 from TriMesh import TriMesh 3 from NodeConnectivity import NodeConnectivity 4 from ElementConnectivity import ElementConnectivity 5 import MatlabFuncs as m 6 6 7 7 def triangle(md,domainname,*args): … … 36 36 if md.mesh.numberofelements: 37 37 choice = raw_input('This model already has a mesh. Are you sure you want to go ahead? (y/n)') 38 if not strcmp(choice,'y'):38 if not m.strcmp(choice,'y'): 39 39 print 'no meshing done ... exiting' 40 40 return None -
TabularUnified issm/trunk-jpl/src/m/miscellaneous/fielddisplay.py ¶
r13965 r17480 2 2 import numpy 3 3 from math import isnan 4 from MatlabFuncs import * 4 import MatlabFuncs as m 5 5 6 6 def fielddisplay(md,name,comment): … … 101 101 break 102 102 103 if strcmp(string,sbeg):103 if m.strcmp(string,sbeg): 104 104 string="%s%dx1%s" % (sbeg,len(field),send) 105 105 else: … … 117 117 118 118 #take care of characterization 119 if strcmp(characterization,"''") or strcmp(characterization,'""') orstrcmpi(characterization,'nan'):119 if m.strcmp(characterization,"''") or m.strcmp(characterization,'""') or m.strcmpi(characterization,'nan'): 120 120 characterization="N/A" 121 121 -
TabularUnified issm/trunk-jpl/src/m/os/issmdir.py ¶
r13170 r17480 1 1 import os 2 from MatlabFuncs import * 2 import MatlabFuncs as m 3 3 4 4 def issmdir(): … … 10 10 """ 11 11 12 if not ispc():12 if not m.ispc(): 13 13 ISSM_DIR =os.environ['ISSM_DIR'] 14 14 else: 15 15 ISSM_DIR =os.environ['ISSM_DIR_WIN'] 16 if strcmpi(ISSM_DIR[-1],'/') orstrcmpi(ISSM_DIR[-1],'\\'):16 if m.strcmpi(ISSM_DIR[-1],'/') or m.strcmpi(ISSM_DIR[-1],'\\'): 17 17 ISSM_DIR = ISSM_DIR[:-1] #shave off the last '/' 18 18 -
TabularUnified issm/trunk-jpl/src/m/os/issmscpin.py ¶
r17127 r17480 3 3 import os 4 4 import shutil 5 from MatlabFuncs import * 5 import MatlabFuncs as m 6 6 7 7 def issmscpin(host, login,port,path, packages): … … 24 24 25 25 #if hostname and host are the same, do a simple copy 26 if strcmpi(hostname,host):26 if m.strcmpi(hostname,host): 27 27 28 28 for package in packages: … … 34 34 else: 35 35 36 if ispc():36 if m.ispc(): 37 37 #use the putty project pscp.exe: it should be in the path. 38 38 -
TabularUnified issm/trunk-jpl/src/m/os/issmscpout.py ¶
r17126 r17480 2 2 import subprocess 3 3 import os 4 from MatlabFuncs import * 4 import MatlabFuncs as m 5 5 6 6 def issmscpout(host,path,login,port,packages): … … 16 16 #if hostname and host are the same, do a simple copy 17 17 18 if strcmpi(host,hostname):18 if m.strcmpi(host,hostname): 19 19 for package in packages: 20 20 here=os.getcwd() … … 27 27 os.chdir(here) 28 28 else: 29 if ispc():29 if m.ispc(): 30 30 #use the putty project pscp.exe: it should be in the path. 31 31 -
TabularUnified issm/trunk-jpl/src/m/os/issmssh.py ¶
r17127 r17480 2 2 import subprocess 3 3 import os 4 from MatlabFuncs import * 4 import MatlabFuncs as m 5 5 6 6 def issmssh(host,login,port,command): … … 16 16 17 17 #if same as host, just run the command. 18 if strcmpi(host,hostname):18 if m.strcmpi(host,hostname): 19 19 subprocess.call(command,shell=True) 20 20 else: 21 if ispc():21 if m.ispc(): 22 22 #use the putty project plink.exe: it should be in the path. 23 23 -
TabularUnified issm/trunk-jpl/src/m/parameterization/setflowequation.py ¶
r17466 r17480 1 1 import numpy 2 2 from model import * 3 from pairoptions import *4 from MatlabFuncs import * 5 from PythonFuncs import * 6 from FlagElements import *3 from pairoptions import pairoptions 4 import MatlabFuncs as m 5 import PythonFuncs as p 6 from FlagElements import FlagElements 7 7 8 8 def setflowequation(md,*args): … … 37 37 #Find_out what kind of coupling to use 38 38 coupling_method=options.getfieldvalue('coupling','tiling') 39 if not strcmpi(coupling_method,'tiling') and notstrcmpi(coupling_method,'penalties'):39 if not m.strcmpi(coupling_method,'tiling') and not m.strcmpi(coupling_method,'penalties'): 40 40 raise TypeError("coupling type can only be: tiling or penalties") 41 41 … … 49 49 50 50 #Flag the elements that have not been flagged as filltype 51 if strcmpi(filltype,'SIA'):51 if m.strcmpi(filltype,'SIA'): 52 52 SIAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SSAflag,HOflag)))]=True 53 elif strcmpi(filltype,'SSA'):53 elif m.strcmpi(filltype,'SSA'): 54 54 SSAflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,HOflag,FSflag)))]=True 55 elif strcmpi(filltype,'HO'):55 elif m.strcmpi(filltype,'HO'): 56 56 HOflag[numpy.nonzero(numpy.logical_not(logical_or_n(SIAflag,SSAflag,FSflag)))]=True 57 57 … … 114 114 SSAFSflag=numpy.zeros(md.mesh.numberofelements,bool) 115 115 HOFSflag=numpy.zeros(md.mesh.numberofelements,bool) 116 if strcmpi(coupling_method,'penalties'):116 if m.strcmpi(coupling_method,'penalties'): 117 117 #Create the border nodes between HO and SSA and extrude them 118 118 numnodes2d=md.mesh.numberofvertices2d … … 127 127 md.stressbalance.vertex_pairing=penalties 128 128 129 elif strcmpi(coupling_method,'tiling'):129 elif m.strcmpi(coupling_method,'tiling'): 130 130 if any(SSAflag) and any(HOflag): #coupling SSA HO 131 131 #Find node at the border 132 132 nodeonSSAHO[numpy.nonzero(numpy.logical_and(nodeonSSA,nodeonHO))]=True 133 133 #SSA elements in contact with this layer become SSAHO elements 134 matrixelements= ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAHO)[0])134 matrixelements=m.ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAHO)[0]) 135 135 commonelements=numpy.sum(matrixelements,axis=1)!=0 136 136 commonelements[numpy.nonzero(HOflag)]=False #only one layer: the elements previously in SSA … … 164 164 nodeonHOFS[numpy.nonzero(numpy.logical_and(nodeonHO,nodeonFS))]=True 165 165 #FS elements in contact with this layer become HOFS elements 166 matrixelements= ismember(md.mesh.elements-1,numpy.nonzero(nodeonHOFS)[0])166 matrixelements=m.ismember(md.mesh.elements-1,numpy.nonzero(nodeonHOFS)[0]) 167 167 commonelements=numpy.sum(matrixelements,axis=1)!=0 168 168 commonelements[numpy.nonzero(HOflag)]=False #only one layer: the elements previously in SSA … … 196 196 nodeonSSAFS[numpy.nonzero(numpy.logical_and(nodeonSSA,nodeonFS))]=True 197 197 #FS elements in contact with this layer become SSAFS elements 198 matrixelements= ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAFS)[0])198 matrixelements=m.ismember(md.mesh.elements-1,numpy.nonzero(nodeonSSAFS)[0]) 199 199 commonelements=numpy.sum(matrixelements,axis=1)!=0 200 200 commonelements[numpy.nonzero(SSAflag)]=False #only one layer: the elements previously in SSA -
TabularUnified issm/trunk-jpl/src/m/solve/WriteData.py ¶
r17169 r17480 2 2 import math 3 3 import struct 4 from pairoptions import * 5 from MatlabFuncs import * 4 import pairoptions 5 import MatlabFuncs as m 6 6 from EnumDefinitions import * 7 7 from EnumToString import EnumToString … … 16 16 17 17 #process options 18 # the import above the function level doesn't work? 19 from pairoptions import pairoptions 20 options=pairoptions(*args) 18 options=pairoptions.pairoptions(*args) 21 19 22 20 #Get data properties … … 62 60 63 61 #Step 2: write the data itself. 64 if strcmpi(format,'Boolean'): # {{{62 if m.strcmpi(format,'Boolean'): # {{{ 65 63 # if len(data) !=1: 66 64 # raise ValueError('field %s cannot be marshalled as it has more than one element!' % EnumToString(enum)[0]) … … 76 74 # }}} 77 75 78 elif strcmpi(format,'Integer'): # {{{76 elif m.strcmpi(format,'Integer'): # {{{ 79 77 # if len(data) !=1: 80 78 # raise ValueError('field %s cannot be marshalled as it has more than one element!' % EnumToString(enum)[0]) … … 90 88 # }}} 91 89 92 elif strcmpi(format,'Double'): # {{{90 elif m.strcmpi(format,'Double'): # {{{ 93 91 # if len(data) !=1: 94 92 # raise ValueError('field %s cannot be marshalled as it has more than one element!' % EnumToString(enum)[0]) … … 104 102 # }}} 105 103 106 elif strcmpi(format,'String'): # {{{104 elif m.strcmpi(format,'String'): # {{{ 107 105 #first write length of record 108 106 fid.write(struct.pack('i',len(data)+4+4)) #string + string size + code … … 116 114 # }}} 117 115 118 elif strcmpi(format,'BooleanMat'): # {{{116 elif m.strcmpi(format,'BooleanMat'): # {{{ 119 117 120 118 if isinstance(data,bool): … … 149 147 # }}} 150 148 151 elif strcmpi(format,'IntMat'): # {{{149 elif m.strcmpi(format,'IntMat'): # {{{ 152 150 153 151 if isinstance(data,(int,long)): … … 182 180 # }}} 183 181 184 elif strcmpi(format,'DoubleMat'): # {{{182 elif m.strcmpi(format,'DoubleMat'): # {{{ 185 183 186 184 if isinstance(data,(bool,int,long,float)): … … 219 217 # }}} 220 218 221 elif strcmpi(format,'MatArray'): # {{{219 elif m.strcmpi(format,'MatArray'): # {{{ 222 220 223 221 #first get length of record … … 263 261 # }}} 264 262 265 elif strcmpi(format,'StringArray'): # {{{263 elif m.strcmpi(format,'StringArray'): # {{{ 266 264 267 265 #first get length of record … … 319 317 """ 320 318 321 if strcmpi(format,'Boolean'):319 if m.strcmpi(format,'Boolean'): 322 320 code=1 323 elif strcmpi(format,'Integer'):321 elif m.strcmpi(format,'Integer'): 324 322 code=2 325 elif strcmpi(format,'Double'):323 elif m.strcmpi(format,'Double'): 326 324 code=3 327 elif strcmpi(format,'String'):325 elif m.strcmpi(format,'String'): 328 326 code=4 329 elif strcmpi(format,'BooleanMat'):327 elif m.strcmpi(format,'BooleanMat'): 330 328 code=5 331 elif strcmpi(format,'IntMat'):329 elif m.strcmpi(format,'IntMat'): 332 330 code=6 333 elif strcmpi(format,'DoubleMat'):331 elif m.strcmpi(format,'DoubleMat'): 334 332 code=7 335 elif strcmpi(format,'MatArray'):333 elif m.strcmpi(format,'MatArray'): 336 334 code=8 337 elif strcmpi(format,'StringArray'):335 elif m.strcmpi(format,'StringArray'): 338 336 code=9 339 337 else: -
TabularUnified issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py ¶
r17265 r17480 1 1 import os 2 2 import socket 3 from MatlabFuncs import * 4 from loadresultsfromdisk import *3 import MatlabFuncs as m 4 from loadresultsfromdisk import loadresultsfromdisk 5 5 6 6 def loadresultsfromcluster(md,runtimename=False): … … 41 41 os.remove(md.miscellaneous.name+'.errlog') 42 42 os.remove(md.miscellaneous.name+'.outbin') 43 if not ispc():43 if not m.ispc(): 44 44 os.remove(md.private.runtimename+'.tar.gz') 45 45 46 46 #erase input file if run was carried out on same platform. 47 47 hostname=socket.gethostname() 48 if strcmpi(hostname,cluster.name):48 if m.strcmpi(hostname,cluster.name): 49 49 if md.qmu.isdakota: 50 50 os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.bin')) … … 53 53 os.remove(md.miscellaneous.name+'.bin') 54 54 os.remove(md.miscellaneous.name+'.toolkits') 55 if not ispc():55 if not m.ispc(): 56 56 os.remove(md.miscellaneous.name+'.queue') 57 57 else: -
TabularUnified issm/trunk-jpl/src/m/solve/loadresultsfromdisk.py ¶
r13966 r17480 1 1 import os 2 from results import *3 from parseresultsfromdisk import *2 from results import results 3 from parseresultsfromdisk import parseresultsfromdisk 4 4 from EnumToString import EnumToString 5 from MatlabFuncs import * 5 import MatlabFuncs as m 6 6 7 7 def loadresultsfromdisk(md,filename): … … 53 53 54 54 #if only one solution, extract it from list for user friendliness 55 if len(structure) == 1 and not strcmp(structure[0].SolutionType,'TransientSolution'):55 if len(structure) == 1 and not m.strcmp(structure[0].SolutionType,'TransientSolution'): 56 56 setattr(md.results,structure[0].SolutionType,structure[0]) 57 57 -
TabularUnified issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py ¶
r16470 r17480 3 3 from collections import OrderedDict 4 4 import results as resultsclass 5 from MatlabFuncs import * 5 import MatlabFuncs as m 6 6 7 7 def parseresultsfromdisk(filename,iosplit): … … 50 50 51 51 #Add result 52 if hasattr(results[result['step']-1],result['fieldname']) and not strcmp(result['fieldname'],'SolutionType'):52 if hasattr(results[result['step']-1],result['fieldname']) and not m.strcmp(result['fieldname'],'SolutionType'): 53 53 setattr(results[result['step']-1],result['fieldname'],numpy.vstack((getattr(results[result['step']-1],result['fieldname']),result['field']))) 54 54 else: … … 162 162 #Process units here FIXME: this should not be done here! 163 163 yts=365.0*24.0*3600.0 164 if strcmp(fieldname,'BalancethicknessThickeningRate'):165 field = field*yts 166 elif strcmp(fieldname,'Time'):164 if m.strcmp(fieldname,'BalancethicknessThickeningRate'): 165 field = field*yts 166 elif m.strcmp(fieldname,'Time'): 167 167 field = field/yts 168 elif strcmp(fieldname,'HydrologyWaterVx'):169 field = field*yts 170 elif strcmp(fieldname,'HydrologyWaterVy'):171 field = field*yts 172 elif strcmp(fieldname,'Vx'):173 field = field*yts 174 elif strcmp(fieldname,'Vy'):175 field = field*yts 176 elif strcmp(fieldname,'Vz'):177 field = field*yts 178 elif strcmp(fieldname,'Vel'):179 field = field*yts 180 elif strcmp(fieldname,'BasalforcingsMeltingRate'):181 field = field*yts 182 elif strcmp(fieldname,'TotalSmb'):168 elif m.strcmp(fieldname,'HydrologyWaterVx'): 169 field = field*yts 170 elif m.strcmp(fieldname,'HydrologyWaterVy'): 171 field = field*yts 172 elif m.strcmp(fieldname,'Vx'): 173 field = field*yts 174 elif m.strcmp(fieldname,'Vy'): 175 field = field*yts 176 elif m.strcmp(fieldname,'Vz'): 177 field = field*yts 178 elif m.strcmp(fieldname,'Vel'): 179 field = field*yts 180 elif m.strcmp(fieldname,'BasalforcingsMeltingRate'): 181 field = field*yts 182 elif m.strcmp(fieldname,'TotalSmb'): 183 183 field = field/10.**12.*yts #(GigaTon/year) 184 elif strcmp(fieldname,'SurfaceforcingsMassBalance'):184 elif m.strcmp(fieldname,'SurfaceforcingsMassBalance'): 185 185 field = field*yts 186 186 -
TabularUnified issm/trunk-jpl/src/m/solve/solve.py ¶
r15907 r17480 2 2 import os 3 3 import shutil 4 from pairoptions import *5 from process_solve_options import *4 from pairoptions import pairoptions 5 from process_solve_options import process_solve_options 6 6 from EnumDefinitions import * 7 7 from EnumToString import EnumToString 8 from ismodelselfconsistent import * 9 from marshall import * 10 from waitonlock import * 11 from loadresultsfromcluster import * 8 from ismodelselfconsistent import ismodelselfconsistent 9 from marshall import marshall 10 from waitonlock import waitonlock 11 from loadresultsfromcluster import loadresultsfromcluster 12 import MatlabFuncs as m 12 13 13 14 def solve(md,solutionenum,*args): … … 83 84 84 85 #Stop here if batch mode 85 if strcmpi(options['batch'],'yes'):86 if m.strcmpi(options['batch'],'yes'): 86 87 print 'batch mode requested: not launching job interactively' 87 88 print 'launch solution sequence on remote cluster by hand' … … 96 97 97 98 #did we even try to run? if so, wait on lock 98 if strcmpi(options['upload'],'on'):99 if m.strcmpi(options['upload'],'on'): 99 100 print 'solve done uploading test decks' 100 101 return md -
TabularUnified issm/trunk-jpl/src/m/solve/waitonlock.py ¶
r17264 r17480 2 2 import socket 3 3 import time 4 from MatlabFuncs import * 4 import MatlabFuncs as m 5 5 6 6 def waitonlock(md): … … 24 24 25 25 #waitonlock will work if the lock is on the same machine only: 26 if not strcmpi(socket.gethostname(),cluster):26 if not m.strcmpi(socket.gethostname(),cluster): 27 27 28 28 print 'solution launched on remote cluster. log in to detect job completion.' 29 29 choice=raw_input('Is the job successfully completed? (y/n) ') 30 if not strcmp(choice,'y'):30 if not m.strcmp(choice,'y'): 31 31 print 'Results not loaded... exiting' 32 32 flag=0
Note:
See TracChangeset
for help on using the changeset viewer.