Changeset 26759
- Timestamp:
- 01/10/22 02:56:01 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/rifts.py
r24256 r26759 67 67 68 68 numpairs = 0 69 for rift in self.riftstruct: 70 numpairs += np.size(rift['penaltypairs'], axis=0) 69 if numrifts > 0: 70 for rift in self.riftstruct: 71 numpairs += np.size(rift['penaltypairs'], axis=0) 71 72 72 # Convert strings in riftstruct to hard coded numbers73 FillDict = {'Air': 0,74 'Ice': 1,75 'Melange': 2,76 'Water': 3}77 for rift in self.riftstruct:78 if rift['fill'] in ['Air', 'Ice', 'Melange', 'Water']:79 rift['fill'] = FillDict[rift['fill']]73 # Convert strings in riftstruct to hard coded numbers 74 FillDict = {'Air': 0, 75 'Ice': 1, 76 'Melange': 2, 77 'Water': 3} 78 for rift in self.riftstruct: 79 if rift['fill'] in ['Air', 'Ice', 'Melange', 'Water']: 80 rift['fill'] = FillDict[rift['fill']] 80 81 81 # 2 for nodes + 2 for elements + 2 for normals + 1 for length + 1 for fill + 1 for friction + 1 for fraction + 1 for fractionincrement + 1 for state. 82 data = np.zeros((numpairs, 12)) 83 count = 0 84 for rift in self.riftstruct: 85 numpairsforthisrift = np.size(rift['penaltypairs'], 0) 86 data[count:count + numpairsforthisrift, 0:7] = rift['penaltypairs'] 87 data[count:count + numpairsforthisrift, 7] = rift['fill'] 88 data[count:count + numpairsforthisrift, 8] = rift['friction'] 89 data[count:count + numpairsforthisrift, 9] = rift['fraction'] 90 data[count:count + numpairsforthisrift, 10] = rift['fractionincrement'] 91 data[count:count + numpairsforthisrift, 11] = rift['state'].reshape(-1) 92 count += numpairsforthisrift 93 82 # 2 for nodes + 2 for elements + 2 for normals + 1 for length + 1 for fill + 1 for friction + 1 for fraction + 1 for fractionincrement + 1 for state. 83 data = np.zeros((numpairs, 12)) 84 count = 0 85 for rift in self.riftstruct: 86 numpairsforthisrift = np.size(rift['penaltypairs'], 0) 87 data[count:count + numpairsforthisrift, 0:7] = rift['penaltypairs'] 88 data[count:count + numpairsforthisrift, 7] = rift['fill'] 89 data[count:count + numpairsforthisrift, 8] = rift['friction'] 90 data[count:count + numpairsforthisrift, 9] = rift['fraction'] 91 data[count:count + numpairsforthisrift, 10] = rift['fractionincrement'] 92 data[count:count + numpairsforthisrift, 11] = rift['state'].reshape(-1) 93 count += numpairsforthisrift 94 else: 95 data = np.zeros((numpairs, 12)) 94 96 WriteData(fid, prefix, 'data', numrifts, 'name', 'md.rifts.numrifts', 'format', 'Integer') 95 97 WriteData(fid, prefix, 'data', data, 'name', 'md.rifts.riftstruct', 'format', 'DoubleMat', 'mattype', 3)
Note:
See TracChangeset
for help on using the changeset viewer.