Changeset 17705
- Timestamp:
- 04/09/14 19:53:11 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r17704 r17705 64 64 IssmDouble* serial_vertexfloating = NULL; 65 65 IssmDouble* phi = NULL; 66 int index;67 int* dof=NULL;68 IssmDouble* xyz_list=NULL;69 66 70 67 /*Initialize vector with number of vertices*/ 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 } 68 int numberofvertices = vertices->NumberOfVertices(); 69 vertexgrounded = new Vector<IssmDouble>(numberofvertices); 70 vertexfloating = new Vector<IssmDouble>(numberofvertices); 71 phi = xNew<IssmDouble>(numberofvertices); 84 72 85 73 /*Fill vector vertices_potentially_floating: */ 86 for(int i =0;i<elements->Size();i++){74 for(int i=0;i<elements->Size();i++){ 87 75 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 88 76 element->FSContactMigration(vertexgrounded,vertexfloating); … … 92 80 vertexgrounded->Assemble(); 93 81 vertexfloating->Assemble(); 94 serial_vertexgrounded =vertexgrounded->ToMPISerial();95 serial_vertexfloating =vertexfloating->ToMPISerial();96 97 /*find vert exon GL */98 for(int i =0;i<numberofvertices;i++){82 serial_vertexgrounded=vertexgrounded->ToMPISerial(); 83 serial_vertexfloating=vertexfloating->ToMPISerial(); 84 85 /*find vertices on GL */ 86 for(int i=0;i<numberofvertices;i++){ 99 87 if(serial_vertexgrounded[i]==1. && serial_vertexfloating[i]==1.){ 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; 88 phi[i]=0.; 89 } 90 else if(serial_vertexgrounded[i]==1.){ 91 phi[i]=1.; 92 } 93 else if(serial_vertexfloating[i]==1.){ 94 phi[i]=-1.; 95 } 96 else{ 97 _error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")"); 115 98 } 116 99 }
Note:
See TracChangeset
for help on using the changeset viewer.