ParameterHandler question

30 views
Skip to first unread message

Simon Gauvin

unread,
Jan 26, 2020, 2:01:51 PM1/26/20
to deal.II User Group
Greetings!

I currently work on the Lethe project, (https://github.com/lethe-cfd/lethe), and we currently are facing a problem with ParameterHandler.
We need a way to have a list of variable size in a .prm file (eg; set array = [{set var = bool, set var2 = string, etc}, {...}, ...])
From reading the official doc, I don't think we can do something like this.
Or else just having a way to know if a subsection already exists would work, (which we can't do I seem to understand), so we can simply have a variable number of subsections, and know the number of subsections.
Is there any workaround?
I was thinking maybe just using JSONs instead of a prm would work.

Thanks for your help! :)

Simon

David Wells

unread,
Jan 27, 2020, 11:02:06 AM1/27/20
to deal.II User Group
Hi Simon,

It sounds like you want to use Patterns::Map or Patterns::List. As far
as I know both can accept an arbitrary number of input arguments.
Would either of those work for you?

Thanks,
David
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/daa92981-663d-4563-bcbd-de88199ab9c1%40googlegroups.com.

Wolfgang Bangerth

unread,
Jan 28, 2020, 8:45:10 AM1/28/20
to dea...@googlegroups.com
On 1/27/20 9:01 AM, David Wells wrote:
> It sounds like you want to use Patterns::Map or Patterns::List.

They can also be nested, which I think is essentially what you want. Though if
all of the entries of the list have the form
{set var = bool, set var2 = string, etc}
then you might as well omit the 'set var =' part and have each entry of the
list be a tuple:
set array = val1, val2; val3, val4
Here, the ';' separates the outer list, the ',' the elements of each list entry.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages