[Trilinos-Users] strange error setting parameter list

Radu Popescu i.radu.popescu at gmail.com
Tue Apr 9 13:08:59 MDT 2013


Sorry,

I meant:

p.set("name", std::string("BP"));

Radu


On Tue, Apr 9, 2013 at 9:08 PM, Radu Popescu <i.radu.popescu at gmail.com>wrote:

> Hi there,
>
> Try with:
>
> p.set(std::string("name"), "BP");
>
> I think if you don't construct a std::string explicitly, it will be
> created as a char*
>
> Regards,
> Radu Popescu
>
>
> On Tue, Apr 9, 2013 at 7:13 PM, Hoang Giang Bui <hgbk2008 at gmail.com>wrote:
>
>> Hi
>>
>> I got problem with Teuchos::ParameterList again
>>
>> At some place in my code I created a ParameterList
>>
>> Teuchos::ParameterList p;
>>
>> p.set("name", "BP");
>>
>> Try to read it back at another place
>>
>> std::string tmp = p.get<std::string>("name");
>>
>> An error happens
>> RuntimeError: Error!  An attempt was made to access parameter "name" of
>> type "string"
>> in the parameter (sub)list "ANONYMOUS"
>> using the incorrect type "string"!
>>
>> Any idea how to get around this error?
>>
>> BR
>>
>>
>>
>> On 03/18/13 15:36, Heroux, Mike wrote:
>> > None of the second arguments should have quotes around them.  You should
>> > use:
>> >
>> > solver_parameters.set("AZ_solver",AZ_bicgstab)
>> > solver_parameters.set("AZ_kspace",100)
>> > solver_parameters.set("AZ_output",32)
>> > solver_parameters.set("AZ_precond",AZ_none)
>> >
>> > Does this work?
>> >
>> >
>> > On 3/15/13 7:09 AM, "Hoang Giang Bui" <hgbk2008 at gmail.com> wrote:
>> >
>> >> Hi
>> >>
>> >> I recently encounter a strange error using Teuchos::ParameterList:
>> >>
>> >> setting the parameters and pass to aztec_solver:
>> >>
>> >> =====================
>> >> solver_parameters.set("AZ_solver","AZ_bicgstab")
>> >> solver_parameters.set("AZ_kspace",100)
>> >> solver_parameters.set("AZ_output",32)
>> >> solver_parameters.set("AZ_precond","AZ_none")
>> >>
>> >> aztec_solver.SetParameters(solver_parameters);
>> >>
>> >> =====================
>> >>
>> >> throws an error:
>> >>
>> >> =====================
>> >> RuntimeError:
>> >>
>> /home/bui/sw/trilinos-public/packages/teuchos/core/src/Teuchos_any.hpp:287
>> >> :
>> >>
>> >> Throw number = 1
>> >>
>> >> Throw test that evaluated to true: !dyn_cast_content
>> >>
>> >> any_cast<int>(operand): Error, cast to type any::holder<int> failed but
>> >> should not have and the actual underlying type is
>> >> 'Teuchos::any::holder<int>!  The problem might be related to
>> >> incompatible RTTI systems in static and shared libraries!
>> >>
>> >> =====================
>> >>
>> >> When I changed to this
>> >>
>> >> solver_parameters.set("AZ_solver","AZ_bicgstab")
>> >> solver_parameters.set("AZ_kspace","100")
>> >> solver_parameters.set("AZ_output","32")
>> >> solver_parameters.set("AZ_precond","AZ_none")
>> >>
>> >> The error is gone. But I don't know if the parameter list can detect
>> the
>> >> integer value as string value ?
>> >>
>> >> BR
>> >> Bui
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> Trilinos-Users mailing list
>> >> Trilinos-Users at software.sandia.gov
>> >> http://software.sandia.gov/mailman/listinfo/trilinos-users
>> >>
>>
>> _______________________________________________
>> Trilinos-Users mailing list
>> Trilinos-Users at software.sandia.gov
>> http://software.sandia.gov/mailman/listinfo/trilinos-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130409/33aec723/attachment.html 


More information about the Trilinos-Users mailing list