[Trilinos-Users] strange error setting parameter list

Hoang Giang Bui hgbk2008 at gmail.com
Tue Apr 9 11:13:26 MDT 2013


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
>>



More information about the Trilinos-Users mailing list