source: issm/oecreview/Archive/16554-17801/ISSM-17704-17705.diff@ 17802

Last change on this file since 17802 was 17802, checked in by Mathieu Morlighem, 11 years ago

Added archives

File size: 2.8 KB
  • ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

     
    6363        IssmDouble*  serial_vertexgrounded = NULL;
    6464        IssmDouble*  serial_vertexfloating = NULL;
    6565        IssmDouble*  phi                   = NULL;
    66         int index;
    67         int* dof=NULL;
    68         IssmDouble* xyz_list=NULL;
    6966
    7067        /*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);
    8472
    8573        /*Fill vector vertices_potentially_floating: */
    86         for(int i = 0;i<elements->Size();i++){
     74        for(int i=0;i<elements->Size();i++){
    8775                Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    8876                element->FSContactMigration(vertexgrounded,vertexfloating);
    8977        }
     
    9179        /*Assemble vector and serialize */
    9280        vertexgrounded->Assemble();
    9381        vertexfloating->Assemble();
    94         serial_vertexgrounded = vertexgrounded->ToMPISerial();
    95         serial_vertexfloating = vertexfloating->ToMPISerial();
     82        serial_vertexgrounded=vertexgrounded->ToMPISerial();
     83        serial_vertexfloating=vertexfloating->ToMPISerial();
    9684
    97         /*find vertex on GL */
    98         for(int i = 0;i<numberofvertices;i++){
     85        /*find vertices on GL */
     86        for(int i=0;i<numberofvertices;i++){
    9987                if(serial_vertexgrounded[i]==1. && serial_vertexfloating[i]==1.){
    100                         phi[i] = 0.;
    101                         index  = i;
     88                        phi[i]=0.;
    10289                }
    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.;
     90                else if(serial_vertexgrounded[i]==1.){
     91                        phi[i]=1.;
    10992                }
    110                 else if (x[i] > x[index]) {
    111                         phi[i] = -1.;
     93                else if(serial_vertexfloating[i]==1.){
     94                        phi[i]=-1.;
    11295                }
    113                 else if (x[i]==x[index]) {
    114                         phi[i] = 0;
     96                else{
     97                        _error_("not supported (vertexfloating="<<serial_vertexfloating[i]<<" vertexgrounded="<<serial_vertexgrounded[i]<<")");
    11598                }
    11699        }
    117100
Note: See TracBrowser for help on using the repository browser.