[petsc-users] Retreiving a PetscObject

Matthew Knepley knepley at gmail.com
Fri Jan 13 10:16:38 CST 2023


On Fri, Jan 13, 2023 at 5:58 AM Eric Chamberland <
Eric.Chamberland at giref.ulaval.ca> wrote:

> ok, here is what I want to do:
>
> I am writing a brand new PC which needs some other PETSc objects like a
> Vec (for unit partition).
>
> We have a text based user file format in which the user can create
> arbitrary Petsc's Vec or Mat.
>
> Then, I would like the user to give the prefix of these Vec or Mat as a
> parameter for the new PC that we would like to configure completely via the
> "petsc options database".
>
> So in our PCApply_XXX we would like to retrieve some specific options
> which will simply give the Vec prefix to retreive.
>
> Okay, so a named vector is created when options are processed, and you
want to use that vector by name inside your new PC.

1. You could add that vector to a list you manage at creation time. This
means that you are in charge of that list.

2. DM has named vectors (
https://petsc.org/release/docs/manualpages/DM/DMGetNamedGlobalVector/) but
not matrices

You could probably just extract the DM code to manage your objects.

  Thanks,

      Matt


> Thanks,
>
> Eric
>
>
> On 2023-01-13 15:39, Matthew Knepley wrote:
>
> On Fri, Jan 13, 2023 at 4:24 AM Eric Chamberland <
> Eric.Chamberland at giref.ulaval.ca> wrote:
>
>> Hi,
>>
>> Is it possible with PETSc's API to query an objet by it's name?
>>
>> Is there a "global" database with all PETScObject created?
>>
>
> No, we do not store that information. What would the use case be? Maybe
> there is another way to do it.
>
>   Thanks,
>
>     Matt
>
>
>> Thanks,
>>
>> Eric
>>
>> --
>> Eric Chamberland, ing., M. Ing
>> Professionnel de recherche
>> GIREF/Université Laval
>> (418) 656-2131 poste 41 22 42
>>
>>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>
> --
> Eric Chamberland, ing., M. Ing
> Professionnel de recherche
> GIREF/Université Laval
> (418) 656-2131 poste 41 22 42
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230113/5c0c6f67/attachment-0001.html>


More information about the petsc-users mailing list