Changeset 23997
- Timestamp:
- 06/06/19 20:55:50 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/KillIcebergsx/KillIcebergsx.cpp
r23996 r23997 25 25 bool* element_flag = xNewZeroInit<bool>(femmodel->elements->Size()); 26 26 27 /*Fill vector with 1 where it is grounded*/27 /*Fill vector with 1 once for all*/ 28 28 IssmDouble eflags[MAXVERTICES]; 29 29 for(int i=0;i<MAXVERTICES;i++) eflags[i] = 1.; 30 30 31 /*Step 1, go through all elements and put 1 in vec_connected_to_land if the element is grounded*/ 31 32 for(int i=0;i<femmodel->elements->Size();i++){ 32 33 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); … … 47 48 vec_connected_to_land->Assemble(); 48 49 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*/ 49 53 bool keepsyncing = true; 50 51 54 while(keepsyncing){ 52 55 53 /* Need to place an outer loop here*/56 /*Get local mask from parallel vector*/ 54 57 if(local_mask) xDelete<IssmDouble>(local_mask); 55 58 femmodel->GetLocalVectorWithClonesVertices(&local_mask,vec_connected_to_land); … … 59 62 int iter = 1; 60 63 while(keepgoing){ 61 _printf0_(" Iteration "<<iter);64 _printf0_(" -- Kill icebergs: iteration "<<iter); 62 65 63 66 keepgoing = 0; … … 116 119 117 120 /*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)); 118 123 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); 121 143 }
Note:
See TracChangeset
for help on using the changeset viewer.