ModelUtil.create(<tag>) creates a model with tag
<tag>. Returns a reference to the model. If there is already a model with this tag the previous model is removed.
ModelUtil.remove(<tag>) removes the model tagged
<tag>.
ModelUtil.clear() removes all models.
ModelUtil.tags() obtains the current list of model tags.
ModelUtil.model(<tag>) returns a reference to the model tagged
<tag>.
ModelUtil.closeWindow(<windowtag>) closes the window tagged
<windowtag>.
ModelUtil.closeWindows() closes all windows on the server.
ModelUtil.createApplication(<tag>,<appname>) creates a new application model with the tag
<tag> and the name
<appname> using the given application file reference.
ModelUtil.createUnique(<prefix>) creates a model with a unique tag that begins with the prefix
<prefix>.
ModelUtil.getOpenGeometryKernel() returns the geometry kernel to use when opening models. Valid values are
model for the geometry kernel used by the model file, and
comsol to convert the geometry to the COMSOL kernel.
ModelUtil.getDefaultGeometryKernel() returns the default geometry kernel in new models. Valid values are
comsol for the COMSOL kernel and
cadps for the CAD kernel (Parasolid kernel). The CAD kernel requires the CAD Import Module.
ModelUtil.setOpenGeometryKernel(<openkernel>) specifies the geometry kernel to use when opening models. Valid values are
model for the geometry kernel used by the model file, and
comsol to convert the geometry to the COMSOL kernel.
ModelUtil.setDefaultGeometryKernel(<defaultkernel>) specifies the default geometry kernel to use in new models with the string
<defaultkernel>. Valid values are
comsol for the COMSOL kernel and
cadps for the CAD kernel (Parasolid kernel). The CAD kernel requires the CAD Import Module.
ModelUtil.getEntityPath(<entity>,<divider>) creates the path from the root of the model object for the given entity
<entity>.
<divider> specifies a divider to use between entities in path.
ModelUtil.load(<tag>,<filename>) loads a model from a file
<filename> in the client’s file system and names it
<tag>. Loading a file from a directory sets the model directory. The model directory is used for saving files if you do not provide an absolute path to the file.
ModelUtil.loadCopy(<tag>,<filename>) loads a copy of a model from a file
<filename> in the client’s file system and names it
<tag>. The
loadCopy method is the same as
load except that the loaded model is not associated with the file, so
model.save() does not work. You have to specify the filename the first time you save it again.
ModelUtil.loadOnServer(<tag>,<filename>) works like
ModelUtil.load except that the filename is a path on the server computer. The client does not have to have access to the file.
ModelUtil.loadProtected(<tag>,<filename>,<password>) works like
ModelUtil.loadOnServer but with password protection.
ModelUtil.loadProtectedOnServer(<tag>,<filename>,<password>) works like
ModelUtil.loadOnServer but with password protection.
ModelUtil.loadRecovery(<tag>,<foldername>) loads a model from a recovery directory or folder structure in the client’s file system and names it
<tag>.
ModelUtil.showProgress(bool) turns on or off showing of progress in a window or on a file when running lengthy tasks when connected to a server. The return value is a Boolean value that is true if showing progress is possible.
ModelUtil.showProgress(<filename>) turns on logging of progress to the file
<filename> in the client’s file system. If
<filename> is
null progress is logged to the standard output.
ModelUtil.connect(<host>,<port>) connects to a COMSOL server. The arguments
<host> and
<port> provide host name and port number for the COMSOL server.
ModelUtil.initStandalone(bool) Initializes the environment for using the COMSOL API from a standalone Java
® application. You should
not use this command from the LiveLink™
for MATLAB®. Set the argument to true if support for plotting in a GUI using Java Swing widgets should be available.
ModelUtil.initStandalone(bool,<guiToolkit>) allows to specify that support for using a given Java GUI toolkit should be available. The optional
<guiToolkit> parameter can have the values
"swing" or
"swt" telling that Swing widgets or widgets from the Standard Widget Toolkit (SWT) can be used.
ModelUtil.getPreference(<prefsName>) returns the value of a preference.
ModelUtil.setPreference(<prefsName>, <value>) sets the value of a preference.
ModelUtil.listPreferences() returns a string with a listing of the preferences names and their descriptions.
ModelUtil.loadPreferences() loads the preferences from file. Use this is standalone Java application which do not load the preferences at launch time.
ModelUtil.savePreferences() saves the preferences to file.
ModelUtil.uniquetag() returns a unique model tag that is not in use.
ModelUtil provides functionality to control COMSOL client/server options. You can connect/disconnect and control connections from multiple clients to a server.
ModelUtil.connect() connects to a COMSOL server. The COMSOL command arguments
-Dcs.host=<host> and
-Dcs.port=<port> can provide host name and port number. In case those are not provided, and the both client and server access the same file system, the host and port can be automatically transferred.
ModelUtil.disconnect() disconnects from a COMSOL server.
ModelUtil.setServerBusyHandler(<ServerBusyHandler>) Several clients can be connected to the same server, but only one client at a time can ask the server to perform an operation. The default behavior when attempting to call the server when it is busy is to throw an exception. By registering a
ServerBusyHandler it is possible to make the client wait until the server is free again, and to set a time-out for how long to wait.
ServerBusyHandler is a class which controls how long a client waits for a busy server to become free again. It also has hooks to perform any action on the client side before starting to wait and just after stopping to wait. Implement a subclass in Java to
ServerBusyHandler to change the default behavior.
ServerBusyHandler() creates a server busy handler which waits for the server to be free without any time-out.
ServerBusyHandler(<timeOut>) creates a server busy handler which waits for the server to be free.
postWaitForServer(<boolean>) is a hook to perform any action right after waiting for the server to become free.
preWaitForServer(<host>, <port>) is a hook to perform any action before beginning to wait for the server to become free.
ModelUtil.setModelChangedHandler(<ModelChangedHandler>) registers a handler of changes to models made by other clients. If any other client changes any model in use by this client, the model change handler is notified.
ModelChangedHandler is an interface for handle updates of the client when another client has modified any models in use by this client. Implement the interface in Java to change the default behavior.
handleModelChangeOnServer(<modelChangeInfo>) is called when another client has changed any models in use by this client.
ModelChangeInfo is a class with information about changes to models by other clients.
getModelTags() returns the tags of the models which have changed.