Changeset 24034
- Timestamp:
- 06/22/19 13:33:07 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/KillIcebergsx/KillIcebergsx.cpp
r23997 r24034 17 17 18 18 /*retrieve vertex info*/ 19 int nbv_global = femmodel->vertices->NumberOfVertices LocalAll();19 int nbv_global = femmodel->vertices->NumberOfVertices(); 20 20 int nbv_local = femmodel->vertices->NumberOfVerticesLocal(); 21 21 if(nbv_global==0) return; … … 59 59 60 60 /*Local iterations on partition*/ 61 int keepgoing = 1; 61 bool keepgoing = true; 62 int didsomething = 0; 62 63 int iter = 1; 63 64 while(keepgoing){ 64 _printf0_(" -- Kill icebergs: iteration "<<iter );65 _printf0_(" -- Kill icebergs: iteration "<<iter<<"\n"); 65 66 66 keepgoing = 0; 67 keepgoing = false; 68 didsomething = 0; 67 69 for(int i=0;i<femmodel->elements->Size();i++){ 68 70 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); … … 84 86 local_mask[lidlist[j]]=1.; 85 87 keepgoing = true; 88 didsomething = 1; 86 89 } 87 90 } … … 93 96 94 97 /*Check how many iterations all cpus did*/ 95 int iter_max; 96 ISSM_MPI_Reduce(&iter,&iter_max,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm()); 97 if(iter_max==2){ 98 int didsomething_max; 99 ISSM_MPI_Reduce(&didsomething,&didsomething_max,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm()); 100 ISSM_MPI_Bcast(&didsomething_max,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 101 if(didsomething_max==0){ 98 102 keepsyncing = false; 99 103 } … … 134 138 135 139 if(deactivate){ 136 _error_("Don't know what to do...."); 140 int numvertices = element->GetNumberOfVertices(); 141 IssmDouble* values = xNew<IssmDouble>(numvertices); 142 for(int j=0;j<numvertices;j++) values[j] = 1.; /*Anything >0 = no ice*/ 143 element->AddInput(MaskIceLevelsetEnum,values,P1Enum); 144 xDelete<IssmDouble>(values); 137 145 } 138 146 }
Note:
See TracChangeset
for help on using the changeset viewer.