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.

Reply via email to