changing MatSetUp()

Barry Smith bsmith at mcs.anl.gov
Tue Oct 23 15:40:12 CDT 2007


  This is a valid point. I have to agree with Matt

 In KSPSetUp() we have
  if (!((PetscObject)ksp)->type_name){
    ierr = KSPSetType(ksp,KSPGMRES);CHKERRQ(ierr);
  }

  In PCSetUp() we have

  if (!((PetscObject)pc)->type_name) {
    ierr = PCGetDefaultType_Private(pc,&def);CHKERRQ(ierr);
    ierr = PCSetType(pc,def);CHKERRQ(ierr);
  }

  In SNESSetUp() we have 

  if (!((PetscObject)snes)->type_name) {
    ierr = SNESSetType(snes,SNESLS);CHKERRQ(ierr);
  }

   BUT in VecSetUp() we again have the "illegal"

  ierr = VecSetFromOptions(v);CHKERRQ(ierr);

  I think we should have MatSetUp() and VecSetUp()
behave like the others and set a default one if it is
not already set; and NOT call SetFromOptions.

   Barry



On Tue, 23 Oct 2007, Matthew Knepley wrote:

> I am not sure about this. MatSetFromOptions() is intentionally optional,
> and should not be bundled in a method not intended to be optional.
> 
>   Matt
> 
> On 10/23/07, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> > After greping, it seems that MatSetUp() is not used in all 'petsc-dev'
> > repo. If there is no objections (Barry?), I will change it (by
> > reverting inner calls order) to do the following:
> >
> > PetscErrorCode MatSetUp(Mat A)
> > {
> >   MatSetFromOptions(A);
> >   MatSetUpPreallocation(A);
> > }
> >
> > As I mailed some time ago, there is no point of calling
> > MatSetUpPreallocation() if the matrix type was not set.
> >
> >
> > --
> > Lisandro Dalcín
> > ---------------
> > Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> > Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> > Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> > PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> > Tel/Fax: +54-(0)342-451.1594
> >
> >
> 
> 
> 


More information about the petsc-dev mailing list