Dear Wolfgang, Thank you so much for the suggestion. Just to avoid confusion for future readers, the to_value() function needs a unique_ptr, and hence the aforementioned line needs to be replaced by the following lines:
std::unique_ptr<dealii::Patterns::PatternBase> nItersListPattern(new dealii::Patterns::List(dealii::Patterns::Integer(1), 2, 8, "|")); nIters = dealii::Patterns::Tools::Convert<decltype(nIters)>::to_value(nMaxItersString, nItersListPattern); Best regards, Paras On Fri, Apr 16, 2021 at 11:53 PM Wolfgang Bangerth <bange...@colostate.edu> wrote: > > Paras, > > > I am trying to read a list of integers from the parameter file using the > > dealii::Patterns::List class. > > However, I get a runtime error which can be reproduced using the > attached MWE. > > > > I also tried the approach described (for tensor) in > > https://groups.google.com/g/dealii/c/TvtcOnxeVjw/m/9uaSAh-kAwAJ but it > doesn't > > seem to work for the current case. > > > > It would be great help if someone could help me understand where I go > wrong? > > First: Excellent job coming up with a self-contained minimal example! > > The problem is that in this line: > > nIters = > > dealii::Patterns::Tools::Convert<decltype(nIters)>::to_value(nMaxItersString); > > The to_value() function creates its own pattern based on the type of the > argument nMaxItersString. This pattern uses "," as the separator, but you > want > "|". You can fix this by providing an explicit pattern: > > nIters = > dealii::Patterns::Tools::Convert<decltype(nIters)>::to_value(nMaxItersString,dealii::Patterns::List(dealii::Patterns::Integer(1), > > 2, 8, "|")); > > Best > W. > > -- > ------------------------------------------------------------------------ > Wolfgang Bangerth email: bange...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/98664411-dca8-ba63-dcf3-cbdd1d0489d4%40colostate.edu > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAEU6zmQ4pRED-92yambs3JV7Pc8xu0BRAvmnkjwoBOaJTL5YEQ%40mail.gmail.com.