Stellarator-Tools
surface_commandline_parser Module Reference

Defines the base class of the type surface_commandline_parser_class. More...

Data Types

interface  surface_commandline_parser_class
 Base class containing a parsed surface_commandline. More...
 

Functions/Subroutines

class(surface_commandline_parser_class) function, pointer surface_commandline_parser_construct (parallel)
 Construct a surface_commandline_parser_class object. More...
 
subroutine surface_commandline_parser_destruct (this)
 Deconstruct a surface_commandline_parser_class object. More...
 
character(len=path_length) function surface_commandline_parser_get_string (this, arg)
 Get the value of an argument as a string. More...
 
integer function surface_commandline_parser_get_integer (this, arg, default_value)
 Get the value of an argument as an integer. More...
 
real(rprec) function surface_commandline_parser_get_real (this, arg, default_value)
 Get the value of an argument as a Real. More...
 
logical function surface_commandline_parser_is_flag_set (this, arg)
 Check if a command line argument was set. More...
 
subroutine surface_commandline_parser_flag_requires_value (this, index)
 Check if a command line argument requires a value. More...
 
subroutine surface_commandline_parser_print_help
 Print out help text. More...
 

Variables

integer, parameter surface_commandline_parser_no_error = 0
 Commandline argument not found.
 
integer, parameter surface_commandline_parser_arg_not_found = -1
 Commandline argument not found.
 

Detailed Description

Defines the base class of the type surface_commandline_parser_class.

Function/Subroutine Documentation

◆ surface_commandline_parser_construct()

class (surface_commandline_parser_class) function, pointer surface_commandline_parser::surface_commandline_parser_construct ( class (bmw_parallel_context_class), intent(in)  parallel)

Construct a surface_commandline_parser_class object.

Allocates memory and initializes a surface_commandline_parser_class object. The command line is parsed assuming the the flags take the form of -flag=value. If the '=' is missing, it is assumed there is no value. If -h is found, the help text is printed out and the program terminated.

Parameters
[in]parallelbmw_parallel_context_class object instance.
Returns
A pointer to a constructed surface_commandline_parser_class object.

◆ surface_commandline_parser_destruct()

subroutine surface_commandline_parser::surface_commandline_parser_destruct ( type (surface_commandline_parser_class), intent(inout)  this)

Deconstruct a surface_commandline_parser_class object.

Deallocates memory and uninitializes a surface_commandline_parser_class object.

Parameters
[in,out]thisA surface_commandline_parser_class instance.

◆ surface_commandline_parser_flag_requires_value()

subroutine surface_commandline_parser::surface_commandline_parser_flag_requires_value ( class (surface_commandline_parser_class), intent(in)  this,
integer, intent(in)  index 
)

Check if a command line argument requires a value.

Command line arguments for

  • -woutf
  • -surff
  • -logf

require a value to be set.

Parameters
[in]thisA surface_commandline_parser_class instance.
[in]indexA argument string to search for.
Returns
True if the argument has a value.

◆ surface_commandline_parser_get_integer()

integer function surface_commandline_parser::surface_commandline_parser_get_integer ( class (surface_commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg,
integer, intent(in)  default_value 
)

Get the value of an argument as an integer.

Searches the parsed command line flags for a matching command like argument. If no matching argument is found, no value was set or the value cannot be converted to an integer, the default value is returned. Command line arguments take the form of -flag.

Parameters
[in]thisA surface_commandline_parser_class instance.
[in]argA argument string to search for.
[in]default_valueDefault value in case flag is not set.
Returns
The argument value.

◆ surface_commandline_parser_get_real()

real (rprec) function surface_commandline_parser::surface_commandline_parser_get_real ( class (surface_commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg,
real (rprec), intent(in)  default_value 
)

Get the value of an argument as a Real.

Searches the parsed command line flags for a matching command like argument. If no matching argument is found, no value was set or the value cannot be converted to an integer, the default value is returned. Command line arguments take the form of -flag.

Parameters
[in]thisA surface_commandline_parser_class instance.
[in]argA argument string to search for.
[in]default_valueDefault value in case flag is not set.
Returns
The argument value.

◆ surface_commandline_parser_get_string()

character (len=path_length) function surface_commandline_parser::surface_commandline_parser_get_string ( class (surface_commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg 
)

Get the value of an argument as a string.

Searches the parsed command line flags for a matching command like argument. If no matching argument is found or no value was set, a blank string is returned. command line arguments take the form of -flag.

Parameters
[in]thisA surface_commandline_parser_class instance.
[in]argA argument string to search for.
Returns
The argument value.

◆ surface_commandline_parser_is_flag_set()

logical function surface_commandline_parser::surface_commandline_parser_is_flag_set ( class (surface_commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg 
)

Check if a command line argument was set.

Searches the parsed command line flags for a matching command line argument. If no matching argument is found the flag was not set.

Parameters
[in]thisA surface_commandline_parser_class instance.
[in]argA argument string to search for.
Returns
True if the argument was found, false if it was not found.

◆ surface_commandline_parser_print_help()

subroutine surface_commandline_parser::surface_commandline_parser_print_help

Print out help text.

Command line help text should take the form of '-flag' that is maximum length of max_arg_length followed by a space. A Y or N indicating the flag takes a value or not followed by a space. A short message describing the flag. A reference for all the command line arguments can be found at Command Line Arguments.