Ignore:
Timestamp:
10/31/11 14:48:46 (13 years ago)
Author:
seroussi
Message:

finished Cleaning grounding lines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r10377 r10378  
    1717        double*  vertices_ungrounding             = NULL;
    1818        double*  old_floatingice                  = NULL;
     19        Vec      vec_old_floatingice              = NULL;
    1920        Element* element                          = NULL;
    2021       
     
    3637        }
    3738
    38         /*Create vector with vertices initially floating*/
    39         old_floatingice=CreateNodesOnIceShelf(nodes,analysis_type);
     39        /*Create vector with vertices initially floating and serialize*/
     40        vec_old_floatingice=CreateNodesOnFloatingIce(nodes,analysis_type);
     41        VecToMPISerial(&old_floatingice,vec_old_floatingice);
    4042
    4143        /*Migrate grounding line : */
     
    4648
    4749        /*free ressouces: */
     50        VecFree(&vec_old_floatingice);
    4851        xfree((void**)&vertices_potentially_ungrounding);
    4952        xfree((void**)&vertices_ungrounding);
    5053        xfree((void**)&old_floatingice);
    5154}
     55
     56/*FUNCTION CreateNodesOnFloatingIce {{{1*/
     57Vec CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){
     58
     59        int     i,numnods;
     60        Vec     vec_nodes_on_floatingice = NULL;
     61        Node*   node                  = NULL;
     62
     63        /*First, initialize nodes_on_floatingice, which will track which nodes have changed status: */
     64        numnods=nodes->NumberOfNodes(configuration_type);
     65        vec_nodes_on_floatingice=NewVec(numnods);
     66
     67        /*Loop through nodes, and fill vec_nodes_on_floatingice: */
     68        for(i=0;i<nodes->Size();i++){
     69                node=(Node*)nodes->GetObjectByOffset(i);
     70                if(node->InAnalysis(configuration_type)){
     71                        if(node->IsFloating()){
     72                                VecSetValue(vec_nodes_on_floatingice,node->Sid(),1.0,INSERT_VALUES);
     73                        }
     74                }
     75        }
     76
     77        /*Assemble vector: */
     78        VecAssemblyBegin(vec_nodes_on_floatingice);
     79        VecAssemblyEnd(vec_nodes_on_floatingice);
     80
     81        return vec_nodes_on_floatingice;
     82}
     83/*%}}}*/
    5284/*FUNCTION PotentialSheetUngrounding {{{1*/
    5385double*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){
     
    97129
    98130        /*recover vec_nodes_on_floatingice*/
    99         vec_nodes_on_floatingice=NewVec(numberofvertices);
    100 
    101         /*Loop through nodes, and fill nodes_on_floatingice: */
    102         for(i=0;i<nodes->Size();i++){
    103                 node=(Node*)nodes->GetObjectByOffset(i);
    104                 if(node->InAnalysis(analysis_type)){
    105                         if(node->IsFloating()){
    106                                 VecSetValue(vec_nodes_on_floatingice,node->Sid(),1.0,INSERT_VALUES);
    107                         }
    108                 }
    109         }
    110 
    111         /*Assemble vector and serialize: */
    112         VecAssemblyBegin(vec_nodes_on_floatingice);
    113         VecAssemblyEnd(vec_nodes_on_floatingice);
     131        vec_nodes_on_floatingice=CreateNodesOnFloatingIce(nodes,analysis_type);
    114132        VecToMPISerial(&nodes_on_floatingice,vec_nodes_on_floatingice);
    115133
     
    161179}
    162180/*}}}*/
    163 /*FUNCTION CreateNodesOnIceShelf {{{1*/
    164 double* CreateNodesOnIceShelf(Nodes* nodes,int configuration_type){
    165 
    166         int     i,numnods;
    167         double* nodes_on_floatingice  = NULL;
    168         Vec     vec_nodes_on_iceshelf = NULL;
    169         Node*   node                  = NULL;
    170 
    171         /*First, initialize nodes_on_iceshelf, which will track which nodes have changed status: */
    172         numnods=nodes->NumberOfNodes(configuration_type);
    173         vec_nodes_on_iceshelf=NewVec(numnods);
    174 
    175         /*Loop through nodes, and fill vec_nodes_on_iceshelf: */
    176         for(i=0;i<nodes->Size();i++){
    177                 node=(Node*)nodes->GetObjectByOffset(i);
    178                 if(node->InAnalysis(configuration_type)){
    179                         if(node->IsFloating()){
    180                                 VecSetValue(vec_nodes_on_iceshelf,node->Sid(),1.0,INSERT_VALUES);
    181                         }
    182                 }
    183         }
    184 
    185         /*Assemble vector: */
    186         VecAssemblyBegin(vec_nodes_on_iceshelf);
    187         VecAssemblyEnd(vec_nodes_on_iceshelf);
    188         VecToMPISerial(&nodes_on_floatingice,vec_nodes_on_iceshelf);
    189 
    190         /*Free ressources*/
    191         VecFree(&vec_nodes_on_iceshelf);
    192 
    193         return nodes_on_floatingice;
    194 }
    195 /*%}}}*/
Note: See TracChangeset for help on using the changeset viewer.