Changeset 9111
- Timestamp:
- 07/25/11 13:20:15 (14 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Params/IntVecParam.cpp
r8224 r9111 32 32 M=in_M; 33 33 34 values=(int*)xmalloc(M*sizeof(int)); 35 memcpy(values,in_values,M*sizeof(int)); 34 if(M){ 35 values=(int*)xmalloc(M*sizeof(int)); 36 memcpy(values,in_values,M*sizeof(int)); 37 } 38 else values=NULL; 36 39 } 37 40 /*}}}*/ … … 42 45 M=in_M; 43 46 44 values=(int*)xmalloc(M*sizeof(int)); 45 for(int i=0;i<in_M;i++) values[i]=(int)in_values[i]; 47 if(M){ 48 values=(int*)xmalloc(M*sizeof(int)); 49 for(int i=0;i<in_M;i++) values[i]=(int)in_values[i]; 50 } 51 else values=NULL; 46 52 } 47 53 /*}}}*/ … … 103 109 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 104 110 memcpy(marshalled_dataset,&M,sizeof(M));marshalled_dataset+=sizeof(M); 105 memcpy(marshalled_dataset,values,M*sizeof(int));marshalled_dataset+=M*sizeof(int);111 if(M)memcpy(marshalled_dataset,values,M*sizeof(int));marshalled_dataset+=M*sizeof(int); 106 112 107 113 *pmarshalled_dataset=marshalled_dataset; … … 132 138 /*data: */ 133 139 memcpy(&M,marshalled_dataset,sizeof(M));marshalled_dataset+=sizeof(M); 134 values=(int*)xmalloc(M*sizeof(int)); 135 memcpy(values,marshalled_dataset,M*sizeof(int));marshalled_dataset+=M*sizeof(int); 140 if(M) { 141 values=(int*)xmalloc(M*sizeof(int)); 142 memcpy(values,marshalled_dataset,M*sizeof(int));marshalled_dataset+=M*sizeof(int); 143 } 136 144 137 145 /*return: */ … … 160 168 int* output=NULL; 161 169 162 output=(int*)xmalloc(M*sizeof(int)); 163 memcpy(output,values,M*sizeof(int)); 170 if(M){ 171 output=(int*)xmalloc(M*sizeof(int)); 172 memcpy(output,values,M*sizeof(int)); 173 } 164 174 165 175 /*Assign output pointers:*/ … … 186 196 187 197 /*cast intvec into doublevec for Matlab*/ 188 doublevec=(double*)xmalloc(M*sizeof(double)); 189 for(int i=0;i<M;i++)doublevec[i]=(double)intvec[i]; 198 if(M){ 199 doublevec=(double*)xmalloc(M*sizeof(double)); 200 for(int i=0;i<M;i++)doublevec[i]=(double)intvec[i]; 201 } 202 else doublevec=NULL; 190 203 xfree((void**)&intvec); 191 204 … … 205 218 xfree((void**)&this->values); 206 219 207 this->values=(int*)xmalloc(in_M*sizeof(int)); 208 memcpy(this->values,intarray,in_M*sizeof(int)); 220 if(in_M){ 221 this->values=(int*)xmalloc(in_M*sizeof(int)); 222 memcpy(this->values,intarray,in_M*sizeof(int)); 223 } 224 else this->values=NULL; 209 225 210 226 this->M=in_M; -
issm/trunk/src/m/model/ismodelselfconsistent.m
r9110 r9111 101 101 fields={'diagnostic_ref'}; 102 102 checksize(md,fields,[md.numberofnodes 6]); 103 if(size(md.requested_outputs,2)~=1), 104 message(['model ' md.name ' requested outputs should be a column vector']); 103 if ~isempty(md.requested_outputs), 104 if(size(md.requested_outputs,2)~=1), 105 message(['model ' md.name ' requested outputs should be a column vector']); 106 end 105 107 end 106 108 %}}}
Note:
See TracChangeset
for help on using the changeset viewer.