Changeset 17704
- Timestamp:
- 04/09/14 19:18:18 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r17641 r17704 64 64 IssmDouble* serial_vertexfloating = NULL; 65 65 IssmDouble* phi = NULL; 66 int index; 67 int* dof=NULL; 68 IssmDouble* xyz_list=NULL; 66 69 67 70 /*Initialize vector with number of vertices*/ 68 int numberofvertices=vertices->NumberOfVertices(); 69 vertexgrounded=new Vector<IssmDouble>(numberofvertices); 70 vertexfloating=new Vector<IssmDouble>(numberofvertices); 71 phi =xNew<IssmDouble>(numberofvertices); 71 int numberofvertices = vertices->NumberOfVertices(); 72 vertexgrounded = new Vector<IssmDouble>(numberofvertices); 73 vertexfloating = new Vector<IssmDouble>(numberofvertices); 74 phi = xNew<IssmDouble>(numberofvertices); 75 IssmDouble x[numberofvertices]; 76 77 /*Get x coordinate for each vertex*/ 78 for(int i = 0;i<elements->Size();i++){ 79 Element* element = dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 80 element->GetVerticesCoordinates(&xyz_list); 81 element->GetDofList(&dof,FSvelocityEnum,GsetEnum); 82 for (int j=0;j<3;j++) x[dof[j]]=xyz_list[3*j]; 83 } 72 84 73 85 /*Fill vector vertices_potentially_floating: */ 74 for(int i =0;i<elements->Size();i++){86 for(int i = 0;i<elements->Size();i++){ 75 87 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 76 88 element->FSContactMigration(vertexgrounded,vertexfloating); … … 80 92 vertexgrounded->Assemble(); 81 93 vertexfloating->Assemble(); 82 serial_vertexgrounded=vertexgrounded->ToMPISerial(); 83 serial_vertexfloating=vertexfloating->ToMPISerial(); 84 85 for(int i=0;i<numberofvertices;i++){ 94 serial_vertexgrounded = vertexgrounded->ToMPISerial(); 95 serial_vertexfloating = vertexfloating->ToMPISerial(); 96 97 /*find vertex on GL */ 98 for(int i = 0;i<numberofvertices;i++){ 86 99 if(serial_vertexgrounded[i]==1. && serial_vertexfloating[i]==1.){ 87 phi[i]=0.; 88 } 89 else if(serial_vertexgrounded[i]==1.){ 90 phi[i]=1.; 91 } 92 else if(serial_vertexfloating[i]==1.){ 93 phi[i]=-1.; 94 } 95 else{ 96 _error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")"); 100 phi[i] = 0.; 101 index = i; 102 } 103 } 104 105 /*assign value for phi, grounded if >0*/ 106 for(int i = 0;i<numberofvertices;i++){ 107 if (x[i] < x[index]) { 108 phi[i] = 1.; 109 } 110 else if (x[i] > x[index]) { 111 phi[i] = -1.; 112 } 113 else if (x[i]==x[index]) { 114 phi[i] = 0; 97 115 } 98 116 }
Note:
See TracChangeset
for help on using the changeset viewer.