Changeset 10366


Ignore:
Timestamp:
10/31/11 10:33:17 (13 years ago)
Author:
seroussi
Message:

useless routines

Location:
issm/trunk/src/c/modules/GroundinglineMigrationx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxLocal.h

    r10364 r10366  
    1212
    1313/* local prototypes: */
    14 bool*      CreateElementOnGroundingline(Elements* elements,double* element_on_iceshelf);
    15 double*    CreateElementOnIceShelf(Elements* elements);
    1614double*    CreateElementTouchingIceShelf(Elements* elements,double* nodes_on_iceshelf);
    1715Vec        CreateNodesOnIceShelf(Nodes* nodes,Vertices* vertices,int analysis_type);
    1816double*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters);
    1917double*    PropagateShelfIntoConnexIceSheet(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding);
    20 
    21 int        UpdateShelfStatus(Elements* elements,Nodes* nodes,Parameters* parameters,double* element_touching_iceshelf);
    2218#endif  /* _GROUNDINGLINEMIGRATIONXLOCAL_H */
  • TabularUnified issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxUtils.cpp

    r10364 r10366  
    1111#include "../../EnumDefinitions/EnumDefinitions.h"
    1212
    13 /*FUNCTION CreateElementOnGroundingline {{{1*/
    14 bool*      CreateElementOnGroundingline(Elements* elements,double* element_on_iceshelf){
    15 
    16         bool    *element_on_gl = NULL;
    17         bool     ongl=false;
    18         int      i,j,sid,shelf;
    19         int     *neighboorsids = NULL;
    20         Element *element       = NULL;
    21 
    22         /*Go through elements, and look for elements that can possibly have a grounding line migration. These
    23          * are  elements that touch the grounding line: */
    24         element_on_gl=(bool*)xmalloc(elements->Size()*sizeof(bool));
    25 
    26         for(i=0;i<elements->Size();i++){
    27                 element=(Element*)elements->GetObjectByOffset(i);
    28                
    29                 sid=element->Sid();
    30                 neighboorsids=element->GetHorizontalNeighboorSids();
    31 
    32                 shelf=(int)element_on_iceshelf[sid];
    33                 ongl=false;
    34                 for(j=0;j<3;j++){
    35                         if (neighboorsids[j]<0)continue; //this neighboor does not exist
    36                         if ((shelf==1) & (element_on_iceshelf[neighboorsids[j]]==1))continue;  //both this element and this neighboor are on th ice shelf
    37                         if ((shelf==0) & (element_on_iceshelf[neighboorsids[j]]==0))continue;  //both this element and this neighboor are on the ice sheet
    38                         ongl=true; //neighboor j is on a different location than us, ie we are touching the grounding line.
    39                 }
    40                 element_on_gl[i]=ongl;
    41         }
    42 
    43         return element_on_gl;
    44 }
    45 /*}}}*/
    46 /*FUNCTION CreateElementOnIceShelf {{{1*/
    47 double*    CreateElementOnIceShelf(Elements* elements){
    48 
    49         int      i;
    50         double  *element_on_iceshelf     = NULL;
    51         Element *element                 = NULL;
    52         Vec      vec_element_on_iceshelf = NULL;
    53 
    54         /*Create  vector holding  all the elements IsFloating flags: */
    55         vec_element_on_iceshelf=NewVec(elements->NumberOfElements(),true);
    56 
    57         /*Loop through elements, and fill vec_element_on_iceshelf: */
    58         for(i=0;i<elements->Size();i++){
    59                 element=(Element*)elements->GetObjectByOffset(i);
    60                 VecSetValue(vec_element_on_iceshelf,element->Sid(),(int)element->IsFloating(),INSERT_VALUES);
    61         }
    62 
    63         /*Assemble vector: */
    64         VecAssemblyBegin(vec_element_on_iceshelf);
    65         VecAssemblyEnd(vec_element_on_iceshelf);
    66 
    67         /*Serialize vector: */
    68         VecToMPISerial(&element_on_iceshelf,vec_element_on_iceshelf);
    69 
    70         /*free ressouces: */
    71         VecFree(&vec_element_on_iceshelf);
    72 
    73         return element_on_iceshelf;
    74 }
    75 /*}}}*/
    7613/*FUNCTION CreateElementTouchingIceShelf {{{1*/
    7714double*    CreateElementTouchingIceShelf(Elements* elements,double* nodes_on_iceshelf){
     
    214151}
    215152/*}}}*/
    216 
    217 /*FUNCTION UpdateShelfStatus {{{1*/
    218 int UpdateShelfStatus(Elements* elements,Nodes* nodes,Parameters* parameters,double* element_touching_iceshelf){
    219 
    220         int      i,numnods,configuration_type;
    221         int      nflipped=0;
    222         int      local_nflipped=0;
    223         Vec      vec_new_shelf_nodes = NULL;
    224         double*  new_shelf_nodes     = NULL;
    225         Element* element             = NULL;
    226 
    227         /*recover parameters: */
    228         parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
    229 
    230         /*First, initialize vec_new_shelf_nodes, which will track which nodes have changed status: */
    231         numnods=nodes->NumberOfNodes(configuration_type);
    232         vec_new_shelf_nodes=NewVec(numnods);
    233 
    234         /*Ok, now go through  the elements that have gone through grounding line migration,
    235          * and update their flags: */
    236         for(i=0;i<elements->Size();i++){
    237                 element=(Element*)elements->GetObjectByOffset(i);
    238                 if(element_touching_iceshelf[element->Sid()]){
    239                         local_nflipped+=element->UpdateShelfStatus(vec_new_shelf_nodes);
    240                 }
    241         }
    242         MPI_Allreduce(&local_nflipped,&nflipped,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    243 
    244         /*Serialize vec_new_shelf_nodes: */
    245         VecToMPISerial(&new_shelf_nodes,vec_new_shelf_nodes);
    246 
    247         /*Now, go through ALL elements, and update the status of the nodes, to propagate what happened at the grounding line: */
    248         /*Carry out grounding line migration for those elements: */
    249         for(i=0;i<elements->Size();i++){
    250                 element=(Element*)elements->GetObjectByOffset(i);
    251                 element->UpdateShelfFlags(new_shelf_nodes);
    252         }
    253 
    254         /*Free ressources: */
    255         VecFree(&vec_new_shelf_nodes);
    256         xfree((void**)&new_shelf_nodes);
    257 
    258         return nflipped;
    259 }
    260 /*}}}*/
Note: See TracChangeset for help on using the changeset viewer.