Changeset 26144
- Timestamp:
- 03/23/21 20:50:30 (4 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Element.cpp ¶
r26138 r26144 56 56 57 57 for(int i=0;i<numnodes;i++){ 58 if(nodes[i]-> fsize) return true;58 if(nodes[i]->FSize()) return true; 59 59 } 60 60 return false; … … 3383 3383 switch(set2_enum){ 3384 3384 case FsetEnum: 3385 if(nodes[i]-> fsize){3385 if(nodes[i]->FSize()){ 3386 3386 if(this->nodes[i]->IsClone()) 3387 3387 o_nz += 1; … … 3399 3399 break; 3400 3400 case SsetEnum: 3401 if(nodes[i]-> ssize){3401 if(nodes[i]->SSize()){ 3402 3402 if(this->nodes[i]->IsClone()) 3403 3403 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Loads/Channel.cpp ¶
r25778 r26144 320 320 switch(set2_enum){ 321 321 case FsetEnum: 322 if(nodes[i]-> fsize){322 if(nodes[i]->FSize()){ 323 323 if(this->nodes[i]->IsClone()) 324 324 o_nz += 1; … … 336 336 break; 337 337 case SsetEnum: 338 if(nodes[i]-> ssize){338 if(nodes[i]->SSize()){ 339 339 if(this->nodes[i]->IsClone()) 340 340 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Loads/Moulin.cpp ¶
r25697 r26144 291 291 switch(set2_enum){ 292 292 case FsetEnum: 293 if(node-> fsize){293 if(node->FSize()){ 294 294 if(this->node->IsClone()) 295 295 o_nz += 1; … … 307 307 break; 308 308 case SsetEnum: 309 if(node-> ssize){309 if(node->SSize()){ 310 310 if(this->node->IsClone()) 311 311 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Loads/Neumannflux.cpp ¶
r25508 r26144 306 306 switch(set2_enum){ 307 307 case FsetEnum: 308 if(nodes[i]-> fsize){308 if(nodes[i]->FSize()){ 309 309 if(this->nodes[i]->IsClone()) 310 310 o_nz += 1; … … 322 322 break; 323 323 case SsetEnum: 324 if(nodes[i]-> ssize){324 if(nodes[i]->SSize()){ 325 325 if(this->nodes[i]->IsClone()) 326 326 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp ¶
r25508 r26144 430 430 switch(set2_enum){ 431 431 case FsetEnum: 432 if(nodes[i]-> fsize){432 if(nodes[i]->FSize()){ 433 433 if(this->nodes[i]->IsClone()) 434 434 o_nz += 1; … … 446 446 break; 447 447 case SsetEnum: 448 if(nodes[i]-> ssize){448 if(nodes[i]->SSize()){ 449 449 if(this->nodes[i]->IsClone()) 450 450 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp ¶
r25508 r26144 294 294 switch(set2_enum){ 295 295 case FsetEnum: 296 if(node-> fsize){296 if(node->FSize()){ 297 297 if(this->node->IsClone()) 298 298 o_nz += 1; … … 310 310 break; 311 311 case SsetEnum: 312 if(node-> ssize){312 if(node->SSize()){ 313 313 if(this->node->IsClone()) 314 314 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp ¶
r25508 r26144 235 235 switch(set2_enum){ 236 236 case FsetEnum: 237 if(nodes[i]-> fsize){237 if(nodes[i]->FSize()){ 238 238 if(this->nodes[i]->IsClone()) 239 239 o_nz += 1; … … 251 251 break; 252 252 case SsetEnum: 253 if(nodes[i]-> ssize){253 if(nodes[i]->SSize()){ 254 254 if(this->nodes[i]->IsClone()) 255 255 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp ¶
r25508 r26144 392 392 switch(set2_enum){ 393 393 case FsetEnum: 394 if(nodes[i]-> fsize){394 if(nodes[i]->FSize()){ 395 395 if(this->nodes[i]->IsClone()) 396 396 o_nz += 1; … … 408 408 break; 409 409 case SsetEnum: 410 if(nodes[i]-> ssize){410 if(nodes[i]->SSize()){ 411 411 if(this->nodes[i]->IsClone()) 412 412 o_nz += 1; -
TabularUnified issm/trunk-jpl/src/c/classes/Node.cpp ¶
r26136 r26144 20 20 this->approximation = 0; 21 21 this->gsize = -1; 22 this->fsize = -1;23 this->ssize = -1;24 22 this->clone = false; 25 23 this->active = true; … … 69 67 this->gdoflist = xNew<int>(this->gsize); 70 68 this->gdoflist_local = xNew<int>(this->gsize); 71 this->fsize = -1;72 this->ssize = -1;73 69 this->fdoflist = xNew<int>(this->gsize); 74 70 this->sdoflist = xNew<int>(this->gsize); … … 82 78 this->gdoflist = NULL; 83 79 this->gdoflist_local = NULL; 84 this->fsize = -1;85 this->ssize = -1;86 80 this->fdoflist = NULL; 87 81 this->sdoflist = NULL; … … 215 209 output->indexingupdate = this->indexingupdate; 216 210 output->gsize = this->gsize; 217 output->fsize = this->fsize;218 output->ssize = this->ssize;219 211 output->clone = this->clone; 220 212 output->active = this->active; … … 264 256 265 257 marshallhandle->call(this->gsize); 266 marshallhandle->call(this->fsize);267 marshallhandle->call(this->ssize);268 258 marshallhandle->call(this->clone); 269 259 marshallhandle->call(this->active); … … 292 282 _printf_(" indexingupdate: " << indexingupdate << "\n"); 293 283 _printf_(" gsize: " << gsize << "\n"); 294 _printf_(" fsize: " << fsize << "\n");295 _printf_(" ssize: " << ssize << "\n");296 284 _printf_(" clone: " << clone << "\n"); 297 285 _printf_(" active: " << active << "\n"); … … 303 291 for(i=0;i<gsize;i++) _printf_((s_set[i]?1:0)<< " "); 304 292 _printf_("]\n"); 305 _printf_(" svalues (" << this->ssize << "): |");293 _printf_(" svalues: |"); 306 294 for(i=0;i<this->gsize;i++){ 307 295 if(this->s_set[i])_printf_(" " << svalues[i] << " |"); … … 351 339 _printf_(" indexingupdate: " << indexingupdate << "\n"); 352 340 _printf_(" gsize: " << gsize << "\n"); 353 _printf_(" fsize: " << fsize << "\n");354 _printf_(" ssize: " << ssize << "\n");355 341 _printf_(" clone: " << clone << "\n"); 356 342 _printf_(" active: " << active << "\n"); … … 479 465 void Node::CreateNodalConstraints(Vector<IssmDouble>* ys){/*{{{*/ 480 466 481 if(this-> ssize){467 if(this->SSize()){ 482 468 /*Add values into constraint vector: */ 483 469 ys->SetValues(this->gsize,this->sdoflist,this->svalues,INS_VAL); … … 555 541 if(approximation_enum==NoneApproximationEnum){ 556 542 if (setenum==GsetEnum) numdofs=this->gsize; 557 else if (setenum==FsetEnum) numdofs=this-> fsize;558 else if (setenum==SsetEnum) numdofs=this-> ssize;543 else if (setenum==FsetEnum) numdofs=this->FSize(); 544 else if (setenum==SsetEnum) numdofs=this->SSize(); 559 545 else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 560 546 } … … 576 562 } 577 563 } 578 else numdofs=this-> fsize;564 else numdofs=this->FSize(); 579 565 } 580 566 else if (setenum==SsetEnum){ … … 585 571 } 586 572 } 587 else numdofs=this-> ssize;573 else numdofs=this->SSize(); 588 574 } 589 575 else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); … … 628 614 if(this->IsClone()) return; 629 615 630 if(this->fsize){ 631 int* indices = xNew<int>(this->fsize); 632 IssmDouble* values = xNew<IssmDouble>(this->fsize); 616 /*Get F size and S size*/ 617 int fsize = this->FSize(); 618 int ssize = this->SSize(); 619 620 if(fsize){ 621 int* indices = xNew<int>(fsize); 622 IssmDouble* values = xNew<IssmDouble>(fsize); 633 623 634 624 int count = 0; … … 643 633 } 644 634 } 645 ug->SetValues( this->fsize,indices,values,INS_VAL);635 ug->SetValues(fsize,indices,values,INS_VAL); 646 636 647 637 xDelete<IssmDouble>(values); 648 638 xDelete<int>(indices); 649 639 } 650 if( this->ssize){651 int* indices = xNew<int>( this->ssize);652 IssmDouble* values = xNew<IssmDouble>( this->ssize);640 if(ssize){ 641 int* indices = xNew<int>(ssize); 642 IssmDouble* values = xNew<IssmDouble>(ssize); 653 643 654 644 int count = 0; … … 663 653 } 664 654 } 665 ug->SetValues( this->ssize,indices,values,INS_VAL);655 ug->SetValues(ssize,indices,values,INS_VAL); 666 656 667 657 xDelete<IssmDouble>(values); … … 676 666 if(this->IsClone()) return; 677 667 678 if(this->fsize){ 679 int* indices = xNew<int>(this->fsize); 680 IssmDouble* values = xNew<IssmDouble>(this->fsize); 668 /*Get F size*/ 669 int fsize = this->FSize(); 670 671 if(fsize){ 672 int* indices = xNew<int>(fsize); 673 IssmDouble* values = xNew<IssmDouble>(fsize); 681 674 682 675 int count = 0; … … 692 685 } 693 686 } 694 _assert_(count== this->fsize);695 uf->SetValues( this->fsize,indices,values,INS_VAL);687 _assert_(count==fsize); 688 uf->SetValues(fsize,indices,values,INS_VAL); 696 689 697 690 xDelete<IssmDouble>(values); … … 702 695 703 696 /* indexing routines:*/ 704 void Node::AllocateDofLists(int setenum){/*{{{*/705 706 /*Initialize: */707 int size=0;708 709 if(setenum==FsetEnum){710 for(int i=0;i<this->gsize;i++) if(f_set[i])size++;711 this->fsize=size;712 }713 else if(setenum==SsetEnum){714 for(int i=0;i<this->gsize;i++) if(s_set[i])size++;715 this->ssize=size;716 }717 /*TODO, we should never be here for GSET! add an assert and track down whether this happens*/718 }719 /*}}}*/720 697 void Node::DistributeLocalDofs(int* pdofcount,int setenum){/*{{{*/ 721 698 … … 729 706 } 730 707 else if(setenum==FsetEnum){ 731 _assert_(this->fsize==0 || this->fdoflist_local);732 708 for(int i=0;i<this->gsize;i++){ 733 709 if(this->f_set[i]) fdoflist_local[i]=dofcount++; … … 736 712 } 737 713 else if(setenum==SsetEnum){ 738 _assert_(this->ssize==0 || this->sdoflist_local);739 714 for(int i=0;i<this->gsize;i++){ 740 715 if(this->s_set[i]) sdoflist_local[i]=dofcount++; … … 758 733 } 759 734 else if(setenum==FsetEnum){ 760 _assert_(this->fsize==0 || this->fdoflist);761 735 for(int i=0;i<this->gsize;i++){ 762 736 if(this->f_set[i]) fdoflist[i]=this->fdoflist_local[i]+dofcount; … … 765 739 } 766 740 else if(setenum==SsetEnum){ 767 _assert_(this->ssize==0 || this->sdoflist);768 741 for(int i=0;i<this->gsize;i++){ 769 742 if(this->s_set[i]) sdoflist[i]=this->sdoflist_local[i]+dofcount; … … 816 789 } 817 790 /*}}}*/ 791 int Node::FSize(void){/*{{{*/ 792 793 _assert_(this && this->gdoflist); 794 795 int fsize = 0; 796 for(int i=0;i<this->gsize;i++) if(this->f_set[i]) fsize++; 797 return fsize; 798 } 799 /*}}}*/ 800 int Node::SSize(void){/*{{{*/ 801 802 _assert_(this && this->s_set); 803 804 int ssize = 0; 805 for(int i=0;i<this->gsize;i++) if(this->s_set[i]) ssize++; 806 return ssize; 807 } 808 /*}}}*/ 818 809 819 810 /*Methods inherent to Node: */ -
TabularUnified issm/trunk-jpl/src/c/classes/Node.h ¶
r26131 r26144 43 43 /*sizes: */ 44 44 int gsize; //number of dofs for a node 45 int fsize; //number of dofs solver for46 int ssize; //number of constrained dofs47 45 48 46 /*Activation*/ … … 56 54 57 55 /*types of dofs: */ 58 int 56 int *doftype; //approximation type of the dofs (used only for coupling), size g_size 59 57 60 58 /*list of degrees of freedom: */ … … 80 78 81 79 /*Node numerical routines*/ 82 void AllocateDofLists(int setenum);83 80 void Activate(void); 84 81 void ApplyConstraint(int dof,IssmDouble value); … … 113 110 void VecReduce(Vector<IssmDouble>* uf, IssmDouble* local_ug,int* indices_ug); 114 111 void SetApproximation(int in_approximation); 112 int SSize(); 113 int FSize(); 115 114 }; 116 115 -
TabularUnified issm/trunk-jpl/src/c/classes/Nodes.cpp ¶
r26131 r26144 146 146 int my_rank = IssmComm::GetRank(); 147 147 int num_procs = IssmComm::GetSize(); 148 149 /*First, allocate dof lists based on fset and sset*/150 for(Object* & object : this->objects){151 Node* node = xDynamicCast<Node*>(object);152 node->AllocateDofLists(setenum);153 }154 148 155 149 /*Now, Build local dofs for masters first*/ -
TabularUnified issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp ¶
r26131 r26144 22 22 this->nrows=0; 23 23 this->values=NULL; 24 25 this->fsize=0;26 24 this->fglobaldoflist=NULL; 27 this->ssize=0;28 25 this->sglobaldoflist=NULL; 29 26 } … … 40 37 /*intermediaries*/ 41 38 int i,j,counter; 42 int gsize,fsize,ssize;43 39 44 40 /*If one of the two matrix is NULL, we copy the other one*/ … … 61 57 62 58 /*1: Get the new numbering of Ke2 and get size of the new matrix*/ 63 gsize=Ke1->nrows;59 int gsize=Ke1->nrows; 64 60 for(i=0;i<Ke2->nrows;i++){ 65 61 bool found=false; … … 99 95 } 100 96 101 /*Fset*/102 this->fsize=0;103 for(i=0;i<this->nrows;i++) if(this->fglobaldoflist[i]>=0) this->fsize++;104 105 /*Sset*/106 this->ssize=0;107 for(i=0;i<this->nrows;i++) if(this->sglobaldoflist[i]>=0) this->ssize++;108 109 97 /*clean-up*/ 110 98 xDelete<int>(P); … … 133 121 this->values=xNewZeroInit<IssmDouble>(this->nrows*this->nrows); 134 122 135 /*g list*/136 123 this->gglobaldoflist=GetGlobalDofList(nodes,numnodes,GsetEnum,approximation); 137 138 /*get dof lists for f and s set: */139 this->fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);140 124 this->fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation); 141 this->ssize=GetNumberOfDofs(nodes,numnodes,SsetEnum,approximation);142 125 this->sglobaldoflist=GetGlobalDofList(nodes,numnodes,SsetEnum,approximation); 143 126 } … … 163 146 this->CheckConsistency(); 164 147 165 if(this->fsize){ 148 /*do we have any component in the F set?*/ 149 int fsize = 0; 150 for(int i=0;i<this->nrows;i++){ 151 if(this->fglobaldoflist[i]>=0) fsize++; 152 } 153 154 if(fsize){ 166 155 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 167 156 localvalues=xNew<IssmDouble>(this->nrows); … … 171 160 172 161 /*add local values into global matrix, using the fglobaldoflist: */ 173 pf->SetValues( this->fsize,this->fglobaldoflist,localvalues,ADD_VAL);162 pf->SetValues(fsize,this->fglobaldoflist,localvalues,ADD_VAL); 174 163 175 164 /*Free ressources:*/ … … 193 182 this->CheckConsistency(); 194 183 184 /*do we have any component in the F or S set?*/ 185 bool is_fset= false; 186 bool is_sset= false; 187 for(int i=0;i<this->nrows;i++){ 188 if(this->fglobaldoflist[i]>=0){ 189 is_fset = true; 190 } 191 else{ 192 _assert_(this->sglobaldoflist[i]>=0); 193 is_sset = true; 194 } 195 } 196 195 197 /*only use row dofs to add values into global matrices: */ 196 if(this->fsize){ 197 /*add local values into global matrix, using the fglobaldoflist: */ 198 if(is_fset){ 198 199 Kff->SetValues(this->nrows,this->fglobaldoflist,this->nrows,this->fglobaldoflist,this->values,ADD_VAL); 199 200 } 200 201 if((this->ssize!=0) && (this->fsize!=0)){ 201 if(is_fset && is_sset){ 202 202 Kfs->SetValues(this->nrows,this->fglobaldoflist,this->nrows,this->sglobaldoflist,this->values,ADD_VAL); 203 203 } … … 212 212 this->CheckConsistency(); 213 213 214 if(this->fsize){ 214 /*do we have any component in the F set?*/ 215 bool isfset= false; 216 for(int i=0;i<this->nrows;i++){ 217 if(this->fglobaldoflist[i]>=0){ 218 isfset = true; 219 break; 220 } 221 } 222 223 if(isfset){ 215 224 Jff->SetValues(this->nrows,this->fglobaldoflist,this->nrows,this->fglobaldoflist,this->values,ADD_VAL); 216 225 } … … 246 255 if(gglobaldoflist) for(i=0;i<nrows;i++) _printf_(" " << gglobaldoflist[i]); _printf_("\n"); 247 256 248 _printf_(" fsize: " << fsize << "\n");249 257 _printf_(" fglobaldoflist (" << fglobaldoflist << "): "); 250 258 for(i=0;i<nrows;i++)_printf_(" " << fglobaldoflist[i]); _printf_(" \n"); 251 259 252 _printf_(" ssize: " << ssize << "\n");253 260 _printf_(" sglobaldoflist (" << sglobaldoflist << "): "); 254 261 for(i=0;i<nrows;i++)_printf_(" " << sglobaldoflist[i]); _printf_(" \n"); … … 267 274 this->gglobaldoflist=xNew<int>(this->nrows); 268 275 xMemCpy<int>(this->gglobaldoflist,Ke->gglobaldoflist,this->nrows); 269 270 this->fsize=Ke->fsize;271 276 this->fglobaldoflist=xNew<int>(this->nrows); 272 277 xMemCpy<int>(this->fglobaldoflist,Ke->fglobaldoflist,this->nrows); 273 274 this->ssize=Ke->ssize;275 278 this->sglobaldoflist=xNew<int>(this->nrows); 276 279 xMemCpy<int>(this->sglobaldoflist,Ke->sglobaldoflist,this->nrows); -
TabularUnified issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.h ¶
r26143 r26144 23 23 int *fglobaldoflist; 24 24 int *sglobaldoflist; 25 int fsize;26 int ssize;27 25 28 26 public: -
TabularUnified issm/trunk-jpl/src/c/classes/matrix/ElementVector.cpp ¶
r26143 r26144 120 120 this->CheckConsistency(); 121 121 122 /*Get size of Fset*/ 123 int fsize = 0; for(int i=0;i<this->nrows;i++) if(this->fglobaldoflist[i]>=0) fsize++; 124 125 if(fsize){ 122 /*do we have any component in the F set?*/ 123 bool isfset= false; 124 for(int i=0;i<this->nrows;i++){ 125 if(this->fglobaldoflist[i]>=0){ 126 isfset = true; 127 break; 128 } 129 } 130 131 if(isfset){ 126 132 pf->SetValues(this->nrows,this->fglobaldoflist,this->values,ADD_VAL); 127 133 } … … 176 182 void ElementVector::InsertIntoGlobal(Vector<IssmDouble>* pf){/*{{{*/ 177 183 178 /*Get size of Fset*/ 179 int fsize = 0; for(int i=0;i<this->nrows;i++) if(this->fglobaldoflist[i]>=0) fsize++; 180 181 if(fsize){ 184 /*do we have any component in the F set?*/ 185 bool isfset= false; 186 for(int i=0;i<this->nrows;i++){ 187 if(this->fglobaldoflist[i]>=0){ 188 isfset = true; 189 break; 190 } 191 } 192 193 if(isfset){ 182 194 /*add local values into global vector, using the fglobaldoflist: */ 183 195 pf->SetValues(this->nrows,this->fglobaldoflist,this->values,INS_VAL); -
TabularUnified issm/trunk-jpl/src/c/modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp ¶
r25554 r26144 256 256 int lid = node->Lid(); 257 257 if(!node->IsClone()){ 258 for(j=0;j<node->fsize;j++){ 258 int node_fsize = node->FSize(); 259 for(j=0;j<node_fsize;j++){ 259 260 _assert_(count<m); 260 261 d_nnz[count]=numberofdofspernode*(d_connectivity[lid] + reCast<int>(serial_connectivity_clone[lid]));
Note:
See TracChangeset
for help on using the changeset viewer.