Changeset 16438
- Timestamp:
- 10/16/13 22:26:48 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp ¶
r16126 r16438 24 24 25 25 bool oldalloc=false; 26 char* toolkittype=NULL; 26 27 27 28 /*retrieve parameters: */ … … 36 37 37 38 numberofdofspernode=femmodel->nodes->MaxNumDofs(configuration_type,GsetEnum); 39 40 /*if our matrices are coming from issm, we don't do dynamic allocation like Petsc 41 * does, and this routine is essentially useless. Force oldalloc in this case: */ 42 toolkittype=ToolkitOptions::GetToolkitType(); 43 if(strcmp(toolkittype,"issm")==0)oldalloc=true; 38 44 39 45 if(oldalloc){ … … 63 69 if(ppf) pf =new Vector<IssmDouble>(flocalsize,fsize); 64 70 } 71 72 /*Free ressources: */ 73 xDelete<char>(toolkittype); 65 74 66 75 /*Allocate output pointers*/ -
TabularUnified issm/trunk-jpl/src/c/toolkits/issm/SparseRow.h ¶
r16415 r16438 13 13 class SparseRow{ 14 14 15 private: 16 int* buffer; //used during SetValues 17 15 18 public: 16 19 … … 19 22 int* indices; 20 23 doubletype* values; 21 24 22 25 /*SparseRow constructors, destructors*/ 23 26 SparseRow(){ /*{{{*/ … … 26 29 indices=NULL; 27 30 values=NULL; 31 buffer=NULL; 28 32 } /*}}}*/ 29 33 SparseRow(int in_M){/*{{{*/ … … 33 37 indices=NULL; 34 38 values=NULL; 39 40 buffer=xNewZeroInit<int>(M); 35 41 } /*}}}*/ 36 42 ~SparseRow(){/*{{{*/ … … 39 45 xDelete<doubletype>(values); 40 46 } 47 if(buffer)xDelete<int>(buffer); 41 48 } /*}}}*/ 42 49 … … 53 60 int count; 54 61 int i,j; 55 int* buffer=NULL;56 62 57 63 if(!M)_error_("unknow dimension for this sparse row!"); … … 67 73 68 74 /*Figure out number of non-zero values ncols: */ 69 buffer=xNewZeroInit<int>(M); 75 for(i=0;i<numvalues;i++)buffer[i]=0; 76 77 ncols=0; 70 78 for(i=0;i<numvalues;i++){ 79 if(!buffer[cols[i]])ncols++; 71 80 if(mods[i]==ADD_VAL){ 72 81 if(buffer[cols[i]]!=2)buffer[cols[i]]=1; … … 74 83 else buffer[cols[i]]=2; 75 84 } 76 ncols=0;77 for(i=0;i<M;i++)if(buffer[i]!=0)ncols++;78 _assert_(ncols);79 80 85 81 86 /*Allocate:*/ … … 109 114 } 110 115 if(count!=ncols)_error_("counter problem during set values operations"); 111 112 /*Free ressources: */113 xDelete<int>(buffer);114 115 116 } /*}}}*/ 116 117 doubletype Norm(NormMode mode){ /*{{{*/
Note:
See TracChangeset
for help on using the changeset viewer.