Defining my own reordering method for ILU

Laslo T. Diosady diosady at MIT.EDU
Wed Feb 21 19:36:05 CST 2007


Hi Barry,

I tried the "PETSc" way and was successful.

Thanks for the help,

Laslo


On Feb 21, 2007, at 4:04 PM, Barry Smith wrote:

>
>   Laslo,
>
>    I would just "cheat" and compute the ordering up front and
> then just have it as a global variable that you access in the routine.
>
>    The more "PETSc" way would be to use PetscObjectCompose to stick the
> ordering you have computed in the matrix then PetscObjectQuery() to get
> it out inside the MyOrdering routine.
>
>    Barry
>
> On Wed, 21 Feb 2007, Laslo Tibor Diosady wrote:
>
>> Hi Barry,
>>
>> If I understand how this works then I need to create a function
>> MatOrdering_MyOrdering(Mat mat,const MatOrderingType type,IS *irow,IS
>> *icol)
>>
>> My problem is that in order to compute my matrix ordering I need data
>> other than the matrix as input.
>>
>> I can't see how I can do that if those are the only four arguments
>> passed to the function.
>>
>> Thanks,
>>
>> Laslo
>>
>>
>>
>> On Wed, 2007-02-21 at 11:27 -0600, Barry Smith wrote:
>>>   Laslo,
>>>
>>>    You can do your ordering up front to generate an index set.
>>> But you will still need to write a routine MatOrdering_MyOrdering() 
>>> that
>>> returns the isrow and iscol, then register the routine
>>> with MatOrderingRegisterDynamic(). Then use PCFactorSetMatOrdering()
>>> to tell the PC to use your new ordering routine.
>>>
>>> To have the preconditioner reuse the reordering for several matrices
>>> use PCFactorSetReuseOrdering().
>>>
>>>   Good luck,
>>>
>>>    Barry
>>>
>>> I know it is a little strange to need to provide the call back 
>>> function
>>> MatOrdering_MyOrdering() that simply returns the ordering you already
>>> created but that is the only way to get the ordering into the right
>>> place inside the PC objects.
>>>
>>> The MatOrdering_MyOrdering() simply sets the isrow and iscol pointer
>>> and returns.
>>>
>>> On Wed, 21 Feb 2007, Laslo Tibor Diosady wrote:
>>>
>>>> Hi,
>>>>
>>>> I want to be able to define an ordering type for the ILU 
>>>> factorization
>>>> to be used as a preconditioner to GMRES. I have successfully used
>>>> PCFactorSetMatOrdering(), to set standard types, however I have my 
>>>> own
>>>> reordering method which I would like to be able to use.
>>>>
>>>> Since my reordering method is based on information not found within 
>>>> the
>>>> matrix and I may want to solve several different systems with the 
>>>> same
>>>> ordering, what I really want to be able to do is create an index 
>>>> set in
>>>> advance and pass it is to be used for the reordering.
>>>>
>>>> Is this possible, and how would you suggest I go about doing this?
>>>>
>>>> Thanks,
>>>>
>>>> Laslo
>>>>
>>>>
>>>
>>
>>
>




More information about the petsc-users mailing list