- Timestamp:
- 05/01/12 17:28:47 (13 years ago)
- Location:
- issm/branches/trunk-jpl-damage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-jpl-damage
- Property svn:ignore
-
old new 7 7 config.status 8 8 configure 9 doxygen10 9 ISSM.paf 11 10 ISSM.ppf 12 11 ISSM.ppf_cache 13 12 libtool 14 list15 13 Makefile 16 14 Makefile.in 17 15 stamp-h1 18 16 svn-commit* 19 nightlylog
-
- Property svn:mergeinfo changed
/issm/trunk merged: 11526,11533,11681-11682,11710,11778-11779,11995 /issm/trunk-jpl merged: 11992-11994,11996-12003,12005-12113,12115-12161,12163-12166
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/src/c/shared/Alloc/alloc.cpp
r12004 r12168 19 19 #endif 20 20 21 #if defined(_SERIAL_) && defined(_HAVE_MATLAB_)22 #include "mex.h"23 #endif24 25 21 #include <stdio.h> 26 22 #include <stdlib.h> … … 37 33 if(!size)_error_(" attempting to 0 size allocation!"); 38 34 39 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)40 /* Use the matlab api to do the allocation: */41 memptr=mxMalloc(size);42 #else43 35 /* Use the c library to do the allocation: */ 44 36 memptr=malloc(size); 45 #endif46 37 if(!memptr) _error_("memory allocation failed!"); 47 38 … … 55 46 if(!size)_error_("attempting to 0 size allocation!"); 56 47 57 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)58 /* Use the matlab api to do the allocation: */59 memptr=mxCalloc(n,size);60 #else61 48 /* Use the c library to do the allocation: */ 62 49 memptr=calloc(n,size); 63 #endif64 50 if(!memptr) _error_("memory allocation failed!"); 65 51 … … 70 56 71 57 if (pv && *pv){ 72 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_) 73 mxFree(*pv); 74 #else 75 free(*pv); 76 #endif 58 free(*pv); 77 59 78 60 *pv=NULL; … … 83 65 84 66 if (pv && *pv){ 85 #ifdef _PARALLEL_86 67 /*There is no mxDelete in the Matlab API -> using delete trips up Matlab. So we 87 68 * don't actually free memory in Matlab, we let the memory manager do that. We only 88 69 * free in parallel: */ 89 70 delete *pv; 90 #else91 /*Actually, still get rid of internal Petsc matrix. Quick fix until Matlab handles C++92 * correctly: */93 #ifdef _HAVE_PETSC_94 MatFree(&(*pv)->matrix);95 #endif96 #endif97 71 *pv=NULL; 98 72 } … … 102 76 103 77 if (pv && *pv){ 104 #ifdef _PARALLEL_105 78 /*There is no mxDelete in the Matlab API -> using delete trips up Matlab. So we 106 79 * don't actually free memory in Matlab, we let the memory manager do that. We only 107 80 * free in parallel: */ 108 81 delete *pv; 109 #else110 /*Actually, still get rid of internal Petsc vector. Quick fix until Matlab handles C++111 * correctly: */112 #ifdef _HAVE_PETSC_113 VecFree(&(*pv)->vector);114 #endif115 #endif116 82 *pv=NULL; 117 83 } … … 124 90 125 91 if(!size)_error_("attempting to realloc to zero"); 126 127 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)128 value = (void*)mxRealloc(pv,size);129 #else130 92 value = (void*)realloc(pv,size); 131 #endif132 93 133 94 if (value == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.