Hi Luca, 

Thank you for the quick response.

One (may be off-topic) short follow-up. How can I turn on the 
DEAL_II_WITH_MAGIC_ENUM option on using spack. I could not find any 
relevant option in the 
spack/dealii-9.4.0/var/spack/repos/builtin/packages/dealii/package.py file.

Best regards,
Paras

On Thursday, May 8, 2025 at 5:53:37 PM UTC+2 [email protected] wrote:

> This is supported by default on deal.II master if you compile with magic 
> enum support. 
>
> It will allow you to parse directly the enum. 
>
> You can simply copy and paste the relevant code in patterns.h to your 
> header if you have an older deal.II. 
>
> Luca
>
> Il giorno 8 mag 2025, alle ore 17:40, Paras Kumar <[email protected]> 
> ha scritto:
>
> 
>
> Dear All,
>
> Here is a kind of follow-up to the above question.
>
> I now to try to read a list of strings and each of the values in the list 
> must to be converted to an enum class type.
>
> But I get the following compile time error when I try to compile below 
> code snippet
>
> "
> : error: use of deleted function ‘static T 
> dealii::Patterns::Tools::Convert<T, Enable>::to_value(const std::string&, 
> const dealii::Patterns::PatternBase&) [with T = NonlinearSolverType; Enable 
> = void; std::string = std::__cxx11::basic_string<char>]’
>  1829 |                    Convert<typename T::value_type>::to_value(str, 
> *base_p));
> "
>
> I also tried playing around with the second template option "A" of the 
> dealii::Patterns::Tools::Convert<T,A>() function but it did not help. I am 
> not sure if this function is not yet instantiated to work for T = 
> decltype(nonlinearSolverTypes_)? or am I make syntactical mistake in 
> calling the function?
>
>  enum class NonlinearSolverType
>  {
>       NEWTON_STANDARD,      
>       NEWTON_MODIFIED
>   };
> using NonlinearSolverListType = std::vector<NonlinearSolverType>;
> dealii::Patterns::List nonlinearSolverListPattern(
>   dealii::Patterns::MultipleSelection(
>     "NEWTON_STANDARD|NEWTON_MODIFIED"),
>   nMinListElems,
>   nMaxListElems,
>   "|");
> const std::string nonlinearSolverTypesString =  
> parameterHandler.get("Nonlinear solver types");
> blockNonlinearSolverParameters_.nonlinearSolverTypes_ =  
> dealii::Patterns::Tools::Convert<NonlinearSolverListType, typename 
> std::enable_if<dealii::Patterns::Tools::is_list_compatible<NonlinearSolverListType>::value>::type>::to_value(nonlinearSolverTypesString,
>  
> std::move(nonlinearSolverListPattern));
>
> Some suggestions on resolving this issue will be really helpful.
>
> Best regards,
> Paras Kumar
>
> On Monday, April 19, 2021 at 5:38:31 PM UTC+2 Wolfgang Bangerth wrote:
>
>> On 4/19/21 4:19 AM, Paras Kumar wrote: 
>> > 
>> > 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); 
>>
>> I suspect you need to write this last line as 
>> dealii::Patterns::Tools::Convert<decltype(nIters)>::to_value(nMaxItersString,
>>  
>>
>> std::move(nItersListPattern)); 
>>
>> but the idea seems right. I was using the latest development sources in 
>> which 
>> the argument has been changed from a unique-ptr to just a regular object. 
>>
>> Best 
>> W. 
>>
>> -- 
>> ------------------------------------------------------------------------ 
>> Wolfgang Bangerth email: [email protected] 
>> 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 [email protected].
>
> To view this discussion visit 
> https://groups.google.com/d/msgid/dealii/e4fa0bab-8540-4eee-84ec-7aa0f4295cedn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/dealii/e4fa0bab-8540-4eee-84ec-7aa0f4295cedn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/dealii/1fd93eda-8535-4709-bc8d-fafcf97ef1b5n%40googlegroups.com.

Reply via email to