- Timestamp:
- 06/01/22 05:01:48 (3 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 26745-26955,26957-27031
- Property svn:mergeinfo changed
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/c/modules/KillIcebergsx/KillIcebergsx.cpp
r25836 r27035 9 9 #include "../InputUpdateFromVectorx/InputUpdateFromVectorx.h" 10 10 11 voidKillIcebergsx(FemModel* femmodel){11 int KillIcebergsx(FemModel* femmodel){ 12 12 13 13 /*Intermediaries*/ … … 18 18 IssmDouble *local_mask = xNewZeroInit<IssmDouble>(nbv_local); 19 19 bool *element_flag = xNewZeroInit<bool>(femmodel->elements->Size()); 20 IssmDouble ice; 20 21 21 22 /*Step 1, go through all elements and put 1 in local_mask if the element is grounded*/ … … 27 28 element_flag[i] = true; 28 29 } 29 else{ 30 if(element->IsGrounded()){ 30 else { 31 if(element->IsAllGrounded()){ 32 /* only look at element with ice but not fully grounded */ 31 33 int numvertices = element->GetNumberOfVertices(); 32 for(int v=0;v<numvertices;v++) local_mask[element->vertices[v]->Lid()] = 1.; 34 Gauss* gauss=element->NewGauss(); 35 Input* icelevel_input = element->GetInput(MaskIceLevelsetEnum); _assert_(icelevel_input); 36 37 for(int v=0;v<numvertices;v++) { 38 gauss->GaussVertex(v); 39 icelevel_input->GetInputValue(&ice,gauss); 40 /* The initial mask is very strict, we look at all grounded elements and set the mask for ice nodes only. */ 41 if (ice < 0) local_mask[element->vertices[v]->Lid()] = 1.; 42 } 43 delete gauss; 33 44 } 34 45 } … … 48 59 /*Local iterations on partition*/ 49 60 bool keepgoing = true; 50 int didsomething = 0;51 61 int iter = 1; 52 62 while(keepgoing){ … … 54 64 55 65 keepgoing = false; 56 didsomething = 0;57 66 int i=0; 58 67 for(Object* & object : femmodel->elements->objects){ … … 62 71 int numvertices = element->GetNumberOfVertices(); 63 72 bool found1 = false; 73 IssmDouble sumlocalmask = 0.; 74 64 75 for(int j=0;j<numvertices;j++){ 65 76 lid = element->vertices[j]->Lid(); 66 if(local_mask[lid]>0.){ 77 /*we need to have at least a sharing edge, to extend the mask*/ 78 sumlocalmask += local_mask[lid]; 79 if(sumlocalmask > 1.5){ 67 80 found1 = true; 68 81 break; … … 73 86 for(int j=0;j<numvertices;j++){ 74 87 lid = element->vertices[j]->Lid(); 75 if(local_mask[lid]==0.){ 76 local_mask[lid]=1.; 77 keepgoing = true; 78 didsomething = 1; 79 } 88 local_mask[lid]=1.; 80 89 } 90 keepgoing = true; 81 91 } 82 92 } … … 99 109 xDelete<bool>(element_flag); 100 110 111 int killbergReinit = 0; 101 112 /*OK, now deactivate iceberg and count the number of deactivated vertices*/ 102 113 for(Object* & object : femmodel->elements->objects){ … … 120 131 element->AddInput(MaskIceLevelsetEnum,values,P1Enum); 121 132 xDelete<IssmDouble>(values); 133 killbergReinit += 1; 122 134 } 123 135 } 124 136 } 125 126 137 /*cleanup*/ 127 138 xDelete<IssmDouble>(local_mask); 139 140 /*Recompute the sign distance for the levelset function*/ 141 return killbergReinit; 128 142 }
Note:
See TracChangeset
for help on using the changeset viewer.