|Engine * ||Engine_|
|const Epetra_Comm & ||Comm_|
| ||EpetraExt_MatlabEngine (const Epetra_Comm &Comm)|
| ||EpetraExt_MatlabEngine constructor which creates a MatlabEngine object with a connection to an instance of the application Matlab by starting a new Matlab process. |
| ||~EpetraExt_MatlabEngine ()|
| ||EpetraExt_MatlabEngine destructor which closes the connection to Matlab which causes the Matlab process to also exit. |
|int ||EvalString (char *command, char *outputBuffer=NULL, int outputBufferSize=-1)|
| ||Sends a command to Matlab. |
|int ||PutMultiVector (const Epetra_MultiVector &A, const char *variableName)|
| ||Puts a copy of the serial or distributed MultiVector into the Matlab workspace. |
|int ||PutRowMatrix (const Epetra_RowMatrix &A, const char *variableName, bool transA)|
| ||Puts a copy of the serial or distributed RowMatrix into the Matlab workspace. |
|int ||PutCrsGraph (const Epetra_CrsGraph &A, const char *variableName, bool transA)|
| ||not implemented yet |
|int ||PutSerialDenseMatrix (const Epetra_SerialDenseMatrix &A, const char *variableName, int proc=0)|
| ||Puts a copy of the SerialDenseMatrix into the Matlab workspace. |
|int ||PutIntSerialDenseMatrix (const Epetra_IntSerialDenseMatrix &A, const char *variableName, int proc=0)|
| ||Puts a copy of the IntSerialDenseMatrix into the Matlab workspace. |
|int ||PutBlockMap (const Epetra_BlockMap &blockMap, const char *variableName, bool transA)|
| ||Puts a copy of the BlockMap or Map into the Matlab workspace. |
|int ||PutIntoMatlab (const char *variableName, mxArray *matlabA)|
| ||Puts a mxArray into Matlab. |
|int ||GetMultiVector (const char *variableName, Epetra_MultiVector &A)|
| ||Puts a Matlab variable into a MultiVector. |
|int ||GetSerialDenseMatrix (const char *variableName, Epetra_SerialDenseMatrix &A, int proc=0)|
| ||Puts a Matlab variable into a SerialDenseMatrix on the specified PE. |
|int ||GetIntSerialDenseMatrix (const char *variableName, Epetra_IntSerialDenseMatrix &A, int proc=0)|
| ||Puts a Matlab variable into a IntSerialDenseMatrix on the specified PE. |
|int ||GetCrsMatrix (const char *variableName, Epetra_CrsMatrix &A, bool getTrans)|
| ||Puts a Matlab variable into a CrsMatrix. |
|int ||GetmxArrayDimensions (mxArray *matlabA, bool &isSparse, int &numRows, int &numCols, int &numNonZeros)|
| ||Get general information about the mxArray. For internal use but can be used by an advanced user. |
|int ||GetmxArray (const char *variableName, mxArray **matlabA)|
| ||Get a mxArray from Matlab. For internal use but can be used by an advanced user. |
A class which provides data and command access to Matlab from Epetra.
The EpetraExt_MatlabEngine class allows Epetra data objects to be exported to Matlab and then operated on within Matlab using Matlab commands.
When an EpetraExt_MatlabEngine object is constructed a new instance of the application Matlab is started for EpetraExt_MatlabEngine to communicate with. All communication between EpetraExt_MatlabEngine and Matlab occurs on the root node (0) only. For parallel environments all objects are collected onto the root node before being put into Matlab. Object data is put into a mxArray which is then sent to the Matlab process. All objects passed to Matlab are copied into the Matlab memory space. So at the point when Matlab receives its copy of the data there is two copies of the mxArray in memory, one in the Epetra application and one in Matlab. Since Matlab has its own memory space the mxArray in the Epetra application should be deleted in order to free up memory space. All methods in EpetraExt_MatlabEngine that put Epetra objects into Matlab delete the temporary mxArray as soon as it is put into Matlab. If a user desires to create his/her own mxArray's and then send them to Matlab the method PutIntoMatlab can be used. It is important to note that PutIntoMatlab does NOT delete the mxArray it is passed. When the EpetraExt_MatlabEngine deconstructor is called the instance of Matlab that was started during construction of the EpetraExt_MatlabEngine object exits.
-1 engPutVariable (Matlab provided C function) returned a nonzero result
-2 internal gather of epetra object and copy to matlab object returned a nonzero result
-3 engEvalString (Matlab provided C function) returned a nonzero result
-4 engOutputBuffer (Matlab provided C function) returned a nonzero result
-5 GetmxArray returned a nonzero result, the variable requested probably does not exist in the Matlab workspace
-6 GetmxArrayDimensions determined that the mxArray from Matlab has greater than 2 dimensions
-7 a sparse Matlab mxArray was passed to a method that requires a dense mxArray
-8 a dense Matlab mxArray was passed to a method that requires a sparse mxArray
These instructions can be found in the file Trilinos/packages/epetraext/doc/matlab.README.
The following example code generates simple Epetra objects and then puts them into Matlab.
The point of this example is to illustrate the flow of calls when using EpetraExt_MatlabEngine. This example program can be found in the file Trilinos/packages/epetraext/example/matlab/cxx_main.cpp.
Definition at line 115 of file EpetraExt_MatlabEngine.h.
||const char *
Puts a mxArray into Matlab.
The Matlab provided C library provides mxArray which is used to construct and fill a Matlab object before sending it to Matlab to be put into the Matlab workspace. The mxArray is copied into the Matlab memory space and is not needed after it has been passed to Matlab. mxArrays should be destroyed using mxDestoryArray(mxArray) when they are no longer needed by the C/C++ program using them. Objects in Matlab must be destroyed using EvalString(char* command) and the appropriate Matlab command to destroy the object. EpetraExt::MatlabEngine uses PutIntoMatlab to pass all mxArrays it generates into Matlab. However, a user can create, fill, and put his/her own mxArrays into Matlab using this method. To create a mxArray mex.h must be included. For more information on how to use mxArrays see Matlab's documentation (type helpdesk at the Matlab command prompt) and see the External API Reference section.
|variableName||(In) the name for the mxArray once it has been put into the Matlab workspace|
|matlabA||(In) the mxArray to put into the Matlab workspace|
- Matlab error code from engPutVariable for Matlab versions >= 6.5 or from engPutArray for all other versions
Definition at line 379 of file EpetraExt_MatlabEngine.cpp.
Get general information about the mxArray. For internal use but can be used by an advanced user.
Makes several Matlab function calls on the mxArray in order to determine the number of rows, columns, nonzeros, and whether or not the mxArray is sparse.
|matlabA||(In) the mxArray to get information about|
|isSparse||(Out) true if the mxArray is sparse|
|numRows||(Out) the number of rows in the mxArray|
|numCols||(Out) the number of columns in the mxArray|
|numNonZeros||(Out) the number of nonzeros in the mxArray|
- Error Codes, see Detailed Description for more information
Definition at line 576 of file EpetraExt_MatlabEngine.cpp.