Closed agzimmerman closed 7 years ago
I'm seeking help on the deal.II mailing list: https://groups.google.com/forum/#!topic/dealii/kToGg5lNhFE
Per Luca's suggestion, I'm trying to accomplish this with a std::shared_ptr. See commit 91a755b1c32351f729b9ad811b56c5c72bfa48e2
Now resizing and declaring works, but parse_parameters seg faults:
$ gdb bug_10_fail.debug
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from bug_10_fail.debug...done.
(gdb) run
Starting program: /home/zimmerman/build/nsb-pcm/tests/bug_10_fail.debug/bug_10_fail.debug
warning: Error disabling address space randomization: Success
warning: linux_ptrace_test_ret_to_nx: PTRACE_KILL waitpid returned -1: Interrupted system call
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7f53c0850700 (LWP 9572)]
[New Thread 0x7f53c0040700 (LWP 9573)]
[New Thread 0x7f53bd830700 (LWP 9574)]
Program received signal SIGSEGV, Segmentation fault.
unconstruct_locals (this=0x148)
at /home/zimmerman/installed/deal.ii-candi/tmp/unpack/deal.II-v8.4.2/bundled/tbb41_20130401oss/include/tbb/enumerable_thread_specific.h:728
728 for(typename internal_collection_type::iterator cvi = my_locals.begin(); cvi != my_locals.end(); ++cvi) {
(gdb) up
#1 clear (this=0x148)
at /home/zimmerman/installed/deal.ii-candi/tmp/unpack/deal.II-v8.4.2/bundled/tbb41_20130401oss/include/tbb/enumerable_thread_specific.h:826
826 unconstruct_locals();
(gdb) up
#2 clear (this=0x148)
at /home/zimmerman/installed/deal.ii-candi/tmp/unpack/deal.II-v8.4.2/include/deal.II/base/thread_local_storage.h:269
269 data.clear ();
(gdb) up
#3 dealii::FunctionParser<2>::initialize (this=this@entry=0x88, variables="x,y,t",
Python Exception <class 'IndexError'> list index out of range:
expressions=std::vector of length 1, capacity 1 = {...}, constants=std::map with 2 elements,
time_dependent=time_dependent@entry=true)
at /home/zimmerman/installed/deal.ii-candi/tmp/unpack/deal.II-v8.4.2/source/base/function_parser.cc:68
68 this->fp.clear(); // this will reset all thread-local objects
(gdb) up
#4 0x00007f53dbd00c00 in dealii::FunctionParser<2>::initialize (this=this@entry=0x88, vars="x,y,t",
Python Exception <class 'IndexError'> list index out of range:
expression="0", constants=std::map with 2 elements, time_dependent=time_dependent@entry=true)
at /home/zimmerman/installed/deal.ii-candi/tmp/unpack/deal.II-v8.4.2/source/base/function_parser.cc:361
361 initialize(vars, Utilities::split_string_list(expression, ';'),
(gdb) up
#5 0x00007f53dbd459d2 in dealii::Functions::ParsedFunction<2>::parse_parameters (this=0x0, prm=...)
at /home/zimmerman/installed/deal.ii-candi/tmp/unpack/deal.II-v8.4.2/source/base/parsed_function.cc:139
139 function_object.initialize(vnames, expression, constants, true);
(gdb) up
#6 0x0000000000409f23 in main () at /mnt/c/Users/Alex/UbuntuShared/nsb-pcm/tests/bug_10_fail.cc:42
42 function_pointers[f]->parse_parameters(prm);
(gdb)
I verified that the test passes if I use a std::vector<dealii::Functions::ParsedFunction
Resize still doesn't work; but push_back is working as of commit 1ff39170818da6ea57182b15b8cc7cd1decbeddf . See https://github.com/alexanderzimmerman/nsb-pcm/blob/bugs/tests/issue_10_push_back.cc for details.
push_back suffices, so this issue is resolved.
And now resize works as of commit 577387099ce1bd104180679d9e8e0bb86a6d3773
Attempting to resize or push_back into a std::vector<Functions::ParsedFunction> throws an error within TBB and/or mu::Parser, e.g.:
Because of this issue, the number of boundaries on the domain must be known at compile time (i.e. they can't be set in the input parameter file), so that the proper number of ParsedFunction objects can be allocated.
Maybe ParsedFunction does not mean these requirements: http://stackoverflow.com/questions/12251368/type-requirements-for-stdvectortype
How are other deal.II users solving this problem?
I'm going to create a test for this bug/issue number now.