Changeset 11670
- Timestamp:
- 03/07/12 19:00:56 (13 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r11665 r11670 1 INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @HYPREINCL@ @MLINCL@ @TAOINCL@ 1 INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @HYPREINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ 2 2 EXEEXT=$(ISSMEXT) 3 3 … … 120 120 ./objects/Numerics/ElementVector.h\ 121 121 ./objects/Numerics/ElementVector.cpp\ 122 ./objects/Numerics/Matrix.h\ 123 ./objects/Numerics/Matrix.cpp\ 124 ./objects/Numerics/Vector.h\ 125 ./objects/Numerics/Vector.cpp\ 122 126 ./objects/Params/Param.h\ 123 127 ./objects/Params/BoolParam.cpp\ … … 724 728 ./toolkits/matlab/matlabincludes.h\ 725 729 ./toolkits/matlab/MatlabNArrayToNArray.cpp\ 730 ./toolkits/matlab/MatlabMatrixToMatrix.cpp\ 731 ./toolkits/matlab/MatlabVectorToVector.cpp\ 726 732 ./io/Matlab/matlabio.h\ 727 733 ./io/Matlab/WriteMatlabData.cpp\ -
issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp
r9320 r11670 305 305 } 306 306 /*}}}*/ 307 /*FUNCTION FetchMatlabData(Matrix** pmatrix,const mxArray* dataref){{{1*/ 308 void FetchMatlabData(Matrix** pmatrix,const mxArray* dataref){ 309 310 Matrix* outmatrix=NULL; 311 int dummy=0; 312 313 if (mxIsClass(dataref,"double") ){ 314 315 /*Check dataref is not pointing to NaN: */ 316 if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetM(dataref)==1) && (mxGetN(dataref)==1) ){ 317 outmatrix=NULL; 318 } 319 else{ 320 321 /*Convert matlab matrix to petsc matrix: */ 322 outmatrix=MatlabMatrixToMatrix(dataref); 323 } 324 } 325 else{ 326 /*This is an error: we don't have the correct input!: */ 327 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref)); 328 } 329 330 /*Assign output pointers:*/ 331 *pmatrix=outmatrix; 332 } 333 /*}}}*/ 307 334 /*FUNCTION FetchMatlabData(double** pvector,int* pM,const mxArray* dataref){{{1*/ 308 335 void FetchMatlabData(double** pvector,int* pM,const mxArray* dataref){ … … 442 469 /*Convert matlab vector to petsc vector: */ 443 470 MatlabVectorToPetscVector(&vector,&dummy,dataref); 471 } 472 else{ 473 /*This is an error: we don't have the correct input!: */ 474 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref)); 475 } 476 477 /*Assign output pointers:*/ 478 *pvector=vector; 479 } 480 /*}}}*/ 481 /*FUNCTION FetchMatlabData(Vector** pvector,const mxArray* dataref){{{1*/ 482 void FetchMatlabData(Vector** pvector,const mxArray* dataref){ 483 484 Vector* vector=NULL; 485 int dummy; 486 487 if(mxIsEmpty(dataref)){ 488 /*Nothing to pick up. Just initialize matrix pointer to NULL: */ 489 vector=NULL; 490 } 491 else if (mxIsClass(dataref,"double") ){ 492 493 /*Convert matlab vector to petsc vector: */ 494 vector=MatlabVectorToVector(dataref); 444 495 } 445 496 else{ -
issm/trunk-jpl/src/c/io/Matlab/WriteMatlabData.cpp
r11202 r11670 58 58 } 59 59 /*}}}*/ 60 /*FUNCTION WriteMatlabData(mxArray** pdataref,Matrix* matrix){{{1*/ 61 void WriteMatlabData(mxArray** pdataref,Matrix* matrix){ 62 63 mxArray* dataref=NULL; 64 65 if(matrix){ 66 67 /*call toolkit routine: */ 68 dataref=matrix->ToMatlabMatrix(); 69 } 70 else{ 71 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 72 } 73 74 *pdataref=dataref; 75 } 76 /*}}}*/ 60 77 /*FUNCTION WriteMatlabData(mxArray** pdataref,double* matrix, int M,int N){{{1*/ 61 78 void WriteMatlabData(mxArray** pdataref,double* matrix, int M,int N){ … … 117 134 /*call toolkit routine: */ 118 135 PetscVectorToMatlabVector(&dataref,vector); 136 } 137 else{ 138 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 139 } 140 *pdataref=dataref; 141 142 } 143 /*}}}*/ 144 /*FUNCTION WriteMatlabData(mxArray** pdataref,Vector* vector){{{1*/ 145 void WriteMatlabData(mxArray** pdataref,Vector* vector){ 146 147 mxArray* dataref=NULL; 148 149 if(vector){ 150 151 /*call toolkit routine: */ 152 dataref=vector->ToMatlabVector(); 119 153 } 120 154 else{ -
issm/trunk-jpl/src/c/io/Matlab/matlabio.h
r10205 r11670 17 17 void WriteMatlabData(mxArray** pdataref,DataSet* dataset); 18 18 void WriteMatlabData(mxArray** pdataref,Mat matrix); 19 void WriteMatlabData(mxArray** pdataref,Matrix* matrix); 19 20 void WriteMatlabData(mxArray** pdataref,double* matrix, int M,int N); 20 21 void WriteMatlabData(mxArray** pdataref,int* matrix, int M,int N); 21 22 void WriteMatlabData(mxArray** pdataref,Vec vector); 23 void WriteMatlabData(mxArray** pdataref,Vector* vector); 22 24 void WriteMatlabData(mxArray** pdataref,double* vector, int M); 23 25 void WriteMatlabData(mxArray** pdataref,int integer); … … 34 36 void FetchMatlabData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref); 35 37 void FetchMatlabData(Mat* pmatrix,const mxArray* dataref); 38 void FetchMatlabData(Matrix** pmatrix,const mxArray* dataref); 36 39 void FetchMatlabData(int** pvector,int* pM,const mxArray* dataref); 37 40 void FetchMatlabData(float** pvector,int* pM,const mxArray* dataref); … … 39 42 void FetchMatlabData(bool** pvector,int* pM,const mxArray* dataref); 40 43 void FetchMatlabData(Vec* pvector,const mxArray* dataref); 44 void FetchMatlabData(Vector** pvector,const mxArray* dataref); 41 45 void FetchMatlabData(char** pstring,const mxArray* dataref); 42 46 void FetchMatlabData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref); -
issm/trunk-jpl/src/c/objects/objects.h
r11295 r11670 120 120 #include "./Numerics/ElementMatrix.h" 121 121 #include "./Numerics/ElementVector.h" 122 #include "./Numerics/Vector.h" 123 #include "./Numerics/Matrix.h" 122 124 123 125 /*Params: */ -
issm/trunk-jpl/src/c/toolkits/matlab/matlabincludes.h
r8901 r11670 8 8 #ifdef _SERIAL_ 9 9 #include <mex.h> 10 class Matrix; 11 class Vector; 12 10 13 int MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix); 11 14 int MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix); 12 15 int MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix); 16 Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix); 17 Vector* MatlabVectorToVector(const mxArray* mxvector); 13 18 #endif 14 19
Note:
See TracChangeset
for help on using the changeset viewer.