Model Utility Methods
The following table summarizes the model utility methods for querying, creating, loading, and saving model objects. The model object is stored on the MPH file format.
For the built-in application methods loadModel(<location>) and loadModel(<tag>, <location>) the <location> argument scan either be the path to an MPH-file found on the file system or a model location URI referencing a model version in a Model Manager database.
Example Code
The code below loads a model using loadModel, presented in the table above. It extracts the x-, y-, and z-coordinates of all mesh nodes and stores them in a 2D double array coords[3][N], where N is the number of mesh nodes. The individual x-,y-, and z- coordinates are available as the length-N 1D arrays coords[0], coords[1], coords[2], respectively. (The node locations can be plotted by using the Cut Point 3D dataset in combination with a 3D Point Trajectories plot.)
Model extmodel = loadModel("C:\\Paul\\pacemaker_electrode.mph");
SolverFeature step = extmodel.sol("sol1").feature("v1");
XmeshInfo xmi = step.xmeshInfo();
XmeshInfoNodes nodes = xmi.nodes();
double[][] coords = nodes.coords();
For more information on methods operating on the model object, see the Programming Reference Manual.
Note that to make the code above platform independent for use in an application you can instead use the common application file folder:
Model extmodel = loadModel("common:///pacemaker_electrode.mph");