Super late update, sorry.

Not sure
if I understood you correctly:
if(n) { 
    PetscValidScalarPointer(r,3);
    ierr = PetscPrintf(PETSC_COMM_WORLD, " ---> n = %d nonzero if.\n", 
n);CHKERRQ(ierr);
  } else {
    ierr = PetscPrintf(PETSC_COMM_WORLD, " ---> n = 0 else.\n");CHKERRQ(ierr);
  }

I get (btw this is also the case with a single process):
./test1 -pc_type mg -pc_mg_levels 3

 ---> n = 0 else.
[0]PETSC ERROR: --------------------- Error Message 
--------------------------------------------------------------
[0]PETSC ERROR: Null argument, when expecting valid pointer
[0]PETSC ERROR: Null Pointer: Parameter # 4
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for 
trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.5.2-925-g233c798  GIT Date: 
2014-11-03 17:44:15 -0700
[0]PETSC ERROR: ./test1 on a arch-linux2-cxx-opt named Besikovitch-III by 
filippo Mon Nov 10 15:15:47 2014
[0]PETSC ERROR: Configure options PETSC_ARCH=arch-linux2-cxx-opt
[0]PETSC ERROR: #1 KSPComputeEigenvalues() line 125 in 
/home/filippo/Workspace/petsc-git/ksp-zero-eig/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: #2 KSPChebyshevComputeExtremeEigenvalues_Private() line 328 in 
/home/filippo/Workspace/petsc-git/ksp-zero-eig/src/ksp/ksp/impls/cheby/cheby.c
[0]PETSC ERROR: #3 KSPSolve_Chebyshev() line 373 in 
/home/filippo/Workspace/petsc-git/ksp-zero-eig/src/ksp/ksp/impls/cheby/cheby.c
[0]PETSC ERROR: #4 KSPSolve() line 465 in /home/filippo/Workspace/petsc-
git/ksp-zero-eig/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: #5 PCMGMCycle_Private() line 19 in 
/home/filippo/Workspace/petsc-git/ksp-zero-eig/src/ksp/pc/impls/mg/mg.c
[0]PETSC ERROR: #6 PCApply_MG() line 337 in /home/filippo/Workspace/petsc-
git/ksp-zero-eig/src/ksp/pc/impls/mg/mg.c
[0]PETSC ERROR: #7 PCApply() line 440 in /home/filippo/Workspace/petsc-
git/ksp-zero-eig/src/ksp/pc/interface/precon.c
[0]PETSC ERROR: #8 KSP_PCApply() line 230 in /home/filippo/Workspace/petsc-
git/ksp-zero-eig/include/petsc-private/kspimpl.h
[0]PETSC ERROR: #9 KSPInitialResidual() line 63 in 
/home/filippo/Workspace/petsc-git/ksp-zero-eig/src/ksp/ksp/interface/itres.c
[0]PETSC ERROR: #10 KSPSolve_GMRES() line 234 in 
/home/filippo/Workspace/petsc-git/ksp-zero-eig/src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: #11 KSPSolve() line 465 in /home/filippo/Workspace/petsc-
git/ksp-zero-eig/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: #12 main() line 149 in 
/home/filippo/Workspace/C++/MLMCTest/test1.cpp
[0]PETSC ERROR: ----------------End of Error Message -------send entire error 
message to [email protected]

On Thursday 06 November 2014 11.27:59 you wrote:
> if (n) PetscValidScalarPointer(r,3);
> and put a print statement.  n==0 in your case when it fails.
BEGIN:VCARD
ADR;TYPE=work:;;Rämistrasse 101;Zurich;Zurich;8092 Zürich;Switzerland
EMAIL:[email protected]
FN:Filippo Leonardi
N:Leonardi;Filippo;;;
ORG:ETHZ;D-MATH
TEL;TYPE=WORK:(+41) 44 633 9379
UID:a15238e7-9e99-416c-a858-c89834b2b81f
VERSION:3.0
X-KADDRESSBOOK-X-Office:HG J 45
END:VCARD

Reply via email to