On Wed, Jul 22, 2009 at 12:19 PM, Barry Smith<bsmith at mcs.anl.gov> wrote:
>
> 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 in such direction should work... However...

>
> ?Something similar for Matrices?
>

If you do MatSetType(A, MATAIJ), you end-up having a MATSEQAIJ or a
MPIMPIAIJ... Vec does not have such "aliasing" on type names ...


I'll try to give look at Vec to figure out what to do in a way that
can be ported to Mat taking into account my previous comment.


-- 
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

Reply via email to