Changeset 13407


Ignore:
Timestamp:
09/19/12 12:09:37 (12 years ago)
Author:
utke
Message:

CHG use call to ensure contiguous locations for arguments passed to EDF ; commented out debug prints - to be removed when regression is successfull

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp

    r13375 r13407  
    3535        if(N!=N2)_error_("Right hand side vector of size " << N2 << ", when matrix is of size " << M << "-" << N << " !");
    3636        if(M!=N)_error_("Stiffness matrix should be square!");
     37#ifdef _HAVE_ADOLC_
     38        ensureContiguousLocations(N);
     39#endif
    3740        IssmDouble *x  = xNew<IssmDouble>(N);
    38 
    3941#ifdef _HAVE_ADOLC_
    4042        SolverxSeq(x,Kff->matrix,pf->vector,N,parameters);
     
    7476int EDF_fos_forward_for_solverx(int n, IssmPDouble *inVal, IssmPDouble *inDeriv, int m, IssmPDouble *outVal, IssmPDouble *outDeriv) { /*{{{*/
    7577#ifdef _HAVE_GSL_
     78//  for (int i=0; i<m*m; ++i) std::cout << "EDF_fos_forward_for_solverx A["<< i << "]=" << inVal[i] << std::endl;
     79//  for (int i=0; i<m; ++i) std::cout << "EDF_fos_forward_for_solverx b["<< i << "]=" << inVal[i+m*m] << std::endl;
    7680  // the matrix will be modified by LU decomposition. Use gsl_A copy
    7781  double* Acopy = xNew<double>(m*m);
     
    9094  xMemCpy(outVal,gsl_vector_ptr(gsl_x_p,0),m);
    9195  gsl_vector_free(gsl_x_p);
     96//  for (int i=0; i<m; ++i) std::cout << "EDF_fos_forward_for_solverx x["<< i << "]=" << outVal[i] << std::endl;
    9297  // solve for the derivatives acc. to A * dx = r  with r=db - dA * x
    9398  // compute the RHS
     
    161166void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters){/*{{{*/
    162167        // pack inputs to conform to the EDF-prescribed interface
     168        // ensure a contiguous block of locations:
     169        ensureContiguousLocations(n*(n+1));
    163170        IssmDouble*  adoubleEDFin=xNew<IssmDouble>(n*(n+1));  // packed inputs, i.e. matrix and right hand side
    164171        for(int i=0; i<n*n;i++)adoubleEDFin[i]    =A[i];      // pack matrix
     
    170177                     n*(n+1), pdoubleEDFin, adoubleEDFin,
    171178                     n, pdoubleEDFout,X);
     179        // for(int i=0; i<n;  i++) {ADOLC_DUMP_MACRO(X[i]);}
    172180        xDelete(adoubleEDFin);
    173181        xDelete(pdoubleEDFin);
     
    184192        gsl_vector      *x = NULL;
    185193        gsl_permutation *p = NULL;
     194//      for (int i=0; i<n*n; ++i) std::cout << "SolverxSeq A["<< i << "]=" << A[i] << std::endl;
     195//      for (int i=0; i<n; ++i) std::cout << "SolverxSeq b["<< i << "]=" << B[i] << std::endl;
    186196        /*A will be modified by LU decomposition. Use copy*/
    187197        double* Acopy = xNew<double>(n*n);
     
    203213        /*Copy result*/
    204214        xMemCpy(X,gsl_vector_ptr(x,0),n);
     215//      for (int i=0; i<n; ++i) std::cout << "SolverxSeq x["<< i << "]=" << X[i] << std::endl;
    205216
    206217        /*Clean up and assign output pointer*/
Note: See TracChangeset for help on using the changeset viewer.