Changeset 5607


Ignore:
Timestamp:
08/27/10 09:23:37 (15 years ago)
Author:
Mathieu Morlighem
Message:

Fixed Rift parallel
Added check in Hook when demarshalling that num<1000 (sign of a forthcoming crash)
And minor cosmetics

Location:
issm/trunk/src/c
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp

    r5187 r5607  
    9090                        if (tb.det>0){
    9191                                //Area coordinate
    92                                 areacoord[0]= (double) dete[0]/ tb.det;
    93                                 areacoord[1]= (double) dete[1] / tb.det;
    94                                 areacoord[2]= (double) dete[2] / tb.det;
     92                                areacoord[0]= (double) dete[0]/tb.det;
     93                                areacoord[1]= (double) dete[1]/tb.det;
     94                                areacoord[2]= (double) dete[2]/tb.det;
    9595                                //3 vertices of the triangle
    9696                                i0=Th.GetId(tb[0]);
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp

    r5596 r5607  
    1414
    1515        /*DataSets*/
    16         Loads*    loads    = NULL;
    17         Icefront*   icefront = NULL;
    18         Riftfront*  riftfront= NULL;
    19         Pengrid*    pengrid  = NULL;
     16        Loads     *loads     = NULL;
     17        Icefront  *icefront = NULL;
     18        Riftfront *riftfront = NULL;
     19        Pengrid   *pengrid   = NULL;
    2020
    2121        /*Intermediary*/
     
    150150        for(i=0;i<iomodel->numrifts;i++){
    151151
    152                 if(iomodel->my_elements[(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2)]){
    153 
     152                if(iomodel->my_elements[(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2)-1]){
    154153                        loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
    155154                        count++;
  • issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r5096 r5607  
    8787                if(my_rank==epart[i]){
    8888
    89                         my_elements[i]=1;
     89                        my_elements[i]=true;
    9090                       
    9191                        /*Now that we are here, we can also start building the list of vertices belonging to this cpu partition: we use
     
    9393                         into the vertices coordinates. If we start plugging 1 into my_vertices for each index[n][i] (i=0:2), then my_vertices
    9494                         will hold which vertices belong to this partition*/
    95                         my_vertices[(int)*(iomodel->elements+elements_width*i+0)-1]=1;
    96                         my_vertices[(int)*(iomodel->elements+elements_width*i+1)-1]=1;
    97                         my_vertices[(int)*(iomodel->elements+elements_width*i+2)-1]=1;
     95                        my_vertices[(int)*(iomodel->elements+elements_width*i+0)-1]=true;
     96                        my_vertices[(int)*(iomodel->elements+elements_width*i+1)-1]=true;
     97                        my_vertices[(int)*(iomodel->elements+elements_width*i+2)-1]=true;
    9898                       
    9999                        if(elements_width==6){
    100                                 my_vertices[(int)*(iomodel->elements+elements_width*i+3)-1]=1;
    101                                 my_vertices[(int)*(iomodel->elements+elements_width*i+4)-1]=1;
    102                                 my_vertices[(int)*(iomodel->elements+elements_width*i+5)-1]=1;
     100                                my_vertices[(int)*(iomodel->elements+elements_width*i+3)-1]=true;
     101                                my_vertices[(int)*(iomodel->elements+elements_width*i+4)-1]=true;
     102                                my_vertices[(int)*(iomodel->elements+elements_width*i+5)-1]=true;
    103103                        }
    104104                }
  • issm/trunk/src/c/objects/Hook.cpp

    r5452 r5607  
    185185
    186186                /*demarshall allocated ids and offsets: */
     187                ISSMASSERT(num<1000);
    187188                for (i=0;i<num;i++){
    188189                        memcpy(&this->ids[i],marshalled_dataset,sizeof(int));marshalled_dataset+=sizeof(int);
  • issm/trunk/src/c/objects/Loads/Riftfront.cpp

    r5341 r5607  
    215215        return sizeof(id)
    216216                +sizeof(analysis_type)
    217 
    218217                +sizeof(active)
    219218                +sizeof(normal)
  • issm/trunk/src/c/shared/Numerics/OptimalSearch.cpp

    r5595 r5607  
    2222        double fx1,fx2,fxbest;
    2323        double x1,x2,xmin,xbest;
    24         double distance;
    2524
    2625        /*tolerances: */
    27         double tol1,tol2,seps,tolerance;
     26        double seps,tolerance;
    2827        int    maxiter;
    2928
     
    4746        //update tolerances
    4847        seps=sqrt(DBL_EPSILON);
    49         tol1=seps*sqrt(pow(x1,2))+tolerance/3.0;
    50         tol2=2.0*tol1;
    5148
    5249        loop=true;
     
    5754                fx2 = (*f)(x2,optargs);
    5855                if isnan(fx2) ISSMERROR("Function evaluation returned NaN");
    59                 _printf_("         %5i    %12.6g  %12.6g  %12.6g\n",iter,x2,fx2,pow(pow(x2-x1,2),0.5));
     56                _printf_("         %5i    %12.6g  %12.6g  %12.6g\n",iter,x2,fx2,fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1));
    6057
    6158                //Stop the optimization?
    62                 tol1=seps*pow(pow(x2,2),0.5)+tolerance/3.0;
    63                 tol2=2.0*tol1;
    64                 if (sqrt(pow(x2-x1,2)) < (tol2-0.5*(distance))){
    65                         _printf_("      %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of" ,tolerance);
     59                if ((fabs(x2-x1)+seps)<tolerance || (fabs(fx2-fx1)+seps)<tolerance){
     60                        _printf_("      %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of " ,tolerance);
    6661                        loop=false;
    6762                }
Note: See TracChangeset for help on using the changeset viewer.