Changeset 15967 for issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
- Timestamp:
- 08/27/13 08:35:37 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r15962 r15967 51 51 } 52 52 53 /*FUNCTION CreateNodesOnFloatingIce {{{*/54 Vector<IssmDouble>* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){55 56 int i,numnods;57 Vector<IssmDouble>* vec_nodes_on_floatingice = NULL;58 Node *node = NULL;59 60 /*First, initialize nodes_on_floatingice, which will track which nodes have changed status: */61 numnods=nodes->NumberOfNodes(configuration_type);62 vec_nodes_on_floatingice=new Vector<IssmDouble>(numnods);63 64 /*Loop through nodes, and fill vec_nodes_on_floatingice: */65 for(i=0;i<nodes->Size();i++){66 node=(Node*)nodes->GetObjectByOffset(i);67 if(node->InAnalysis(configuration_type)){68 if(node->IsFloating()){69 vec_nodes_on_floatingice->SetValue(node->Sid(),1.0,INS_VAL);70 }71 }72 }73 74 /*Assemble vector: */75 vec_nodes_on_floatingice->Assemble();76 77 return vec_nodes_on_floatingice;78 }79 /*%}}}*/80 53 /*FUNCTION PotentialUngrounding {{{*/ 81 54 IssmDouble* PotentialUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){ … … 111 84 int numberofvertices; 112 85 int nflipped,local_nflipped; 113 IssmDouble* nodes_on_floatingice= NULL;86 IssmDouble* phi = NULL; 114 87 IssmDouble* elements_neighboring_floatingce = NULL; 115 88 Vector<IssmDouble>* vec_elements_neighboring_floatingice = NULL; 116 Vector<IssmDouble>* vec_ nodes_on_floatingice= NULL;89 Vector<IssmDouble>* vec_phi = NULL; 117 90 Node* node = NULL; 118 91 Element* element = NULL; … … 122 95 numberofvertices=vertices->NumberOfVertices(); 123 96 124 /*recover vec_nodes_on_floatingice*/ 125 vec_nodes_on_floatingice=CreateNodesOnFloatingIce(nodes,analysis_type); 126 nodes_on_floatingice=vec_nodes_on_floatingice->ToMPISerial(); 97 /*recover vec_phi*/ 98 vec_phi=new Vector<IssmDouble>(vertices->NumberOfVertices()); 99 for(i=0;i<elements->Size();i++){ 100 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 101 element->GetVectorFromInputs(vec_phi,MaskGroundediceLevelsetEnum); 102 } 103 phi=vec_phi->ToMPISerial(); 127 104 128 105 nflipped=1; //bootstrap … … 135 112 for(i=0;i<elements->Size();i++){ 136 113 element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 137 vec_elements_neighboring_floatingice->SetValue(element->Sid(),element->IsNodeOnShelfFromFlags( nodes_on_floatingice)?1.0:0.0,INS_VAL);114 vec_elements_neighboring_floatingice->SetValue(element->Sid(),element->IsNodeOnShelfFromFlags(phi)?1.0:0.0,INS_VAL); 138 115 } 139 116 … … 147 124 element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 148 125 if(reCast<int,IssmDouble>(elements_neighboring_floatingce[element->Sid()])){ 149 local_nflipped+=element->UpdatePotentialUngrounding(vertices_potentially_ungrounding,vec_ nodes_on_floatingice,nodes_on_floatingice);126 local_nflipped+=element->UpdatePotentialUngrounding(vertices_potentially_ungrounding,vec_phi,phi); 150 127 } 151 128 } 152 vec_ nodes_on_floatingice->Assemble();129 vec_phi->Assemble(); 153 130 154 131 ISSM_MPI_Allreduce(&local_nflipped,&nflipped,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm()); … … 157 134 /*Avoid leaks: */ 158 135 xDelete<IssmDouble>(elements_neighboring_floatingce); 159 xDelete<IssmDouble>( nodes_on_floatingice);136 xDelete<IssmDouble>(phi); 160 137 161 138 /*Assemble and serialize:*/ 162 139 delete vec_elements_neighboring_floatingice; 163 nodes_on_floatingice=vec_nodes_on_floatingice->ToMPISerial();140 phi=vec_phi->ToMPISerial(); 164 141 } 165 142 166 143 /*Free ressources:*/ 167 delete vec_ nodes_on_floatingice;144 delete vec_phi; 168 145 xDelete<IssmDouble>(elements_neighboring_floatingce); 169 146 170 return nodes_on_floatingice;147 return phi; 171 148 } 172 149 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.