Thanks a lot!<br><br><b><i>Matthew Knepley <knepley@gmail.com></i></b> дµÀ£º<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> On Nov 14, 2007 4:12 AM, jiaxun hou <jiaxun_hou@yahoo.com.cn> wrote:<br>> Dear all,<br>><br>> Does anyone have examples of using MatGetRow/MatRestoreRow?<br>> I failed in using them.<br>><br>> My code is:<br>><br>> PetscInt ncols_A;<br>> const PetscInt** cols_A_point;<br>> const PetscScalar **vals_A_point;<br><br>This is not proper C usage since you never allocate space for the<br>pointers. You want<br><br>const PetscInt *cols;<br>const PetscScalar *vals;<br><br>> for (i=0;i<row_A;i++){><br>> ierr = MatGetRow(A,i,&ncols_A,cols_A_point,vals_A_point);CHKERRQ(ierr);<br><br>MatGetRow(A,i,&ncols,&cols,&vals);<br><br>and so on.<br><br> Matt<br><br>> //do something<br>> ierr =
MatRestoreRow(A,i,&ncols_A,cols_A_point,vals_A_point);CHKERRQ(ierr);<br>> }<br>><br>> and it gets errors as below:<br>><br>> Petsc Release Version 2.3.1, Patch 10, Thu Mar 9 22:48:00 CST 2006<br>> BK revision: balay@asterix.mcs.anrank 0 in job 61 lab_43825 caused<br>> collective abort of all ranks<br>> exit status of rank 0: killed by signal 9<br>> [cli_0]: aborting job:<br>> application called MPI_Abort(MPI_COMM_WORLD, 64) - process 0<br>> l.gov|ChangeSet|20060310044535|22333<br>> See docs/changes/index.html for recent updates.<br>> See docs/faq.html for hints about<br>> trouble shooting.<br>> See docs/index.html for manual pages.<br>> ------------------------------------------------------------------------<br>> ./mytest1 on a linux-gnu named lab by root Wed Nov 14 17:57:00 2007<br>> Libraries linked from<br>> /home/software/petsc-2.3.1-p10/lib/linux-gnu-cxx-complex-debug<br>> Configure run at Thu Jun 15
13:08:29 2006<br>> Configure options --with-cc=gcc --with-fc=gfortran<br>> --download-f-blas-lapack=1 --with-mpi-dir=/home/software/mpich2<br>> --with-scalar-type=complex --with-shared=0<br>> ------------------------------------------------------------------------<br>> [0]PETSC ERROR: PetscObjectDestroy() line 88 in src/sys/objects/destroy.c<br>> [0]PETSC ERROR: Corrupt argument: see<br>> http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Corrupt!<br>> [0]PETSC ERROR: Invalid type of object: Parameter # 1!<br>> [0]PETSC ERROR: PetscObjectRegisterDestroyAll() line 228 in<br>> src/sys/objects/destroy.c<br>> [0]PETSC ERROR: PetscFinalize() line 599 in<br>> src/sys/objects/pinit.c<br>> [0]PETSC ERROR: main() line 329 in /home/myprogram/mypro/mytest1.c<br>> make: [runmytest1] Error 137 (ignored)<br>><br>> Can anyone tell me where is wrong? THX<br>><br>><br>><br>>
________________________________<br>> ÑÅ»¢ÓÊÏ䣬ÖÕÉú»ï°é£¡<br><br><br><br>-- <br>What most experimenters take for granted before they begin their<br>experiments is infinitely more interesting than any results to which<br>their experiments lead.<br>-- Norbert Wiener<br><br></row_A;i++){></jiaxun_hou@yahoo.com.cn></blockquote><br><p> 
<hr size=1><a href="https://member.cn.yahoo.com/cnreg/reginfo.html?id=89034" target=blank>ÑÅ»¢ÓÊÏ䣬ÖÕÉú»ï°é£¡</a>