Changeset 16759


Ignore:
Timestamp:
11/14/13 10:05:38 (11 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixing update for adjoint FS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp

    r16752 r16759  
    9292
    9393        /*Initialize values*/
    94         IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
    95         IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
     94        IssmDouble* values  = xNew<IssmDouble>(vnumdof+pnumdof);
    9695        IssmDouble* lambdax = xNew<IssmDouble>(vnumnodes);
    9796        IssmDouble* lambday = xNew<IssmDouble>(vnumnodes);
    9897        IssmDouble* lambdaz = xNew<IssmDouble>(vnumnodes);
    9998        IssmDouble* lambdap = xNew<IssmDouble>(pnumnodes);
     99
     100        int* cs_list = xNew<int>(vnumnodes+pnumnodes);
     101        for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
     102        for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
    100103
    101104        /*Get dof list: */
     
    104107
    105108        /*Use the dof list to index into the solution vector: */
    106         for(i=0;i<vnumdof;i++) vvalues[i]=solution[vdoflist[i]];
    107         for(i=0;i<pnumdof;i++) pvalues[i]=solution[pdoflist[i]];
     109        for(i=0;i<vnumdof;i++) values[i]        =solution[vdoflist[i]];
     110        for(i=0;i<pnumdof;i++) values[vnumdof+i]=solution[pdoflist[i]];
    108111
    109112        /*Transform solution in Cartesian Space*/
    110         element->TransformSolutionCoord(&vvalues[0],XYZEnum);
     113        element->TransformSolutionCoord(values,cs_list);
    111114
    112115        /*fill in all arrays: */
    113116        for(i=0;i<vnumnodes;i++){
    114                 lambdax[i] = vvalues[i*NDOF3+0]; if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
    115                 lambday[i] = vvalues[i*NDOF3+1]; if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
    116                 lambdaz[i] = vvalues[i*NDOF3+2]; if(xIsNan<IssmDouble>(lambdaz[i])) _error_("NaN found in solution vector");
     117                lambdax[i] = values[i*NDOF3+0]; if(xIsNan<IssmDouble>(lambdax[i])) _error_("NaN found in solution vector");
     118                lambday[i] = values[i*NDOF3+1]; if(xIsNan<IssmDouble>(lambday[i])) _error_("NaN found in solution vector");
     119                lambdaz[i] = values[i*NDOF3+2]; if(xIsNan<IssmDouble>(lambdaz[i])) _error_("NaN found in solution vector");
    117120        }
    118121        for(i=0;i<pnumnodes;i++){
    119                 lambdap[i] = pvalues[i]; if(xIsNan<IssmDouble>(lambdap[i])) _error_("NaN found in solution vector");
     122                lambdap[i] = values[vnumdof+i]; if(xIsNan<IssmDouble>(lambdap[i])) _error_("NaN found in solution vector");
    120123        }
    121124
     
    133136        xDelete<int>(vdoflist);
    134137        xDelete<int>(pdoflist);
     138        xDelete<int>(cs_list);
    135139        xDelete<IssmDouble>(lambdap);
    136140        xDelete<IssmDouble>(lambdaz);
    137141        xDelete<IssmDouble>(lambday);
    138142        xDelete<IssmDouble>(lambdax);
    139         xDelete<IssmDouble>(vvalues);
    140         xDelete<IssmDouble>(pvalues);
     143        xDelete<IssmDouble>(values);
    141144}/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.