Dear Petsc developers,
I have a vector M which consists of a series of 3d vectors, and I want to reset
M by normalizing each 3d vector. Here is my code:
/**********************************************************************VecGetArray(M,
&aM); DMDAGetCorners(da, &xs, 0, 0, &xm, 0, 0); for(node=xs;
node<xs+xm; node++){ mag=0.0; for(l=0; l<3; l++) {
val[l]=aM[node*3+l]; mag=mag+val[l]*val[l]; }
mag=sqrt(mag); for(l=0; l<user->NDOF; l++) {
aM[node*3+l]=val[l]/mag; }}VecRestoreArray(M, &aM);
VecAssemblyBegin(M);VecAssemblyEnd(M); VecView(M,
PETSC_VIEWER_STDOUT_WORLD);**********************************************************************/
but I got the error at the last
step:--------------------------------------------------------------------------mpiexec
noticed that process rank 3 with PID 17156 on node compute-21-8.local exited
on signal 6
(Aborted).--------------------------------------------------------------------------and
if I commented out VecView, and used vector M for other operations,
e.g.KSPSolve(ksp, M, b), I got "memory corruption" message. Your comment on
this issue is well appreciated.