Changeset 24034


Ignore:
Timestamp:
06/22/19 13:33:07 (6 years ago)
Author:
Mathieu Morlighem
Message:

BUG: some bug fixes in kill bergs, still not working well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/KillIcebergsx/KillIcebergsx.cpp

    r23997 r24034  
    1717
    1818        /*retrieve vertex info*/
    19         int nbv_global = femmodel->vertices->NumberOfVerticesLocalAll();
     19        int nbv_global = femmodel->vertices->NumberOfVertices();
    2020        int nbv_local  = femmodel->vertices->NumberOfVerticesLocal();
    2121        if(nbv_global==0)  return;
     
    5959
    6060                /*Local iterations on partition*/
    61                 int  keepgoing = 1;
     61                bool keepgoing = true;
     62                int  didsomething = 0;
    6263                int  iter      = 1;
    6364                while(keepgoing){
    64                         _printf0_("   -- Kill icebergs: iteration "<<iter);
     65                        _printf0_("   -- Kill icebergs: iteration "<<iter<<"\n");
    6566
    66                         keepgoing = 0;
     67                        keepgoing    = false;
     68                        didsomething = 0;
    6769                        for(int i=0;i<femmodel->elements->Size();i++){
    6870                                Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
     
    8486                                                                local_mask[lidlist[j]]=1.;
    8587                                                                keepgoing = true;
     88                                                                didsomething = 1;
    8689                                                        }
    8790                                                }
     
    9396
    9497                /*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){
    98102                        keepsyncing = false;
    99103                }
     
    134138
    135139                        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);
    137145                        }
    138146                }
Note: See TracChangeset for help on using the changeset viewer.