Changeset 24682
- Timestamp:
- 04/01/20 10:14:06 (5 years ago)
- Location:
- issm/trunk-jpl/src/c/toolkits/issm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/toolkits/issm/IssmAbsMat.h
r24679 r24682 43 43 virtual void SetValues(int m,int* idxm,int n,int* idxn,doubletype* values,InsMode mode)=0; 44 44 virtual void Convert(MatrixType type)=0; 45 virtual void SetZero(void) {};45 virtual void SetZero(void)=0; 46 46 #ifndef _HAVE_WRAPPERS_ 47 47 virtual IssmAbsVec<IssmDouble>* Solve(IssmAbsVec<IssmDouble>* pf, Parameters* parameters)=0; -
issm/trunk-jpl/src/c/toolkits/issm/IssmDenseMat.h
r23049 r24682 112 112 113 113 /*IssmAbsMat virtual functions*/ 114 /*Echo{{{*/ 115 void Echo(void){ 116 117 int i,j; 114 void Echo(void){/*{{{*/ 115 118 116 _printf_("IssmDenseMat size " << this->M << "-" << this->N << "\n"); 119 for(i =0;i<M;i++){120 for( j=0;j<N;j++){117 for(int i=0;i<M;i++){ 118 for(int j=0;j<N;j++){ 121 119 _printf_(this->matrix[N*i+j] << " "); 122 120 } … … 125 123 } 126 124 /*}}}*/ 127 /*Assemble{{{*/ 128 void Assemble(void){ 125 void Assemble(void){/*{{{*/ 129 126 130 127 /*do nothing*/ … … 132 129 } 133 130 /*}}}*/ 134 /*Norm{{{*/ 135 doubletype Norm(NormMode mode){ 131 doubletype Norm(NormMode mode){/*{{{*/ 136 132 137 133 doubletype norm; … … 167 163 } 168 164 /*}}}*/ 169 /*GetSize{{{*/ 170 void GetSize(int* pM,int* pN){ 171 165 void GetSize(int* pM,int* pN){/*{{{*/ 172 166 *pM=this->M; 173 167 *pN=this->N; 174 175 } 176 /*}}}*/ 177 /*GetLocalSize{{{*/ 178 void GetLocalSize(int* pM,int* pN){ 168 } 169 /*}}}*/ 170 void GetLocalSize(int* pM,int* pN){/*{{{*/ 179 171 180 172 *pM=this->M; … … 183 175 } 184 176 /*}}}*/ 185 /*MatMult{{{*/ 186 void MatMult(IssmAbsVec<doubletype>* Xin,IssmAbsVec<doubletype>* AXin){ 177 void MatMult(IssmAbsVec<doubletype>* Xin,IssmAbsVec<doubletype>* AXin){/*{{{*/ 187 178 188 179 /*We assume that the vectors coming in are of compatible type: */ … … 214 205 } 215 206 /*}}}*/ 216 /*Duplicate{{{*/ 217 IssmDenseMat<doubletype>* Duplicate(void){ 207 IssmDenseMat<doubletype>* Duplicate(void){/*{{{*/ 218 208 219 209 doubletype dummy=0; … … 223 213 } 224 214 /*}}}*/ 225 /*ToSerial{{{*/ 226 doubletype* ToSerial(void){ 215 doubletype* ToSerial(void){/*{{{*/ 227 216 228 217 doubletype* buffer=NULL; … … 236 225 } 237 226 /*}}}*/ 238 /*SetValues{{{*/ 239 void SetValues(int m,int* idxm,int n,int* idxn,doubletype* values,InsMode mode){ 227 void SetValues(int m,int* idxm,int n,int* idxn,doubletype* values,InsMode mode){/*{{{*/ 240 228 241 229 int i,j; … … 254 242 } 255 243 /*}}}*/ 256 /*Convert{{{*/ 257 void Convert(MatrixType type){ 244 void Convert(MatrixType type){/*{{{*/ 258 245 259 246 /*do nothing*/ … … 261 248 } 262 249 /*}}}*/ 250 void SetZero(void){/*{{{*/ 251 for(int i=0;i<M;i++){ 252 for(int j=0;j<N;j++){ 253 this->matrix[N*i+j] = 0.; 254 } 255 } 256 }/*}}}*/ 263 257 #ifndef _HAVE_WRAPPERS_ 264 /*Solve{{{*/ 265 IssmAbsVec<IssmDouble>* Solve(IssmAbsVec<IssmDouble>* pfin, Parameters* parameters){ 258 IssmAbsVec<IssmDouble>* Solve(IssmAbsVec<IssmDouble>* pfin, Parameters* parameters){/*{{{*/ 266 259 267 260 /*First off, we assume that the type of IssmAbsVec is IssmSeqVec. So downcast: */ -
issm/trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h
r22737 r24682 400 400 } 401 401 /*}}}*/ 402 void SetZero(void){/*{{{*/ 403 for(int i=0;i<this->m*this->N;i++) this->matrix[i] = 0.; 404 }/*}}}*/ 402 405 void Convert(MatrixType type){/*{{{*/ 403 406 _error_("not supported yet!"); -
issm/trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h
r23532 r24682 91 91 void Init(int Min,int Nin){/*{{{*/ 92 92 93 int i;94 95 93 this->buckets=new DataSet(); 96 94 … … 107 105 if (m*N){ 108 106 this->matrix=xNew<SparseRow<doubletype>*>(m); 109 for(i =0;i<m;i++){107 for(int i=0;i<m;i++){ 110 108 this->matrix[i]=new SparseRow<doubletype>(N); 111 109 } … … 114 112 /*}}}*/ 115 113 ~IssmMpiSparseMat(){/*{{{*/ 116 int i;117 118 114 if(m*N){ 119 for(i =0;i<m;i++){115 for(int i=0;i<m;i++){ 120 116 delete this->matrix[i]; 121 117 } 122 118 xDelete<SparseRow<doubletype>*>(this->matrix); 123 119 } 124 M=0;125 N=0;126 m=0;120 this->M=0; 121 this->N=0; 122 this->m=0; 127 123 delete this->buckets; 128 124 } … … 421 417 } 422 418 /*}}}*/ 419 void SetZero(void){/*{{{*/ 420 421 /*Reset buckets*/ 422 delete this->buckets; 423 this->buckets=new DataSet(); 424 425 /*reset matrix*/ 426 if(m*N){ 427 for(int i=0;i<m;i++) delete this->matrix[i]; 428 xDelete<SparseRow<doubletype>*>(this->matrix); 429 430 this->matrix=xNew<SparseRow<doubletype>*>(m); 431 for(int i=0;i<m;i++) this->matrix[i]=new SparseRow<doubletype>(N); 432 } 433 434 /*Reallocate matrix*/ 435 }/*}}}*/ 423 436 void Convert(MatrixType type){/*{{{*/ 424 437 _error_("not supported yet!"); -
issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h
r23643 r24682 380 380 void Set(doubletype value){/*{{{*/ 381 381 382 int i; 383 for(i=0;i<this->m;i++)this->vector[i]=value; 382 for(int i=0;i<this->m;i++)this->vector[i]=value; 384 383 385 384 } -
issm/trunk-jpl/src/c/toolkits/issm/IssmSeqVec.h
r23643 r24682 173 173 void Set(doubletype value){/*{{{*/ 174 174 175 int i; 176 for(i=0;i<this->M;i++)this->vector[i]=value; 175 for(int i=0;i<this->M;i++)this->vector[i]=value; 177 176 178 177 }
Note:
See TracChangeset
for help on using the changeset viewer.