Changeset 13407
- Timestamp:
- 09/19/12 12:09:37 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp
r13375 r13407 35 35 if(N!=N2)_error_("Right hand side vector of size " << N2 << ", when matrix is of size " << M << "-" << N << " !"); 36 36 if(M!=N)_error_("Stiffness matrix should be square!"); 37 #ifdef _HAVE_ADOLC_ 38 ensureContiguousLocations(N); 39 #endif 37 40 IssmDouble *x = xNew<IssmDouble>(N); 38 39 41 #ifdef _HAVE_ADOLC_ 40 42 SolverxSeq(x,Kff->matrix,pf->vector,N,parameters); … … 74 76 int EDF_fos_forward_for_solverx(int n, IssmPDouble *inVal, IssmPDouble *inDeriv, int m, IssmPDouble *outVal, IssmPDouble *outDeriv) { /*{{{*/ 75 77 #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; 76 80 // the matrix will be modified by LU decomposition. Use gsl_A copy 77 81 double* Acopy = xNew<double>(m*m); … … 90 94 xMemCpy(outVal,gsl_vector_ptr(gsl_x_p,0),m); 91 95 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; 92 97 // solve for the derivatives acc. to A * dx = r with r=db - dA * x 93 98 // compute the RHS … … 161 166 void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters){/*{{{*/ 162 167 // pack inputs to conform to the EDF-prescribed interface 168 // ensure a contiguous block of locations: 169 ensureContiguousLocations(n*(n+1)); 163 170 IssmDouble* adoubleEDFin=xNew<IssmDouble>(n*(n+1)); // packed inputs, i.e. matrix and right hand side 164 171 for(int i=0; i<n*n;i++)adoubleEDFin[i] =A[i]; // pack matrix … … 170 177 n*(n+1), pdoubleEDFin, adoubleEDFin, 171 178 n, pdoubleEDFout,X); 179 // for(int i=0; i<n; i++) {ADOLC_DUMP_MACRO(X[i]);} 172 180 xDelete(adoubleEDFin); 173 181 xDelete(pdoubleEDFin); … … 184 192 gsl_vector *x = NULL; 185 193 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; 186 196 /*A will be modified by LU decomposition. Use copy*/ 187 197 double* Acopy = xNew<double>(n*n); … … 203 213 /*Copy result*/ 204 214 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; 205 216 206 217 /*Clean up and assign output pointer*/
Note:
See TracChangeset
for help on using the changeset viewer.