Setting options on matrices obtained from a DM

Barry Smith bsmith at mcs.anl.gov
Wed Jul 22 10:19:34 CDT 2009


On Jul 22, 2009, at 9:56 AM, Lisandro Dalcin wrote:

> On Wed, Jul 22, 2009 at 12:20 AM, Barry Smith<bsmith at mcs.anl.gov>  
> wrote:
>>
>> On Jul 21, 2009, at 7:47 PM, Jed Brown wrote:
>>
>>> Barry Smith wrote:
>>>
>>    This is just a limitation of the current implementation due to  
>> the way
>> the design evolved over time.
>> There is nothing intrinsic to the abstract design of PETSc that  
>> prevents the
>> type from being
>> properly processed before the sizes are set.
>>
>
> I agree 100% with you.. the only issue are tons of code to review  
> and fix :-(
>
>>
>>   This is really yucky API you propose here; that no sane person  
>> would
>> propose except to work
>> around a shortfall in the current implementation.
>>
>
> We could start fixing Vec,

    Ok. VecCreate_Seq()/VecCreate_Seq_Private() and  
VecCreate_MPI_Private() do the following

1) create the Vec_xxx struct and copy over the function tables  
(setting the methods)
2) use PetscMapSetUp() to determine the local/global sizes
3) allocate space for the array if needed.

   What we want is if the sizes are not yet set then it should still  
copy over the function table (1), but delay (2) and (3) until the sizes
are set. This could be done by removing the following from VecSetType()
   if (vec->map->n < 0 && vec->map->N < 0) {
     vec->ops->create = r;
   } else {
     ierr = (*r)(vec);CHKERRQ(ierr);
   }
and instead have each individual VecCreate_xxx() do the method setup  
and then
if sizes set) do the PetscMapSetUp() and allocate space
else) set the vec->ops->create pointer to a new function that does the  
PetscMapSetUp() and allocate space

In other words split the VecCreate_xxx() into two functions and call  
the second when the sizes are available.

   Something similar for Matrices?

    Barry




    Barry


> next go for Mat ...
>
>
> -- 
> 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