PHXScriptWrapperObject
@PHXClassDecorator(PHXTException_Decorator)
class PHXScriptWrapperObject
This object is passed to Script Wrapper scripts and provides the “wrapper” global object which provides runtime services for the wrapper.-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def addMethod(self, methodName, fullName='', downloadInputs=False)Publicizes a method to our clients.@param methodName: The name of the method to publicize.@type methodName: string@param fullName: A human readable name to show in GUI programs for this method. For example, ModelCenter will show this in the right-click menu of a component.@type fullName: string@param downloadInputs: Hint passed to the client on whether the inputs should be downloaded after the method is run.@type downloadInputs: boolean@rtype: void
-
def addVariable(self, varName, varType, isInput)Adds a variable to this component. Returns a reference to the new variable. Valid types are: boolean, double, long, string, file. All types except file may be made into arrays by adding[]at the end of the type string.@param varName: The full name of the new variable. May include group specification with ’.’.@type varName: string@param varType: The type of variable to create. Use the same type strings as for the variable`: statemensts at the top of the ScriptWrapper.@type varType: string@param isInput: If true, the variable will be an input, if false, it will be an output.@type isInput: boolean@rtype: PHXSimpleType
-
def getDirectory(self)Returns the directory where this component was loaded from.@rtype: string
-
def getRunDirectory(self)Returns the current “run” directory, which is the same asgetDirectory()unless run sharing is being used.@rtype: string
-
def getRunShare(self)Returns thePHXRunShareContextobject used for process control and monitoring with this component.@rtype:PHXRunShareContext
-
def getVariable(self, varName)Returns a reference to the named variable.@param varName: The full name of the variable to retrieve. May include group specification with ’.’.@type varName: string@rtype:PHXSimpleType
-
def removeVariable(self, varName)Dynamically removes a variable from this component@param varName: The full name of the variable to remove. May include group specification with ’.’.@type varName: string@rtype: void
-
def sleep(self, milliSeconds)sleeps for a period of time@param milliSeconds: the amount of time to sleep (in milliseconds).@type milliSeconds: long@rtype: void
-
def __getVarType(self, varName) -
def getDictionary(self)
PHXRunShareObject
@PHXClassDecorator(PHXTException_Decorator)
class PHXRunShareContext:
This class handles runshare capabilities for any component which needs it. It can create temp directorys, deal w/ auto-copy and auto-delete of important files, return errors and block until it is safe to run. It also handles providing monitors for stdout and stderr as well as for monitoring started processes. This class can only handle one single process running at a time. If you need to run multiple processes, use multiple instances of this class. You can use this same object over and over by callinglock() and unlock()
multiple times.
-
def __init__(self)@rtype: void
-
def cleanTempDir(self)cleans up the temporary run directory if one has been created.@rtype: void
-
def getBaseDirectory(self)Gets the base dir which was passed in to the constructor.@rtype: string
-
def getDirectory(self)Returns the current directory being used by the runshare system. This may be the base directory, or it may be a temp directory created underneath there to implement run sharing.@rtype: string
-
def halt(self)halts any running process@rtype: void
-
def lock(self)Causes the run-share mode to be implemented. This creates sub-dirs, waits, or errors as appropriate. Once in “locked” mode, callinglock()again has no effect.@rtype: void
-
def run(self, cmd, ignoreErrors=False, autoChangeDir=True, shell='sh')Runs a command. Command may be relative to the run directory, seegetDirectory(). This function will not return until the sub-process has finished. It will collectstdoutandstderrand provide progress monitors.@param cmd: The command to run.@type cmd: string@param ignoreErrors: By default this code will throw an exception if the spawned process returns a non-zeroerrorlevel. Occasionally a program will return anerrorleveleven if it succeeds. This option allows you to igore theerrorlevel.@type ignoreErrors: boolean@param autoChangeDir: Whether to change the current working directory to the run directory (seegetDirectory) before running the code. “True” by default.@type autoChangeDir: boolean@param shell: On UNIX you can specify which shell to use to launch the program. By default “sh” is used.@type shell: string@rtype: void
-
def setAutoDelete(self, flag)Sets the auto-delete mode for runshare modeMODE_SHARE. IfDEL_TRUE, the created sub-dir is always deleted. IfDEL_FALSE, it is never deleted. IfDEL_AUTO, it is only deleted when no errors occur during the run.@type flag: int@rtype: void
-
def setFilesToCopy(self, files)Sets the files which need to be copied when runshare mode isMODE_SHARE.@type files: string@rtype: void
-
def setMode(self, mode)Sets the runshare mode.@type mode: int@rtype: void
-
def unlock(self)Unlocks the runshare mechanisms. This will unblock other components which are waiting for us to finish. Callingunlock()when not in “locked” mode has no effect.@rtype: void
PHXRowFieldFile
@PHXClassDecorator(PHXTException_Decorator)
class PHXRowFieldFile:
Class implements the parsing capabilities of the RowField type files from the fileWrapper facility. Typical use would be to write a function which creates an instance of this class and implements the parsing using thetransferVar() function. Then, a mode can be passed in which specifies whether the function should read the template file, generate an input file, or parse an output file.
You will want to read the documentation on the fileWrapper utility for more specifics on how exactly the file parsing and options work.
Example usage from a python scriptwrapper (Comments show fileWrapper equivalents):
-
def __init__(self, wrapper, mode)@type wrapper: PHXScriptWrapperObject@param mode: valid mode types are:GENERATE- This mode makes the row field file prepare to generate the output file by reading the template file, then replacing the specified values passed totransferVar()PARSE- This mode makes the row field file read in values from thefileToParsewhentransferVar()is called.READ_TEMPLATE- This mode makes the row field file read in values from the template file whentransferVar()is called.
@type mode: int@rtype: void
-
def __del__(self)@rtype: void
-
def clearMarks(self)Removes effects of any previousmarkAsBeginning()ormarkAsEnd()calls@rtype: void
-
def close(self)Closes the input file and frees up resources associated w/ thisRowFieldFile.@rtype: void
-
def generate(self)If mode isGENERATE, this function actually writes the output file to disk.@rtype: void
-
def markAsBeginning(self, find, occurrence=1, offset=0, regex=False)Searches for the specified string, starting from the end of the file and working towards the beginning, and makes the row where the string was found act as row 1 for all subsequent calls until anothermarkAsBeginningorclearMarkscall.@param find: The string to search for.@type find: string@param occurrence: Search for the Nth occurrence of string (default 1)@type occurrence: int@param offset: After finding string, move down offset rows. May be negative to move up. (default 0)@type offset: int@param regex: If true, the find parameter is a regular expression. (default false)@type regex: boolean@rtype: void
-
def markAsEnd(self, find, occurrence=1, offset=0, regex=False)Searches for the specified string and makes the row where the string was found act as row -1 (end of file) for all subsequent calls until anothermarkAsEndorclearMarkscall.@param find: The string to search for.@type find: string@param occurrence: Search for the Nth occurrence of string (default 1)@type occurrence: int@param offset: After finding string, move down offset rows. May be negative to move up. (default 0)@type offset: int@param regex: If true, the find parameter is a regular expression. (default false)@type regex: boolean@rtype: void
-
def readDouble(self, row, field)Reads a value out of the input file. If mode isPARSE, the input file is thefileToParse, otherwise it is the template file. Returns it as a double value.@param row: The row of the file to read from@type row: int@param field: The field of the file to read from.@type field: int@rtype: double
-
def readLong(self, row, field)Reads a value out of the input file. If mode isPARSE, the input file is thefileToParse, otherwise it is the template file. Returns it as a long value.@param row: The row of the file to read from@type row: int@param field: The field of the file to read from.@type field: int@rtype: long
-
def readValue(self, row, field)Reads a value out of the input file. If mode isPARSE, the input file is thefileToParse, otherwise it is the template file.@param row: The row of the file to read from@type row: int@param field: The field of the file to read from.@type field: int@rtype: string
-
def setDelimiters(self, delimiters)Sets the delimiters which should be used for parsing lines into fields.- Acceptable values:
- “columns” - Fortran style column based fields.
- null - default delimiters (whitespace)
- “whitespace” - default delimiters (whitespace)
- “default” - default delimiters (whitespace)
- "" - default delimiters (whitespace)
- “none” - No delimiters (entire line as single field)
- Any other string is taken as a list of character delimiters
@type delimiters: string@rtype: void
- Acceptable values:
-
def setFileToGenerate(self, fileName)Alias forsetFileToGenerateOrParse()@type fileName: string@rtype: void
-
def setFileToGenerateOrParse(self, fileName)Specified the file which will be generated or parsed depending on the mode.@type fileName: string@rtype: void
-
def setFileToParse(self, fileName)Alias forsetFileToGenerateOrParse()@type fileName: string@rtype: void
-
def setTemplateFile(self, fileName)Specified the template file to read. If the template file is not specified, it defaults to either thefileToParseorfileToGenerate.@type fileName: string@rtype: void
-
def transferArray(self, var, rowStart, rowEnd, fieldStart, fieldEnd, resizable=False, fformat='', numDimensions=1)Transfers the data for a particular array. If mode isGENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable.@param var: The array to read or write@type var:PHXSimpleArray@param rowStart: the starting row of the array@type rowStart: int@param rowEnd: the last row of the array@type rowEnd: int@param fieldStart: the starting field of the array@type fieldStart: int@param fieldEnd: the last field of the array@type fieldEnd: int@param resizable: whether the array is resizable or not@type resizable: boolean@param fformat: The fortran style format string to apply. Passnullfor standard formatting.@type fformat: string@param numDimensions: The number of dimensions to read the array as. Must be 1 or 2.@type numDimensions: int@rtype: void
-
def transferKeyVar(self, var, key, occurrence=1, rowOffset=0, field=1, fformat='')Transfers the data for a particular variable. If mode isGENERATEdata is read from the var and put into the file, otherwise data is read from the file into the variable.@param var: The variable to read or write@type var: PHXSimpleType@param key: The string to search for that identifies the variable in the file.@type key: string@param occurrence: (default 1). Which occurrence of string to find.@type occurrence: int@param rowOffset: (default 0). Once the string is found, offset by this many rows@type rowOffset: int@param field: (default 1). Once the string is found, offset by this many fields.@type field: int@param fformat: The fortran style format string to apply. Pass null for standard formatting.@type fformat: string@rtype: void
-
def transferVar(self, var, row, field, fformat='')Transfers the data for a particular variable. If mode isGENERATEdata is read from the var and put into the file, otherwise data is read from the file into the variable.@param var: The variable to read or write@type var:PHXSimpleType@param row: The row in the file to read/write from/to.@type row: int@param field: The field within the row to read/write from/to.@type field: int@param fformat: The fortran style format string to apply. Passnullfor standard formatting.@type fformat: string@rtype: void
-
def writeValue(self, row, field, val)Writes a token out to the output file. This is only useful if mode isGENERATE.@param row: The row of the file to read from@type row: int@param field: The field of the file to read from.@type field: int@param val: The string to write@type val: string@rtype: void
PHXSimpleType
@PHXClassDecorator(PHXTException_Decorator)
class PHXSimpleType:
A base class for most ModelCenter data types. The class defines the following properties:description: Stringunits: StringhasChanged: boolean
hasChanged(true) is called. The property event will always have the property name be “value” and the old and new values of null. Use toString or getValue functions to get the actual new value from the variable.
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def getUnits(self)retrieves the units for the variable@rtype: string
-
def setUnits(self, u)sets the units for the variable@param u: the units value@type u: string@rtype: void
-
def getDescription(self)retrieves the description of the variable@rtype: a description geometry data
-
def setDescription(self, d)sets the description for the variable. This should be a short, one-line description.@param d: the description@type d: string@rtype: void
-
def getHasChanged(self)retrieves thehasChangedflag@rtype: boolean
-
def setHasChanged(self, v)sets thehasChangedflag@param v: whether the variable has changed@type v: boolean@rtype: void
PHXSimpleArray
@PHXClassDecorator(PHXTException_Decorator)
class PHXSimpleArray(PHXSimpleType)
This class enables components to create resizeable arrays where the number of dimensions is variable as well as the size of each dimension. Typically you don’t use this class directly but one of its sub-classes that are created and passed to you automatically.-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def toString(self)Returns the string form of this array. Puts each element in quotes, even if it is a number and backslashes any quote or backslash characters (” and \).@rtype: string
-
def fromString(self, value)reads in the entire array in string form. An example 2D array specification would be::@param value: the value of the array@type value: string@rtype: void
-
def getDimensions(self)gets the dimensions of the array@rtype: int[]
-
def setDimensions(self, dim)Sets the dimensions of the array. Will preserve as many element values as possible.@param dim: the new dimensions for the array@type dim: int[]@rtype: void
-
def getNumDimensions(self)Gets the number of dimensions of the array@rtype: int
-
def resize(self, newSize)Resize the nD array to the new size specified. Preserve elements if the # of dimensions stays the same, else initialize the array with default values.@param newSize: the new dimensions for the array@type newSize: int[]@rtype: void
-
def getLockResize(self)Determine whether the array can current be resized or not.@rtype: boolean
-
def setLockResize(self, lockResize)Tells this array that it cannot be resized. ImplieslockDimensions.@type lockResize: boolean@rtype: void
-
def getLength(self, dim=0)Gets the length of the first dimension of the array.@param dim: the dimension of interest (default is 0)@type dim: int@rtype: int
-
def setLength(self, length, dim=0)Sets the length of the first dimension of the array. Will preserve as many element values as possible.@param length: the new length of the 1D array@type length: int@param dim: the dimension of interest (default is 0)@type dim: int@rtype: void
-
def lockDimensions(self)Tells this array that the number of dimensions cannot be changed from what they are right now.@rtype: void
PHXBoolean
@PHXClassDecorator(PHXTException_Decorator)
class PHXBoolean(PHXSimpleType)
The ModelCenter type for booleans. This class adds the following features to thePHXSimpleType:
-
value: boolean -
valueStr: the source string for the value, useful for error checking when the value is NaN -
def __init__(self, varName)initializes value to false@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def fromString(self, value)converts a String representation to the internal value@param value: the value to convert@type value: string@rtype: void
-
def getValue(self)retrieves the current value of the variable@rtype: boolean
-
def getValueStr(self)retrieves the current value of the variable (in string form)@rtype: string
-
def setValue(self, value)sets the value for the variable@param value: the value@type value: boolean@rtype: void
-
def toString(self)converts the variable to a string@rtype: string
PHXBooleanArray
@PHXClassDecorator(PHXTException_Decorator)
class PHXBooleanArray(PHXSimpleArray)
Class wraps an array ofPHXBoolean variables for the ScriptWrapper utility.
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def fromString(self, arg1, arg2=False)Sets the value of a single element based on string input. Data is converted as appropriate. NOTE: if only one argument is provided, then thefromString()fromPHXSimpleArrayis used.@param arg1: Index to which element to set.@type arg1: string (as a comma-separated list of indices), int[], or int@param arg2: The new value.@type arg2: string@rtype: void
-
def getValue(self, index)Gets the value of an element as aPHXBooleanobject@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@rtype: boolean
-
def getBooleanValue(self, index)Gets the value of an element as a boolean@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@rtype: boolean
-
def getValueStr(self, index)Gets the value of an element as a string@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@rtype: string
-
def setValue(self, index, value)sets an element as a double@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@param value: value to set@type value: boolean@rtype: void
-
def toString(self, index="-1")Returns the array as a string.@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@rtype: string
PHXDouble
@PHXClassDecorator(PHXTException_Decorator)
class PHXDouble(PHXSimpleType)
The ModelCenter type for doubles. This class adds the following features to thePHXSimpleType:
value: doublevalueStr: the source string for the value, useful for error checking when the value is NaNhasUpperValue: booleanupperValue: doublehasLowerValue: booleanlowerValue: doubleenumValues: double[]enumValues: string[]
-
def __init__(self, varName)initializes value to zero without upper or lower bounds@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def getValue(self)retrieves the current value of the variable@rtype: double
-
def setValue(self, val)sets the value for the variable@param val: the value@type val: double@rtype: void
-
def toString(self)converts the variable to a string@rtype: string
-
def fromString(self, val)converts a String representation to the internal value@param val: the value to convert@type val: string@rtype: void
-
def getEnumAliases(self)Gets the enumeration aliases list@rtype: string[]
-
def setEnumAliases(self, aliases)Sets the enumeration aliases list@param aliases: An array of strings@type aliases: string (as a comma-separated list) or string[]@rtype: void
-
def getEnumValues(self)Gets the enumeration values list@rtype: double[]
-
def setEnumValues(self, values)Sets the enumeration values list@param values: Either a comma-separated list of values or an array of values@type values: string (as a comma-separated list) or double[]@rtype: void
-
def getFormat(self)retrieves the format of the variable@rtype: string
-
def setFormat(self, format)sets the format options@param format: the new format@type format: string@rtype: void
-
def getHasLowerBound(self)retrieves thehasLowerBoundflag@rtype: boolean
-
def setHasLowerBound(self, value)sets the lower bound. ThehasLowerBoundvalue is set totrue@type value: boolean@rtype: void
-
def getHasUpperBound(self)retrieves thehasUpperBoundflag@rtype: boolean
-
def setHasUpperBound(self, value)sets thehasUpperBoundflag@type value: boolean@rtype: void
-
def getLowerBound(self)retrieves the current lower bound value@rtype: double
-
def setLowerBound(self, value)sets the lower bound. ThehasLowerBoundvalue is set totrue@param value: the lower bound@type value: double@rtype: void
-
def getUpperBound(self)retrieves the current upper bound value@rtype: double
-
def setUpperBound(self, value)sets the upper bound. ThehasUpperBoundvalue is set totrue@param value: the upper bound@type value: double@rtype: void
-
def getValueStr(self)retrieves the current value of the variable (in string form)@rtype: string
PHXDoubleArray
@PHXClassDecorator(PHXTException_Decorator)
class PHXDoubleArray(PHXSimpleArray)
Class wraps an array ofPHXDouble variables for the ScriptWrapper utility.
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def fromString(self, arg1, arg2=False)Sets the value of a single element based on string input. Data is converted as appropriate.- NOTE: if only one argument is provided, then the
fromString()fromPHXSimpleArrayis used. @param arg1: Index to which element to set.@type arg1: string (as a comma-separated list of indices), int[], or int@param arg2: The new value.@type arg2: string@rtype: void
- NOTE: if only one argument is provided, then the
-
def toString(self, index="-1") -
def getValue(self, index)Gets an element as a double@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@rtype: double
-
def setValue(self, index, val)sets an element as a double@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@param val: value to set@type val: double@rtype: void
-
def getDoubleValue(self, index)Gets an element as a double@param index: The array index@type index: string (as a comma-separated list of indices), int[], or int@rtype: double
-
def getEnumAliases(self)Gets the enumeration aliases list@rtype: string[]
-
def setEnumAliases(self, aliases)Sets the enumeration aliases list@param aliases: An array of strings@type aliases: string (as a comma-separated list) or string[]@rtype: void
-
def getEnumValues(self)Gets the enumeration values list@rtype: double[]
-
def setEnumValues(self, values)Sets the enumeration values list@param values: Either a comma-separated list of values or an array of values@type values: string (as a comma-separated list) or double[]@rtype: void
-
def getFormat(self)retrieves the format of the variable@rtype: string
-
def setFormat(self, format)sets the format options@param format: the new format@type format: string@rtype: void
-
def getHasLowerBound(self)retrieves thehasLowerBoundflag@rtype: boolean
-
def setHasLowerBound(self, value)sets the lower bound. ThehasLowerBoundvalue is set totrue@type value: boolean@rtype: void
-
def getHasUpperBound(self)retrieves thehasUpperBoundflag@rtype: boolean
-
def setHasUpperBound(self, value)sets thehasUpperBoundflag@type value: boolean@rtype: void
-
def getLowerBound(self)retrieves the current lower bound value@rtype: double
-
def setLowerBound(self, value)sets the lower bound. ThehasLowerBoundvalue is set totrue@param value: the lower bound@type value: double@rtype: void
-
def getUpperBound(self)retrieves the current upper bound value@rtype: double
-
def setUpperBound(self, value)sets the upper bound. ThehasUpperBoundvalue is set totrue@param value: the upper bound@type value: double@rtype: void
PHXRawFile
@PHXClassDecorator(PHXTException_Decorator)
class PHXRawFile(PHXSimpleType)
The ModelCenter type for Files.-
This class has the following properties:
name: Stringcontents: String
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def fromFile(self, fileName="")Sets the filename and then reads from disk. It is preferred that you usesetName()when you create aPHXRawFileand then usereadFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param fileName: the name of the file to read from (default is blank string)@rtype: fileName`: string@rtype: void
-
def fromString(self, value)converts a String representation to the internal value@param value: the value to convert@type value: string@rtype: void
-
def getBaseName(self)gets the base name of the file@rtype: string
-
def getContents(self)retrieves the contents of the file@rtype: string
-
def getFileExtension(self)Returns the extension of the file that this object represents@rtype: string
-
def getIsBinary(self)Tells whether or not the the file is binary. Simply switches on whether or not the mime type starts with text.@rtype: boolean
-
def getMimeType(self)retrieves the mime type associated with the file variable@rtype: string
-
def getName(self)retrieves the name of the file@rtype: string
-
def getNameCoded(self)retrieves the name of the file in coded form (without$variablesreplaced)@rtype: string
-
def hasChanged(self)checks to see if the file has changed since the last timegetContents()was called@rtype: boolean
-
def markAsRead(self)call this function after you manually get the contents of the file. The function records its name and timestamp for use with thehasChanged()function@rtype: void
-
def readFile(self, fileName="")Sets the filename and then reads from disk. It is preferred that you usesetName()when you create aPHXRawFileand then usereadFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param fileName: the name of the file@rtype: fileName`: string@rtype: void
-
def setBaseName(self, name)sets the base name of the file@param name: the name@type name: string@rtype: void
-
def setContents(self, contents)sets the contents of the file. The actual file is not modified until thewriteFile()method is issued.@param contents: the contents of the file@type contents: string@rtype: void
-
def setFileExtension(self, extension)Sets the extension of the file that this object represents. It is preferred that you usesetName()and let the system automatically figure out the extension based on what you pass in. Then, you can usereadFile()andwriteFile()without passing filenames to those calls. This allows for progress monitoring to work correctly in all cases.@param extension: the new file extension for the file@type extension: string@rtype: void
-
def setIsBinary(self, flag)Forces this file to be binary or not. If this causes the mode to change, will set the mime type totext/plainorapplication/octet-streamas appropriate.@type flag: boolean@rtype: void
-
def setMimeType(self, mimeType)sets the mime type associated with the file variable@param mimeType: the mime type@type mimeType: string@rtype: void
-
def setName(self, name)sets the name of the file@param name: the name@type name: string@rtype: void
-
def toFile(self, fileName="")Sets the filename and then writes the file to disk. It is preferred that you usesetName()when you create aPHXRawFileand then usewriteFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param fileName: the name of the file to read from (default is blank string)@rtype: fileName`: string@rtype: void
-
def toString(self)converts the variable to a string@rtype: string
-
def writeFile(self, fileName="")sets the filename and then writes the file to disk. It is preferred that you usesetName()when you create aPHXRawFileand then usewriteFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param fileName: the name of the file to read from (default is blank string)@rtype: fileName`: string@rtype: void
PHXRawFileArray
@PHXClassDecorator(PHXTException_Decorator)
class PHXRawFileArray(PHXSimpleArray)
The ModelCenter type for File Array.-
This class has the following properties:
name: String
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def fromFile(self, index, fileName="")Sets the filename and then reads from disk. It is preferred that you usesetName()when you create a PHXRawFileArray and then usereadFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param fileName: the name of the file to read from (default is blank string)@rtype: fileName`: string@rtype: void
-
def fromString(self, value)converts a String representation to the internal value@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param value: the value to convert@type value: string@rtype: void
-
def getBaseName(self)gets the base name of the file@rtype: string
-
def getContents(self, index)retrieves the contents of the file@rtype: string@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int
-
def getFileExtension(self, index)Returns the extension of the file that this object represents@rtype: string@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int
-
def getIsBinary(self)Tells whether or not the the file array contains binary files. Simply switches on whether or not the mime type starts with text.@rtype: boolean
-
def getMimeType(self)retrieves the mime type associated with the file array@rtype: string
-
def getName(self, index)retrieves the name of the file@rtype: string@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int
-
def getNameCoded(self, index)retrieves the name of the file in coded form (without$variablesreplaced)@rtype: string@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int
-
def hasChanged(self, index)checks to see if the file has changed since the last timegetContents()was called@rtype: boolean@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int
-
def markAsRead(self, index)call this function after you manually get the contents of the file. The function records its name and timestamp for use with thehasChanged()function@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@rtype: void
-
def readFile(self, index, fileName="")Sets the filename and then reads from disk. It is preferred that you usesetName()when you create aPHXRawFileand then usereadFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param fileName: the name of the file@rtype: fileName`: string@rtype: void
-
def setBaseName(self, name)sets the base name of the file@param name: the name@type name: string@rtype: void
-
def setContents(self, index, contents)sets the contents of the file. The actual file is not modified until thewriteFile()method is issued.@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param contents: the contents of the file@type contents: string@rtype: void
-
def setFileExtension(self, index, extension)Sets the extension of the file that this object represents. It is preferred that you usesetName()and let the system automatically figure out the extension based on what you pass in. Then, you can usereadFile()andwriteFile()without passing filenames to those calls. This allows for progress monitoring to work correctly in all cases.@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param extension: the new file extension for the file@type extension: string@rtype: void
-
def setIsBinary(self, flag)Forces this file to be binary or not. If this causes the mode to change, will set the mime type totext/plainorapplication/octet-streamas appropriate.@type flag: boolean@rtype: void
-
def setMimeType(self, mimeType)sets the mime type associated with the file variable@param mimeType: the mime type@type mimeType: string@rtype: void
-
def setName(self, index, name)sets the name of the file@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param name: the name@type name: string@rtype: void
-
def toFile(self, index, fileName="")Sets the filename and then writes the file to disk. It is preferred that you usesetName()when you create aPHXRawFileand then usewriteFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param fileName: the name of the file to read from (default is blank string)@rtype: fileName`: string@rtype: void
-
def toString(self, index)converts the variable to a string@rtype: string@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int
-
def writeFile(self, index, fileName="")sets the filename and then writes the file to disk. It is preferred that you usesetName()when you create aPHXRawFileand then usewriteFile()without passing a filename to it. This allows progress monitoring to work correctly in all cases.@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param fileName: the name of the file to read from (default is blank string)@rtype: fileName`: string@rtype: void
PHXLong
@PHXClassDecorator(PHXTException_Decorator)
class PHXLong(PHXSimpleType)
The ModelCenter type for longs. This class adds the following features to thePHXSimpleType:
value: longvalueStr: the source string for the value, useful for error checking when the value is NaNhasUpperValue: booleanupperValue: longhasLowerValue: booleanlowerValue: longenumValues: long[]enumAliases: String[]
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def getValue(self)retrieves the current value of the variable@rtype: long
-
def setValue(self, val)sets the value for the variable@param val: the value@type val: long@rtype: void
-
def toString(self)converts the variable to a string@rtype: string
-
def fromString(self, val)converts a String representation to the internal value@param val: the value to convert@type val: string@rtype: void
-
def getEnumAliases(self)Gets the enumeration aliases list@rtype: string[]
-
def setEnumAliases(self, aliases)Sets the enumeration aliases list@param aliases: An array of strings@type aliases: string (as a comma-separated list) or string[]@rtype: void
-
def getEnumValues(self)Gets the enumeration values list@rtype: long[]
-
def setEnumValues(self, values)Sets the enumeration values list@param values: Either a comma-separated list of values or an array of values@type values: string (as a comma-separated list) or long[]@rtype: void
-
def getFormat(self)retrieves the format of the variable@rtype: string
-
def setFormat(self, format)sets the format options@param format: the new format@type format: string@rtype: void
-
def getHasLowerBound(self)retrieves thehasLowerBoundflag@rtype: boolean
-
def setHasLowerBound(self, value)sets thehasLowerBoundflag@type value: boolean@rtype: void
-
def getHasUpperBound(self)retrieves thehasUpperBoundflag@rtype: boolean
-
def setHasUpperBound(self, value)sets thehasUpperBoundflag@type value: boolean@rtype: void
-
def getLowerBound(self)retrieves the current lower bound value@rtype: long
-
def setLowerBound(self, value)sets the lower bound. ThehasLowerBoundvalue is set totrue@param value: the lower bound@type value: long@rtype: void
-
def getUpperBound(self)retrieves the current upper bound@rtype: long
-
def setUpperBound(self, value)sets the upper bound. ThehasUpperBoundvalue is set totrue@param value: the upper bound@type value: long@rtype: void
-
def getValueStr(self)retrieves the current value of the variable (in string form)@rtype: string
PHXLongArray
@PHXClassDecorator(PHXTException_Decorator)
class PHXLongArray(PHXSimpleArray)
Class wraps an array ofPHXLong variables for the ScriptWrapper utility.
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def fromString(self, arg1, arg2=False)Sets the value of a single element based on string input. Data is converted as appropriate.- NOTE: if only one argument is provided, then the
fromString()fromPHXSimpleArrayis used. @param arg1: Index to which element to set.@type arg1: string (as a comma-separated list of indices), int[], or int@param arg2: The new value.@type arg2: string@rtype: void
- NOTE: if only one argument is provided, then the
-
def toString(self, index="-1") -
def getValue(self, index)Gets the value of an element as a long@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@rtype: long
-
def setValue(self, index, val)Sets the value of an element as a long@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param val: value to set@type val: long@rtype: void
-
def getLongValue(self, index)Gets the value of an element as a long@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@rtype: long
-
def getEnumAliases(self)Gets the enumeration aliases list@rtype: string[]
-
def setEnumAliases(self, aliases)Sets the enumeration aliases list@param aliases: An array of strings@type aliases: string (as a comma-separated list) or string[]@rtype: void
-
def getEnumValues(self)Gets the enumeration values list@rtype: long[]
-
def setEnumValues(self, values)Sets the enumeration values list@param values: Either a comma-separated list of values or an array of values@type values: string (as a comma-separated list) or long[]@rtype: void
-
def getFormat(self)retrieves the format of the variable@rtype: string
-
def setFormat(self, format)sets the format options@param format: the new format@type format: string@rtype: void
-
def getHasLowerBound(self)retrieves thehasLowerBoundflag@rtype: boolean
-
def setHasLowerBound(self, value)sets thehasLowerBoundflag@type value: boolean@rtype: void
-
def getHasUpperBound(self)retrieves thehasUpperBoundflag@rtype: boolean
-
def setHasUpperBound(self, value)sets thehasUpperBoundflag@type value: boolean@rtype: void
-
def getLowerBound(self)retrieves the current lower bound value@rtype: long
-
def setLowerBound(self, value)sets the lower bound. ThehasLowerBoundvalue is set totrue@param value: the lower bound@type value: long@rtype: void
-
def getUpperBound(self)retrieves the current upper bound@rtype: long
-
def setUpperBound(self, value)sets the upper bound. ThehasUpperBoundvalue is set totrue@param value: the upper bound@type value: long@rtype: void
PHXString
@PHXClassDecorator(PHXTException_Decorator)
class PHXString(PHXSimpleType)
The ModelCenter type for Strings.-
This class adds the following features to the
PHXSimpleType:value: StringenumValues: String[]enumAliases: String[]
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def getValue(self)retrieves the current value of the variable@rtype: string
-
def setValue(self, val)sets the value for the variable@param val: the value@type val: string
-
def toString(self)converts the variable to a string@rtype: string
-
def fromString(self, val)converts a String representation to the internal value@param val: the value to convert@type val: string@rtype: void
-
def getEnumAliases(self)Gets the enumeration aliases list@rtype: string[]
-
def setEnumAliases(self, aliases)Sets the enumeration aliases list@param aliases: An array of strings@type aliases: string (as a comma-separated list) or string[]@rtype: void
-
def getEnumValues(self)Gets the enumeration values list@rtype: string[]
-
def setEnumValues(self, values)Sets the enumeration values list@param values: Either a comma-separated list of values or an array of values@type values: string (as a comma-separated list) or string[]@rtype: void
PHXStringArray
@PHXClassDecorator(PHXTException_Decorator)
class PHXStringArray(PHXSimpleArray)
Class wraps an array ofPHXString variables for the ScriptWrapper utility.
-
def __init__(self, varName)@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def fromString(self, arg1, arg2=False)Sets the value of a single element based on string input. Data is converted as appropriate. NOTE: if only one argument is provided, then thefromString()fromPHXSimpleArrayis used.@param arg1: Index to which element to set.@type arg1: string (as a comma-separated list of indices), int[], or int@param arg2: The new value.@type arg2: string@rtype: void
-
def toString(self, index="-1") -
def getValue(self, index)Gets a particular element as a String@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@rtype: string
-
def setValue(self, index, val)Sets the value of an element as a long@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@param val: value to set@type val: string@rtype: void
-
def getStringValue(self, index)Gets a particular element as a String@param index: Index to which element to set.@type index: string (as a comma-separated list of indices), int[], or int@rtype: string
-
def getEnumAliases(self)Gets the enumeration aliases list@rtype: string[]
-
def setEnumAliases(self, aliases)Sets the enumeration aliases list@param aliases: An array of strings@type aliases: string (as a comma-separated list) or string[]@rtype: void
-
def getEnumValues(self)Gets the enumeration values list@rtype: string[]
-
def setEnumValues(self, values)Sets the enumeration values list@param values: Either a comma-separated list of values or an array of values@type values: string (as a comma-separated list) or string[]@rtype: void
PHXScriptObject
@PHXClassDecorator(PHXTException_Decorator)
class PHXScriptObject(PHXSimpleType)
The ModelCenter type for object variable. This class adds the following features to thePHXSimpleType:
-
className: string -
def __init__(self, varName)Create a data object. The internal script object still needs to be initialized via initialize method@param varName: the name of the variable already declared in the wrapper to reference@type varName: string@rtype: void
-
def toString(self)converts the variable to a string-
@rtype: string return phxPython.objToString(self.mcName)
-
-
def fromString(self, val)converts a String representation to the internal value@param val: the value to convert@type val: string@rtype: void
-
def getClassURL(self)return the class URL@rtype: string
-
def getMemberValueAsString(self, mIndex)return member value@param mIndex: index of the member@type mIndex: string@rtype: string
-
def getDoubleMemberValue(self, mIndex)return member value@param mIndex: index of the member@type mIndex: string@rtype: double
-
def getIntMemberValue(self, mIndex)return member value@param mIndex: index of the member@type mIndex: string@rtype: int
-
def getBooleanMemberValue(self, mIndex)return member value@param mIndex: index of the member@type mIndex: string@rtype: boolean
-
def getStringMemberValue(self, mIndex)return member value@param mIndex: index of the member@type mIndex: string@rtype: string
-
def getDoubleArrayMemberValue(self, mIndex, index)return member value@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@rtype: double
-
def getIntArrayMemberValue(self, mIndex, index)return member value@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@rtype: int
-
def getBooleanArrayMemberValue(self, mIndex, index)return member value@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@rtype: boolean
-
def getStringArrayMemberValue(self, mIndex, index)return member value@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@rtype: string
-
def setMemberValueFromString(self, mIndex, value)set value of a member@param mIndex: index of the member@type mIndex: string@param value: value of the member@type value: string@rtype: void
-
def setDoubleMemberValue(self, mIndex, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param value: value of the member@type value: double@rtype: void
-
def setIntMemberValue(self, mIndex, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param value: value of the member@type value: int@rtype: void
-
def setBooleanMemberValue(self, mIndex, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param value: value of the member@type value: boolean@rtype: void
-
def setStringMemberValue(self, mIndex, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param value: value of the member@type value: string@rtype: void
-
def setDoubleArrayMemberValue(self, mIndex, index, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@param value: value of the member@type value: double@rtype: void
-
def setIntArrayMemberValue(self, mIndex, index, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@param value: value of the member@type value: int@rtype: void
-
def setBooleanArrayMemberValue(self, mIndex, index, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@param value: value of the member@type value: boolean@rtype: void
-
def setStringArrayMemberValue(self, mIndex, index, value)set value of a double member@param mIndex: index of the member@type mIndex: string@param index: Index to an array element@type index: string (as a comma-separated list of indices), int[], or int@param value: value of the member@type value: string@rtype: void
-
def setMember(self, mIndex, value, typeStr)set member. Create a member if not exists.@param mIndex: index of the member@type mIndex: string@param value: value of the member@type value: string@param typeStr: type of the member@type typeStr: string@rtype: void
-
def deleteMember(self, mIndex)delete a member@param mIndex: index of the member@type mIndex: string@rtype: void
-
def deleteAllMembers(self)delete all members@rtype: void
-
def callMethod(self, method)call an object method@param method: name of the method@type method: string@rtype: void
-
def isNonStrictType(self)return true if the object is a non-strict type@rtype: bool
-
def toXML(self)return XML representation of the object@rtype: string
-
def fromXML(self, xmlStr)set the content of the object from the XML string@param xmlStr: XML representation of object@type xmlStr: string@rtype: void
-
def hasMember(self, mIndex)return true if the member exists@param mIndex: index of the member@type mIndex: string@rtype: bool
-
def getMemberLength(self, mIndex, dim=0)return length of an ND array@param mIndex: index of the member@type mIndex: string@param dim: specified dimension@type dim: int@rtype: int or list of int
-
def setMemberLength(self, mIndex, length, dim=0)return length of an ND array@param mIndex: index of the member@type mIndex: string@param length: size of the dimension@type length: int@param dim: specified dimension@type dim: int@rtype: void
-
def setMemberDimensions(self, mIndex, dim)Sets the dimensions of an array member.@param mIndex: index of the member@type mIndex: string@param dim: the new dimensions for the array@type dim: int[]@rtype: void
-
def getMemberNumDimensions(self, mIndex)Gets the number of dimensions of an array member@param mIndex: index of the member@type mIndex: string@rtype: int
-
def getMemberDimensions(self, mIndex)gets the dimensions of an array member@param mIndex: index of the member@type mIndex: string@rtype: int[]
-
def getMemberType(self, mIndex)return member type@param mIndex: index of the member@type mIndex: string@rtype: string
-
def hasMemberLowerBound(self, mIndex)return true if the member haslowerbounddefined@param mIndex: index of the member@type mIndex: string@rtype: bool
-
def hasMemberUpperBound(self, mIndex)return true if the member hasupperbounddefined@param mIndex: index of the member@type mIndex: string@rtype: bool
-
def getMemberLowerBound(self, mIndex)return member’s lower bound@param mIndex: index of the member@type mIndex: string@rtype: string
-
def setMemberLowerBound(self, mIndex, lowerBound)set member’s lower bound@param mIndex: index of the member@type mIndex: string@param lowerBound: lower bound@type lowerBound: string@rtype: void
-
def getMemberUpperBound(self, mIndex)return member’s upper bound@param mIndex: index of the member@type mIndex: string@rtype: string
-
def setMemberUpperBound(self, mIndex, upperBound)set member’s upper bound@param mIndex: index of the member@type mIndex: string@param upperBound: upper bound@type upperBound: string@rtype: void
-
def getMemberEnumValues(self, mIndex)return member’s enum values@param mIndex: index of the member@type mIndex: string@rtype: string
-
def setMemberEnumValues(self, mIndex, enumValues)set member’s enum values@param mIndex: index of the member@type mIndex: string@param enumValues: enum values@type enumValues: string@rtype: void
-
def getMemberEnumAliases(self, mIndex)return member’s enum aliases@param mIndex: index of the member@type mIndex: string@rtype: string
-
def setMemberEnumAliases(self, mIndex, enumAliases)set member’s enum aliases@param mIndex: index of the member@type mIndex: string@param enumAliases: enum aliases@type enumAliases: string@rtype: void
-
def getMemberDescription(self, mIndex)return member’s description@param mIndex: index of the member@type mIndex: string@rtype: string
-
def setMemberDescription(self, mIndex, description)set member’s enum aliases@param mIndex: index of the member@type mIndex: string@param description: description@type description: string@rtype: void
-
def getMemberUnits(self, mIndex)return member’s units@param mIndex: index of the member@type mIndex: string@rtype: string
-
def setMemberUnits(self, mIndex, units)set member’s units@param mIndex: index of the member@type mIndex: string@param units: units@type units: string@rtype: void
-
def getMemberProperty(self, mIndex, propertyName)return member’s property@param mIndex: index of the member@type mIndex: string@param propertyName: name of the property@type propertyName: string@rtype: string
-
def setMemberProperty(self, mIndex, propertyName, propertyValue)set member’s property@param mIndex: index of the member@type mIndex: string@param propertyName: property name@type propertyName: string@param propertyValue: property value@type propertyValue: string@rtype: void
-
def fromFile(self, mIndex, fileName="")set content of a file or file array member from a file@param mIndex: index of the member@type mIndex: string@param fileName: file name@rtype: fileName`: string@rtype: void
-
def toFile(self, mIndex, fileName="")write content of a file or file array member to a file@param mIndex: index of the member@type mIndex: string@param fileName: file name@rtype: fileName`: string@rtype: void
-
def getIsBinary(self, mIndex)returnTrueif the file or file array member contains a binary file@param mIndex: index of the member@type mIndex: string@rtype: boolean
-
def setIsBinary(self, mIndex, isBinary)set whether the file or file array member contains a binary file@param mIndex: index of the member@type mIndex: string@param isBinary: whether it is a binary or not@type isBinary: boolean@rtype: void
-
def getFileName(self, mIndex)return file name of the file or file array member@param mIndex: index of the member@type mIndex: string@rtype: string
-
def setFileName(self, mIndex, fileName)set file name for file or file array member@param mIndex: index of the member@type mIndex: string@param fileName: file name@rtype: fileName`: string@rtype: void
-
def setFileExtension(self, mIndex, fileExtension)set file extension for file or file array member@param mIndex: index of the member@type mIndex: string@param fileExtension: file extension@type fileExtension: string@rtype: void
-
def setBaseName(self, mIndex, baseName)set base directory for file or file array member@param mIndex: index of the member@type mIndex: string@param baseName: base directory@type baseName: string@rtype: void