Package com.comsol.model
Interface ParamBase
-
- All Superinterfaces:
ExpressionBase
,ModelEntity
,PrimitiveModelEntity
- All Known Subinterfaces:
ModelParam
,ResultParam
public interface ParamBase extends ExpressionBase
Base interface for sets of parameters.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
evaluate(java.lang.String expression)
Evaluates an expression, including functions, parameters and units.double
evaluate(java.lang.String expression, java.lang.String unit)
Evaluates an expression, including functions, parameters and units.double[]
evaluateComplex(java.lang.String expression)
Evaluates an expression, including functions, parameters and units.double[]
evaluateComplex(java.lang.String expression, java.lang.String unit)
Evaluates an expression, including functions, parameters and units.java.lang.String
evaluateUnit(java.lang.String expr)
Evaluates the unit of an expression.void
loadFile(java.lang.String path)
Loads from a file.void
loadFile(java.lang.String path, char delim)
Loads from a file using a specified delimiter.void
loadFile(java.lang.String path, char delim, boolean separateUnitColumns)
Loads from a file using a specified delimiter.void
loadFile(java.lang.String path, java.lang.String sheet, java.lang.String range)
Loads from an Excel-file with a specified range to read, or a cell to start from, in the specified sheet.void
loadFile(java.lang.String path, java.lang.String sheet, java.lang.String range, boolean separateUnitColumns)
Loads from an Excel-file with a specified range to read, or a cell to start from, in the specified sheet.void
saveFile(java.lang.String path)
Saves to a file.void
saveFile(java.lang.String path, char delim)
Saves to a file using a specified delimiter.void
saveFile(java.lang.String path, char delim, boolean separateUnitColumns)
Saves to a file using a specified delimiter.void
saveFile(java.lang.String path, java.lang.String sheet, java.lang.String range, boolean includeHeaders, boolean overwrite)
Saves to an Excel-file in a specified range, or at a cell to start from, in a specified sheet.void
saveFile(java.lang.String path, java.lang.String sheet, java.lang.String range, boolean includeHeaders, boolean overwrite, boolean separateUnitColumns)
Saves to an Excel-file in a specified range, or at a cell to start from, in a specified sheet.-
Methods inherited from interface com.comsol.model.ExpressionBase
clear, descr, descr, get, remove, remove, rename, set, set, set, set, varnames
-
Methods inherited from interface com.comsol.model.ModelEntity
active, author, author, comments, comments, dateCreated, dateModified, docMarker, docMarker, help, help, icon, isactive, isActive, label, label, lastModifiedBy, model, model, name, name, resetAuthor, scope, tag, tag, timeCreated, timeModified, version, version
-
Methods inherited from interface com.comsol.model.PrimitiveModelEntity
getContainer, getDisplayString, resolveModelPath
-
-
-
-
Method Detail
-
evaluate
double evaluate(java.lang.String expression)
Evaluates an expression, including functions, parameters and units. If the result is not a real scalar, an error is given.- Parameters:
expression
- The expression.- Returns:
- The evaluated real value.
-
evaluate
double evaluate(java.lang.String expression, java.lang.String unit)
Evaluates an expression, including functions, parameters and units. The result is converted to the specified unit. If the result is not a real scalar, an error is given.- Parameters:
expression
- The expression.unit
- The unit.- Returns:
- The evaluated real value in the given unit.
-
evaluateComplex
double[] evaluateComplex(java.lang.String expression)
Evaluates an expression, including functions, parameters and units. If the result is not a complex scalar, an error is given.- Parameters:
expression
- The parameter name.- Returns:
- The evaluated value as an array of two doubles with the real and imaginary part.
-
evaluateComplex
double[] evaluateComplex(java.lang.String expression, java.lang.String unit)
Evaluates an expression, including functions, parameters and units. The result is converted to the specified unit. If the result is not a complex scalar, an error is given.- Parameters:
expression
- The expression.unit
- The unit.- Returns:
- The value of the parameter in the given unit as an array of two doubles with the real and imaginary part.
-
evaluateUnit
java.lang.String evaluateUnit(java.lang.String expr)
Evaluates the unit of an expression.- Parameters:
expr
- The expression.- Returns:
- The unit as a string. Returns
null
if the parameter has no unit defined, or if the model does not use units.
-
loadFile
void loadFile(java.lang.String path)
Loads from a file.- Parameters:
path
- Path to file.
-
loadFile
void loadFile(java.lang.String path, char delim)
Loads from a file using a specified delimiter.- Parameters:
path
- Path to file.delim
- Delimiter to use.
-
loadFile
void loadFile(java.lang.String path, java.lang.String sheet, java.lang.String range)
Loads from an Excel-file with a specified range to read, or a cell to start from, in the specified sheet.- Parameters:
path
- Path to file.sheet
- The Excel-sheet to use.range
- The range, or a starting cell.
-
loadFile
void loadFile(java.lang.String path, char delim, boolean separateUnitColumns)
Loads from a file using a specified delimiter.- Parameters:
path
- Path to file.delim
- Delimiter to use.separateUnitColumns
- True to split expression columns into expression and unit.
-
loadFile
void loadFile(java.lang.String path, java.lang.String sheet, java.lang.String range, boolean separateUnitColumns)
Loads from an Excel-file with a specified range to read, or a cell to start from, in the specified sheet.- Parameters:
path
- Path to file.sheet
- The Excel-sheet to use.range
- The range, or a starting cell.separateUnitColumns
- True to split expression columns into expression and unit.
-
saveFile
void saveFile(java.lang.String path)
Saves to a file.- Parameters:
path
- Path to file.
-
saveFile
void saveFile(java.lang.String path, char delim)
Saves to a file using a specified delimiter.- Parameters:
path
- Path to file.delim
- Delimiter to use.
-
saveFile
void saveFile(java.lang.String path, char delim, boolean separateUnitColumns)
Saves to a file using a specified delimiter.- Parameters:
path
- Path to file.delim
- Delimiter to use.separateUnitColumns
- True to split expression columns into expression and unit.
-
saveFile
void saveFile(java.lang.String path, java.lang.String sheet, java.lang.String range, boolean includeHeaders, boolean overwrite)
Saves to an Excel-file in a specified range, or at a cell to start from, in a specified sheet.- Parameters:
path
- Path to file.sheet
- The Excel-sheet to use.range
- The range, or a starting cell.includeHeaders
- True if column headers are to be written.overwrite
- True if an existing file is to be overwritten, or if an error should be cast in that instance.
-
saveFile
void saveFile(java.lang.String path, java.lang.String sheet, java.lang.String range, boolean includeHeaders, boolean overwrite, boolean separateUnitColumns)
Saves to an Excel-file in a specified range, or at a cell to start from, in a specified sheet.- Parameters:
path
- Path to file.sheet
- The Excel-sheet to use.range
- The range, or a starting cell.includeHeaders
- True if column headers are to be written.overwrite
- True if an existing file is to be overwritten, or if an error should be cast in that instance.separateUnitColumns
- True to split expression columns into expression and unit.
-
-