Ignore:
Timestamp:
11/26/22 15:05:33 (2 years ago)
Author:
jdquinn
Message:

CHG: Updates for Valgrind-related builds; cleanup

File:
1 edited

Legend:

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

    r25169 r27427  
    88
    99class toolkits(object):
    10     '''
    11     TOOLKITS class definition
     10    """TOOLKITS class definition
    1211
    13         Usage:
    14             self = toolkits()
    15     '''
     12    Usage:
     13        self = toolkits()
     14    """
    1615
    1716    def __init__(self): #{{{
    18         #default toolkits
     17        # Default toolkits
    1918        if IssmConfig('_HAVE_PETSC_')[0]:
    20             #MUMPS is the default toolkits
     19            # MUMPS is the default toolkits
    2120            if IssmConfig('_HAVE_MUMPS_')[0]:
    2221                self.DefaultAnalysis = mumpsoptions()
     
    3130                raise IOError("ToolkitsFile error: need at least Mumps or Gsl to define issm solver type")
    3231
    33         #Use same solver for Recovery mode
     32        # Use same solver for Recovery mode
    3433        self.RecoveryAnalysis = self.DefaultAnalysis
    3534
    36         #The other properties are dynamic
     35        # The other properties are dynamic
    3736    #}}}
    3837
     
    5049        #    md.toolkits = addoptions(md.toolkits, 'StressbalanceAnalysis')
    5150
    52         #Create dynamic property if property does not exist yet
     51        # Create dynamic property if property does not exist yet
    5352        if not hasattr(self, analysis):
    5453            setattr(self, analysis, None)
    5554
    56         #Add toolkits options to analysis
     55        # Add toolkits options to analysis
    5756        if len(args) == 1:
    5857            setattr(self, analysis, args[0])
     
    6261
    6362    def checkconsistency(self, md, solution, analyses): #{{{
    64         # TODO
     63        # TODO:
    6564        # - Implement something closer to a switch as in
    6665        # src/m/classes/toolkits.m?
     
    7473
    7574    def ToolkitsFile(self, filename): #{{{
    76         '''
    77         TOOLKITSFILE - build toolkits file
     75        """TOOLKITSFILE - build toolkits file
    7876
    79             Build a Petsc compatible options file, from the toolkits model
    80             field + return options string.
    81             This file will also be used when the toolkit used is 'issm' instead
    82             of 'petsc'.s
     77        Build a PETSc compatible options file, from the toolkits model field + return options string.
     78        This file will also be used when the toolkit used is 'issm' instead of 'petsc'.
    8379
    84             Usage:
    85                 ToolkitsFile(toolkits, filename)
    86         '''
     80        Usage:
     81            ToolkitsFile(toolkits, filename)
     82        """
    8783
    88         #open file for writing
     84        # Open file for writing
    8985        try:
    9086            fid = open(filename, 'w')
     
    9288            raise IOError("ToolkitsFile error: could not open {}' for writing due to".format(filename), e)
    9389
    94         #write header
     90        # Write header
    9591        fid.write("%s%s%s\n" % ('%Toolkits options file: ', filename, ' written from Python toolkits array'))
    9692
    97         #start writing options
     93        # Start writing options
    9894        for analysis in list(vars(self).keys()):
    9995            options = getattr(self, analysis)
    10096
    101             #first write analysis:
    102             fid.write("\n+{}\n".format(analysis))  #append a + to recognize it's an analysis enum
    103             #now, write options
     97            # First write analysis
     98            fid.write("\n+{}\n".format(analysis))  # Append a + to recognize it's an analysis enum
     99            # Now, write options
    104100            for optionname, optionvalue in list(options.items()):
    105101
    106102                if not optionvalue:
    107                     #this option has only one argument
     103                    # This option has only one argument
    108104                    fid.write("-{}\n".format(optionname))
    109105                else:
    110                     #option with value. value can be string or scalar
     106                    # Option with value. Value can be string or scalar.
    111107                    if isinstance(optionvalue, (bool, int, float)):
    112108                        fid.write("-{} {}\n".format(optionname, optionvalue))
Note: See TracChangeset for help on using the changeset viewer.