/* \file WriteData.c: * \brief: general interface for writing data */ #ifdef HAVE_CONFIG_H #include #else #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" #endif #include "../../include/include.h" #include "../../shared/shared.h" #include "./matlabio.h" #include /*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{1*/ void WriteData(mxArray** pdataref,Matrix* matrix){ int i,j; mxArray* dataref=NULL; double* matrix_ptr=NULL; int rows,cols; double* tmatrix_ptr=NULL; if(matrix){ #ifdef _HAVE_PETSC_ PetscMatrixToDoubleMatrix(&matrix_ptr,&rows,&cols,matrix->matrix); #else matrix_ptr=matrix->matrix->ToSerial(); matrix->matrix->GetSize(&rows,cols); #endif /*Now transpose the matrix and allocate with Matlab's memory manager: */ tmatrix_ptr=(double*)mxMalloc(rows*cols*sizeof(double)); for(i=0;ivector); #else vector_ptr=vector->vector->ToMPISerial(); vector->vector->GetSize(&rows); #endif /*now create the matlab vector with Matlab's memory manager */ vector_matlab=(double*)mxMalloc(rows*sizeof(double)); for(int i=0;i