ParameterHandler.declare_entry leads to a crash if entry="value"

96 views
Skip to first unread message

Denis Davydov

unread,
Mar 30, 2013, 12:15:53 PM3/30/13
to dea...@googlegroups.com
Hi everyone,

I just came across a very strange behavior of 

   prm.declare_entry("value", "1e-6",

                    dealii::Patterns::Double(),

                 "bla-bla-bla");


When I try to output parameters via


   prm.print_parameters (std::cout, dealii::ParameterHandler::Text);


the library crashes with:


    # Listing of Parameters

    # ---------------------

    terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::ptree_bad_path> >'

      what():  No such node (documentation)

    Abort trap: 6


That does not happen if the entry is something else but "value". 

I don't know if this is a problem with my installation or a bug somewhere in "print_parameters". 

I must admit i have not checked this behavior on a minimal (toy-like) example, but i assume it will be there.


Kind regards,

Denis.

Timo Heister

unread,
Mar 30, 2013, 9:16:29 PM3/30/13
to dea...@googlegroups.com
Hi Denis,

I can not reproduce that problem here. Can you try to make a small
example, please? Do you use something like
FunctionParser::declare_paramters() or something?
> --
> 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 dealii+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Timo Heister
http://www.math.tamu.edu/~heister/

Denis Davydov

unread,
Mar 31, 2013, 5:44:16 AM3/31/13
to dea...@googlegroups.com
Hi Timo,

I don't parse any functions yet, just constants. 
please find attached a striped down version of the code which crashes. 

Kind regards,
Denis.
CMakeLists.txt
parameters.cc

Matthias Maier

unread,
Mar 31, 2013, 2:57:28 PM3/31/13
to dea...@googlegroups.com
There is indeed a bug. I can reproduce with:


#include <deal.II/base/parameter_handler.h>

int main()
{
dealii::ParameterHandler foo;
foo.enter_subsection("bar");
foo.declare_entry("value", "1.0", dealii::Patterns::Double(), "");
foo.leave_subsection();
foo.read_input("foo.cfg");
}


Output:

ParameterHandler::read_input: could not open file <foo.cfg> for reading.
Trying to make file <foo.cfg> with default values for you.
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::ptree_bad_path> >'
what(): No such node (documentation)
zsh: abort ./test

Matthias Maier

unread,
Mar 31, 2013, 2:40:02 PM3/31/13
to dea...@googlegroups.com
Hi Denis,

Am 31. Mar 2013, 11:44 schrieb Denis Davydov <davy...@gmail.com>:

> Hi Timo,
>
> please find attached a striped down version of the code which crashes.
>

Can you reduce the example to 20-50 lines of code?
I'm unable to compile the current version.

Best,
Matthias

Matthias Maier

unread,
Mar 31, 2013, 4:40:43 PM3/31/13
to dea...@googlegroups.com
Fixed in r29123. Thanks for reporting!

Best,
Matthias

Wolfgang Bangerth

unread,
Mar 31, 2013, 4:50:04 PM3/31/13
to dea...@googlegroups.com, Matthias Maier
On 03/31/2013 03:40 PM, Matthias Maier wrote:
> Fixed in r29123. Thanks for reporting!

Thanks for taking a look at this. I think the patch is strictly correct but
I've actually fixed it in a different way nonetheless -- "value" is simply a
special name in the hierarchy (see the internal documentation of the
ParameterHandler class). I'm now mangling it.

Denis -- thanks for reporting the problem!

Best
Wolfgang

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@math.tamu.edu
www: http://www.math.tamu.edu/~bangerth/

Denis Davydov

unread,
Apr 1, 2013, 3:32:11 AM4/1/13
to dea...@googlegroups.com
Hi Matthias and Wolfgang,

I'm glad the source of the problem was found and everything is fixed.

Kind regards,
Denis.
Reply all
Reply to author
Forward
0 new messages