[17802] | 1 | Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp (revision 17704)
|
---|
| 4 | +++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp (revision 17705)
|
---|
| 5 | @@ -63,27 +63,15 @@
|
---|
| 6 | IssmDouble* serial_vertexgrounded = NULL;
|
---|
| 7 | IssmDouble* serial_vertexfloating = NULL;
|
---|
| 8 | IssmDouble* phi = NULL;
|
---|
| 9 | - int index;
|
---|
| 10 | - int* dof=NULL;
|
---|
| 11 | - IssmDouble* xyz_list=NULL;
|
---|
| 12 |
|
---|
| 13 | /*Initialize vector with number of vertices*/
|
---|
| 14 | - int numberofvertices = vertices->NumberOfVertices();
|
---|
| 15 | - vertexgrounded = new Vector<IssmDouble>(numberofvertices);
|
---|
| 16 | - vertexfloating = new Vector<IssmDouble>(numberofvertices);
|
---|
| 17 | - phi = xNew<IssmDouble>(numberofvertices);
|
---|
| 18 | - IssmDouble x[numberofvertices];
|
---|
| 19 | -
|
---|
| 20 | - /*Get x coordinate for each vertex*/
|
---|
| 21 | - for(int i = 0;i<elements->Size();i++){
|
---|
| 22 | - Element* element = dynamic_cast<Element*>(elements->GetObjectByOffset(i));
|
---|
| 23 | - element->GetVerticesCoordinates(&xyz_list);
|
---|
| 24 | - element->GetDofList(&dof,FSvelocityEnum,GsetEnum);
|
---|
| 25 | - for (int j=0;j<3;j++) x[dof[j]]=xyz_list[3*j];
|
---|
| 26 | - }
|
---|
| 27 | + int numberofvertices = vertices->NumberOfVertices();
|
---|
| 28 | + vertexgrounded = new Vector<IssmDouble>(numberofvertices);
|
---|
| 29 | + vertexfloating = new Vector<IssmDouble>(numberofvertices);
|
---|
| 30 | + phi = xNew<IssmDouble>(numberofvertices);
|
---|
| 31 |
|
---|
| 32 | /*Fill vector vertices_potentially_floating: */
|
---|
| 33 | - for(int i = 0;i<elements->Size();i++){
|
---|
| 34 | + for(int i=0;i<elements->Size();i++){
|
---|
| 35 | Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
|
---|
| 36 | element->FSContactMigration(vertexgrounded,vertexfloating);
|
---|
| 37 | }
|
---|
| 38 | @@ -91,27 +79,22 @@
|
---|
| 39 | /*Assemble vector and serialize */
|
---|
| 40 | vertexgrounded->Assemble();
|
---|
| 41 | vertexfloating->Assemble();
|
---|
| 42 | - serial_vertexgrounded = vertexgrounded->ToMPISerial();
|
---|
| 43 | - serial_vertexfloating = vertexfloating->ToMPISerial();
|
---|
| 44 | + serial_vertexgrounded=vertexgrounded->ToMPISerial();
|
---|
| 45 | + serial_vertexfloating=vertexfloating->ToMPISerial();
|
---|
| 46 |
|
---|
| 47 | - /*find vertex on GL */
|
---|
| 48 | - for(int i = 0;i<numberofvertices;i++){
|
---|
| 49 | + /*find vertices on GL */
|
---|
| 50 | + for(int i=0;i<numberofvertices;i++){
|
---|
| 51 | if(serial_vertexgrounded[i]==1. && serial_vertexfloating[i]==1.){
|
---|
| 52 | - phi[i] = 0.;
|
---|
| 53 | - index = i;
|
---|
| 54 | + phi[i]=0.;
|
---|
| 55 | }
|
---|
| 56 | - }
|
---|
| 57 | -
|
---|
| 58 | - /*assign value for phi, grounded if >0*/
|
---|
| 59 | - for(int i = 0;i<numberofvertices;i++){
|
---|
| 60 | - if (x[i] < x[index]) {
|
---|
| 61 | - phi[i] = 1.;
|
---|
| 62 | + else if(serial_vertexgrounded[i]==1.){
|
---|
| 63 | + phi[i]=1.;
|
---|
| 64 | }
|
---|
| 65 | - else if (x[i] > x[index]) {
|
---|
| 66 | - phi[i] = -1.;
|
---|
| 67 | + else if(serial_vertexfloating[i]==1.){
|
---|
| 68 | + phi[i]=-1.;
|
---|
| 69 | }
|
---|
| 70 | - else if (x[i]==x[index]) {
|
---|
| 71 | - phi[i] = 0;
|
---|
| 72 | + else{
|
---|
| 73 | + _error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")");
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 |
|
---|