|
EpetraExt Development
|
00001 //@HEADER 00002 // *********************************************************************** 00003 // 00004 // MATLAB Engine Package 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 //@HEADER 00028 00029 #ifndef MATLAB_ENGINE_H 00030 #define MATLAB_ENGINE_H 00031 #include <Epetra_ConfigDefs.h> 00032 00033 #ifdef EPETRA_MPI 00034 #include "Epetra_MpiComm.h" 00035 #else 00036 #include "Epetra_SerialComm.h" 00037 #endif 00038 #include "Epetra_Comm.h" 00039 00040 // the following deal with matlab provided headers: 00041 #include "engine.h" 00042 #include "mex.h" 00043 #undef printf // matlab has its own printf that we don't want to use 00044 00045 class Epetra_MultiVector; 00046 class Epetra_RowMatrix; 00047 class Epetra_CrsGraph; 00048 class Epetra_SerialDenseMatrix; 00049 class Epetra_BlockMap; 00050 class Epetra_IntSerialDenseMatrix; 00051 class Epetra_CrsMatrix; 00052 00053 namespace EpetraExt { 00054 00056 00102 class EpetraExt_MatlabEngine { 00103 00104 public: 00105 00107 00109 00115 EpetraExt_MatlabEngine(const Epetra_Comm& Comm); 00116 00118 ~EpetraExt_MatlabEngine(); 00120 00122 00124 00138 int EvalString (char* command, char* outputBuffer = NULL, int outputBufferSize = -1); 00139 00141 00143 00145 00155 int PutMultiVector(const Epetra_MultiVector& A, const char* variableName); 00156 00158 00173 int PutRowMatrix(const Epetra_RowMatrix& A, const char* variableName, bool transA); 00174 00176 int PutCrsGraph(const Epetra_CrsGraph& A, const char* variableName, bool transA); 00177 00179 00194 int PutSerialDenseMatrix(const Epetra_SerialDenseMatrix& A, const char* variableName, int proc=0); 00195 00197 00212 int PutIntSerialDenseMatrix(const Epetra_IntSerialDenseMatrix& A, const char* variableName, int proc=0); 00213 00215 00230 int PutBlockMap(const Epetra_BlockMap& blockMap, const char* variableName, bool transA); 00231 00233 00252 int PutIntoMatlab(const char* variableName, mxArray* matlabA); 00253 00255 00257 00259 00270 int GetMultiVector(const char* variableName, Epetra_MultiVector& A); 00271 00273 00287 int GetSerialDenseMatrix(const char* variableName, Epetra_SerialDenseMatrix& A, int proc=0); 00288 00290 00304 int GetIntSerialDenseMatrix(const char* variableName, Epetra_IntSerialDenseMatrix& A, int proc=0); 00305 00307 00326 int GetCrsMatrix(const char* variableName, Epetra_CrsMatrix& A, bool getTrans); 00327 00329 00331 00333 00353 int GetmxArrayDimensions(mxArray* matlabA, bool& isSparse, int& numRows, int& numCols, int& numNonZeros); 00354 00356 00369 int GetmxArray(const char* variableName, mxArray** matlabA); 00370 00372 00373 private: 00374 // the Matlab Engine object provided by libeng and engine.h 00375 Engine* Engine_ ; 00376 // the Epetra_Comm object that will be used for all communication 00377 const Epetra_Comm& Comm_ ; 00378 00379 }; 00380 } // namespace EpetraExt 00381 00382 #endif /* MATLAB_ENGINE_H */
1.7.4