[12011] | 1 | /*\file matlabio.h
|
---|
| 2 | *\brief: I/O for ISSM in matlab mode
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | #ifndef _MATLAB_IO_H_
|
---|
| 6 | #define _MATLAB_IO_H_
|
---|
| 7 |
|
---|
| 8 | #ifdef HAVE_CONFIG_H
|
---|
| 9 | #include <config.h>
|
---|
| 10 | #else
|
---|
| 11 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
| 12 | #endif
|
---|
| 13 |
|
---|
| 14 | #include "../../objects/objects.h"
|
---|
| 15 | #include "../../Container/Container.h"
|
---|
| 16 | #include "../../include/include.h"
|
---|
| 17 |
|
---|
| 18 | #include <mex.h>
|
---|
| 19 |
|
---|
| 20 | void WriteData(mxArray** pdataref,Matrix* matrix);
|
---|
| 21 | void WriteData(mxArray** pdataref,double* matrix, int M,int N);
|
---|
| 22 | void WriteData(mxArray** pdataref,int* matrix, int M,int N);
|
---|
| 23 | void WriteData(mxArray** pdataref,Vector* vector);
|
---|
| 24 | void WriteData(mxArray** pdataref,double* vector, int M);
|
---|
| 25 | void WriteData(mxArray** pdataref,int integer);
|
---|
| 26 | void WriteData(mxArray** pdataref,bool boolean);
|
---|
| 27 | void WriteData(mxArray** pdataref,double scalar);
|
---|
| 28 | void WriteData(mxArray** pdataref,char* string);
|
---|
[12043] | 29 | void WriteData(mxArray** pdataref,BamgGeom* bamggeom);
|
---|
| 30 | void WriteData(mxArray** pdataref,BamgMesh* bamgmesh);
|
---|
[12011] | 31 |
|
---|
| 32 | void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref);
|
---|
| 33 | void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
|
---|
| 34 | void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref);
|
---|
| 35 | void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref);
|
---|
| 36 | void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
|
---|
| 37 | void FetchData(Matrix** pmatrix,const mxArray* dataref);
|
---|
| 38 | void FetchData(int** pvector,int* pM,const mxArray* dataref);
|
---|
| 39 | void FetchData(float** pvector,int* pM,const mxArray* dataref);
|
---|
| 40 | void FetchData(double** pvector,int* pM,const mxArray* dataref);
|
---|
| 41 | void FetchData(bool** pvector,int* pM,const mxArray* dataref);
|
---|
| 42 | void FetchData(Vector** pvector,const mxArray* dataref);
|
---|
| 43 | void FetchData(char** pstring,const mxArray* dataref);
|
---|
| 44 | void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
|
---|
| 45 | void FetchData(double* pscalar,const mxArray* dataref);
|
---|
| 46 | void FetchData(int* pinteger,const mxArray* dataref);
|
---|
| 47 | void FetchData(bool* pbool,const mxArray* dataref);
|
---|
[12043] | 48 | void FetchData(BamgGeom** bamggeom,const mxArray* dataref);
|
---|
| 49 | void FetchData(BamgMesh** bamgmesh,const mxArray* dataref);
|
---|
| 50 | void FetchData(BamgOpts** bamgopts,const mxArray* dataref);
|
---|
[12051] | 51 | void FetchData(Options** poptions,int istart, int nrhs,const mxArray** pdataref);
|
---|
[12011] | 52 |
|
---|
| 53 | Option* OptionParse(char* name, const mxArray* prhs[]);
|
---|
| 54 | OptionDouble* OptionDoubleParse( char* name, const mxArray* prhs[]);
|
---|
| 55 | OptionLogical* OptionLogicalParse( char* name, const mxArray* prhs[]);
|
---|
| 56 | OptionChar* OptionCharParse( char* name, const mxArray* prhs[]);
|
---|
| 57 | OptionStruct* OptionStructParse( char* name, const mxArray* prhs[]);
|
---|
| 58 | OptionCell* OptionCellParse( char* name, const mxArray* prhs[]);
|
---|
| 59 |
|
---|
| 60 | mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number, const char* field);
|
---|
[12043] | 61 | void SetStructureField(mxArray* dataref,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
|
---|
[12011] | 62 | int CheckNumMatlabArguments(int nlhs,int NLHS, int nrhs,int NRHS, const char* THISFUNCTION, void (*function)( void ));
|
---|
| 63 |
|
---|
| 64 | /*Matlab to Matrix routines: */
|
---|
| 65 | Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix);
|
---|
| 66 | Vector* MatlabVectorToVector(const mxArray* mxvector);
|
---|
| 67 |
|
---|
| 68 | /*Matlab to double* routines: */
|
---|
| 69 | int MatlabVectorToDoubleVector(double** pvector,int* pvector_rows,const mxArray* mxvector);
|
---|
| 70 | int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix);
|
---|
| 71 | int MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix);
|
---|
| 72 | int MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix);
|
---|
| 73 | int MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix);
|
---|
| 74 |
|
---|
| 75 | /*Matlab to SeqMat routines: */
|
---|
| 76 | SeqMat* MatlabMatrixToSeqMat(const mxArray* dataref);
|
---|
| 77 | SeqVec* MatlabVectorToSeqVec(const mxArray* dataref);
|
---|
| 78 |
|
---|
[12102] | 79 | /*Matlab to Petsc routines: */
|
---|
| 80 | #ifdef _HAVE_PETSC_
|
---|
| 81 | int MatlabMatrixToPetscMatrix(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
|
---|
| 82 | int MatlabVectorToPetscVector(Vec* pvector,int* pvector_rows,const mxArray* mxvector);
|
---|
| 83 | #endif
|
---|
| 84 |
|
---|
| 85 |
|
---|
[12011] | 86 | #endif /* _IO_H_ */
|
---|