Changeset 23997


Ignore:
Timestamp:
06/06/19 20:55:50 (6 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added more code, still needs to be tested

File:
1 edited

Legend:

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

    r23996 r23997  
    2525        bool* element_flag = xNewZeroInit<bool>(femmodel->elements->Size());
    2626
    27         /*Fill vector with 1 where it is grounded*/
     27        /*Fill vector with 1 once for all*/
    2828        IssmDouble eflags[MAXVERTICES];
    2929        for(int i=0;i<MAXVERTICES;i++) eflags[i] = 1.;
    3030
     31        /*Step 1, go through all elements and put 1 in vec_connected_to_land if the element is grounded*/
    3132        for(int i=0;i<femmodel->elements->Size();i++){
    3233                Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
     
    4748        vec_connected_to_land->Assemble();
    4849
     50        /*Now we have 2 loops, one across cpus, and one for each cpus: we are going to propagate the mask if an element
     51         * is connected to a positive mask already.
     52         * We then communicate to the other partitions. We stop when the mask stops changing*/
    4953        bool keepsyncing = true;
    50 
    5154        while(keepsyncing){
    5255
    53                 /*Need to place an outer loop here*/
     56                /*Get local mask from parallel vector*/
    5457                if(local_mask) xDelete<IssmDouble>(local_mask);
    5558                femmodel->GetLocalVectorWithClonesVertices(&local_mask,vec_connected_to_land);
     
    5962                int  iter      = 1;
    6063                while(keepgoing){
    61                         _printf0_("Iteration "<<iter);
     64                        _printf0_("   -- Kill icebergs: iteration "<<iter);
    6265
    6366                        keepgoing = 0;
     
    116119
    117120        /*OK, now deactivate iceberg and count the number of deactivated vertices*/
     121        for(int i=0;i<femmodel->elements->Size();i++){
     122                Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
    118123
    119         /*First, create a vector full of 0 and place 1 where the ice is grounded*/
    120         _error_("Not implemented yet");
     124                if(element->IsIceInElement()){
     125                        int  numvertices = element->GetNumberOfVertices();
     126                        element->GetVerticesLidList(&lidlist[0]);
     127                        bool deactivate = false;
     128                        for(int j=0;j<numvertices;j++){
     129                                if(local_mask[lidlist[j]]==0.){
     130                                        deactivate = true;
     131                                        break;
     132                                }
     133                        }
     134
     135                        if(deactivate){
     136                                _error_("Don't know what to do....");
     137                        }
     138                }
     139        }
     140
     141        /*cleanup*/
     142        xDelete<IssmDouble>(local_mask);
    121143}
Note: See TracChangeset for help on using the changeset viewer.