Package PyFoam :: Package Basics :: Module FoamOptionParser :: Class FoamOptionParser
[hide private]
[frames] | no frames]

Class FoamOptionParser

source code

optparse.OptionContainer --+    
                           |    
       optparse.OptionParser --+
                               |
                              FoamOptionParser

Wrapper to the usual OptionParser to honor the conventions of OpenFOAM-utilities

Options that are not used by the script are passed to the OpenFOAM-application

Instance Methods [hide private]
 
__init__(self, args=None, usage=None, version=None, description=None, interspersed=False) source code
 
parse(self, nr=None, exactNr=True)
parse the options
source code
 
getArgs(self)
Return the arguments left after parsing
source code
 
getOptions(self)
Return the options
source code
 
casePath(self)
Returns the path to the case (if applicable)
source code

Inherited from optparse.OptionParser: add_option_group, check_values, disable_interspersed_args, enable_interspersed_args, error, exit, expand_prog_name, format_help, format_option_help, get_default_values, get_description, get_option_group, get_prog_name, get_usage, get_version, parse_args, print_help, print_usage, print_version, set_default, set_defaults, set_process_default_values, set_usage

Inherited from optparse.OptionParser (private): _add_help_option, _add_version_option, _create_option_list, _get_all_options, _get_args, _init_parsing_state, _match_long_opt, _populate_option_list, _process_args, _process_long_opt, _process_short_opts

Inherited from optparse.OptionContainer: add_option, add_options, format_description, get_option, has_option, remove_option, set_conflict_handler, set_description

Inherited from optparse.OptionContainer (private): _check_conflict, _create_option_mappings, _share_option_mappings

Class Variables [hide private]

Inherited from optparse.OptionParser: standard_option_list

Method Details [hide private]

__init__(self, args=None, usage=None, version=None, description=None, interspersed=False)
(Constructor)

source code 
Parameters:
  • usage - usage string. If missing a default is used
  • version - if missing the PyFoam-version is used
  • description - description of the utility
  • interspersed - needs to be false if options should be passed to an OpenFOAM-utility
  • args - Command line arguments. If unset sys.argv[1:] is used. Can be a string: it will be splitted then unsing the spaces (very primitive), or a list of strings (prefered)
Overrides: optparse.OptionContainer.__init__

parse(self, nr=None, exactNr=True)

source code 

parse the options

Parameters:
  • nr - minimum number of arguments that are to be passed to the application 3 is default for pre-1.5 versions of OpenFOAM