[petsc-users] Parsing user-defined variables using YAML

Barry Smith bsmith at petsc.dev
Mon Dec 21 16:12:06 CST 2020


  You can make up your own options and provide them in YAML format then query for them in your PETSc code using the routines Blaise pointed out.  There is no restriction that the arguments need to be only pre-defined PETSc options. 

  Barry

  As documented the YAML format supported is very simple.


> On Dec 20, 2020, at 10:56 AM, Blaise A Bourdin <bourdin at lsu.edu> wrote:
> 
> Have a look at the options related functions in the system section of the man pages: https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/index.html
> You can get options from the petsc option database and pass them to your user code.
> You can also use petscBag to pass a C struct or a fortran derived type to your user code.
> 
> Regards,
> Blaise
> 
>> On Dec 20, 2020, at 10:03 AM, sthavishtha bhopalam <sthavishthabr at gmail.com> wrote:
>> 
>> Hello PETSc users!
>> 
>> I wanted to know how one could parse user-defined variables (not the inbuilt PETSc options) in a PETSc code using YAML? Any suggestions? To my knowledge, the existing YAML parser in PETSc solely reads the PETSc options like snes, ksp, pc etc. as described here (https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2020-August/042074.html) but is incapable to read user-defined variables, which may be specific to a code. 
>> 
>> Thanks
>> -------------------------------------------
>> Regards
>> 
>> Sthavishtha
>> 
>> 
>> 
>> 
> 
> -- 
> A.K. & Shirley Barton Professor of  Mathematics
> Adjunct Professor of Mechanical Engineering
> Adjunct of the Center for Computation & Technology
> Louisiana State University, Lockett Hall Room 344, Baton Rouge, LA 70803, USA
> Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 Web http://www.math.lsu.edu/~bourdin
> 



More information about the petsc-users mailing list