[Trilinos-Users] [EXTERNAL] error reading xml ParameterList

Hoang Giang Bui hgbk2008 at gmail.com
Thu Mar 7 12:23:47 MST 2013


Hello

I think the correct line should be like this:

Teuchos::ValidatorXMLConverterDB::addConverter(
         Teuchos::DummyObjectGetter<
Teuchos::StringToIntegralParameterEntryValidator<Thyra::EBelosSolverType>
             >::getDummyObject()
         ,
         Teuchos::rcp(
             new 
Teuchos::StringToIntegralValidatorXMLConverter<Thyra::EBelosSolverType>()
         )
     );

However, still the same error is thrown. Please check out the attach code.

BR
Bui

P/S: I like Eric's stratimikos.xml. The reader works nicely with this. 8-)


On 03/07/13 17:18, Kurtis Nusbaum wrote:
> This actually has to do with some code I wrote awhile back that helps 
> serialize validators along with the parameter list when writing the 
> parameterlist out to XML. By default Teuchos knows how to write out 
> most of the validators to XML but for some (especially templated ones) 
> it just doesn't know how to write them out. So you need to say to 
> Teuchos: "Hey, I've got this validator that I want you to write out to 
> XML whenever you serialize a parameterlist. Here's how to do it." 
> Fortunately there's an easy way to do this for 
> StringIntegralValidators. Just add the following code at the beggining 
> of your program.
>
> Teuchos::ValidatorXMLConverterDB::addConverter(DummyObjectGetter< StringIntegralValidator<Thyra::EBelosSolverType> 
> >::getDummyObject(), rcp(new 
> StringToIntegralValidatorXMLConverter<Thyra::EBelosSolverType>))
>
>
> You'll wanna include the headers:
> Teuchos_ValidatorXMLConverterDB.hpp
> Teuchos_StandardValidatorXMLConverters.hpp
> Teuchos_DummyObjectGetter.hpp
>
>
> It might be good for us to even add a simple macro or function for 
> adding new StringToIntegralValidator converters to the 
> ValidatorXMLConverterDB since that's probably a common case.
>
>
>
>
> On Thu, Mar 7, 2013 at 9:44 AM, Cyr, Eric C <eccyr at sandia.gov 
> <mailto:eccyr at sandia.gov>> wrote:
>
>     Bui
>
>     This is an ugly file. Does someone know why the parameter list writer
>     spits out all of this extra stuff?
>
>     I've attached a version of the file to look at and use. Hopefully the
>     parameter list reader does a better job with it. I've removed all the
>     validator stuff, the RCP stuff and the docString stuff.
>
>     Eric
>
>     On 3/7/13 2:16 AM, "Hoang Giang Bui" <hgbk2008 at gmail.com
>     <mailto:hgbk2008 at gmail.com>> wrote:
>
>     >Hi
>     >
>     >Please help to look in an error when reading the ParameterList
>     from xml
>     >file. In the test file "test-write_parameterlist.cpp", the xml
>     file is
>     >generated by exporting a ParameterList obtain from Teko. The
>     >"test-read_parameterlist.cpp" try to read it back, however the
>     error is
>     >generated:
>     >
>     >hbui at hbui-Aspire-5553G:~/workspace/trilinos1/cmake_build$
>     >./test-read_parameterlist
>     >terminate called after throwing an instance of
>     >'Teuchos::CantFindValidatorConverterException'
>     >   what():
>     >/home/hbui/sw/trilinos-public1/packages/teuchos/parameterlist/src/Teuchos_
>     >ValidatorXMLConverterDB.cpp:87:
>     >
>     >Throw number = 1
>     >
>     >Throw test that evaluated to true: it == getConverterMap().end()
>     >
>     >Could not find a ValidatorXMLConverter for type
>     >StringIntegralValidator(Thyra::EBelosSolverType)
>     >Try adding an appropriate converter to the ValidatorXMLConverterDB in
>     >order solve this problem.
>     >
>     >
>     >Aborted (core dumped)
>     >
>     >
>     >I think the error is caused by a validatorId field assert to
>     >ParameterList entries. Remove the validatorId, it can read normally.
>     >However, I think a clean solution is better.
>     >
>     >BR
>     >Bui
>     >
>     >_______________________________________________
>     >Trilinos-Users mailing list
>     >Trilinos-Users at software.sandia.gov
>     <mailto:Trilinos-Users at software.sandia.gov>
>     >http://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
>     _______________________________________________
>     Trilinos-Users mailing list
>     Trilinos-Users at software.sandia.gov
>     <mailto:Trilinos-Users at software.sandia.gov>
>     http://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
>
>
> -- 
> Peace, Love, and Source Code
> -Kurtis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130307/26e83416/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test-read_parameterlist.cpp
Url: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130307/26e83416/attachment.pl 


More information about the Trilinos-Users mailing list