Changeset 21245


Ignore:
Timestamp:
10/06/16 08:05:24 (8 years ago)
Author:
bdef
Message:

BUG: adding the numeric vallues of fill in checkoption (will happen in restart) and Pyhtonizing the translation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/rifts.py

    r21049 r21245  
    4747                                md.checkmessage("model should be processed for rifts (run meshprocessrifts)!")
    4848                        for i,rift in enumerate(self.riftstruct):
    49                                 md = checkfield(md,'fieldname',"rifts.riftstruct[%d]['fill']" % i,'values',['Water','Air','Ice','Melange'])
     49                                md = checkfield(md,'fieldname',"rifts.riftstruct[%d]['fill']" % i,'values',['Water','Air','Ice','Melange',0,1,2,3])
    5050                else:
    5151                        if self.riftstruct and numpy.any(numpy.logical_not(isnans(self.riftstruct))):
     
    6767
    6868                # Convert strings in riftstruct to hard coded numbers
    69                 for i,rift in enumerate(self.riftstruct):
    70                         if rift['fill'] == 'Air':
    71                                 rift['fill'] = 0;
    72                         elif rift['fill'] == 'Ice':
    73                                 rift['fill'] = 1;
    74                         elif rift['fill'] == 'Melange':
    75                                 rift['fill'] = 2;
    76                         elif rift['fill'] == 'Water':
    77                                 rift['fill'] = 3;
    78                         else:
    79                                 error('Could not convert strings in riftstruct to integers for marshalling')
     69                FillDict={'Air':0,
     70                                                        'Ice':1,
     71                                                        'Melange':2,
     72                                                        'Water':3}
     73                for rift in self.riftstruct:
     74                        if rift['fill'] in ['Air','Ice','Melange','Water']:
     75                                rift['fill'] = FillDict[rift['fill']]
    8076
    8177                # 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.
Note: See TracChangeset for help on using the changeset viewer.