I use the deal.II pretty-printers and it works well for template types. But I found it can’t print some kinds of vectors in deall.II,
for example, TrilinosWrappers::MPI::BlockVector stokes_solution
in step-31. I think the reason is that regular expression in deal.py
is only used for template types.
In order to print readable format of this type, I try to create a python file just like the deal.py
file.
I don’t known how to print the value of vectors for that type. But for test, I try to print the n_blocks
(number of blocks).
So I change the regular expression and modify a class named BlockVectorPrinter
.
Then I put test.py
in ~/.gdbscripts, and add import test
in .gdbinit
. And I use info pretty-printer
to check it.
However, when I debug the step-31 program, gdb doesn’t print the variable stokes_solution
with pretty-printing. At the same time, the deal.II pretty-printer still works well. It confused me.
There are my questions:
dictionary
syntax, and how can we know the dictionary
of a particular deal.II class?The commands and results are as follows.
gdb ./build/step-31
b 1749
r
Then print the variables.
(gdb) print local_rhs
$1 = double[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}
(gdb) print local_dof_indices
$2 = std::vector of length 9, capacity 9 = {0, 0, 0, 0, 0, 0, 0, 0, 0}
(gdb) print stokes_solution
$3 = {
<dealii::BlockVectorBase<dealii::TrilinosWrappers::MPI::Vector>> = {
<dealii::Subscriptor> = {
_vptr.Subscriptor = 0x7ffff7cf5e58 <vtable for dealii::TrilinosWrappers::MPI::BlockVector+16>,
counter = 0,
counter_map = std::map with 0 elements,
object_info = 0x0
},
members of dealii::BlockVectorBase<dealii::TrilinosWrappers::MPI::Vector>:
static supports_distributed_data = <optimized out>,
components = std::vector of length 2, capacity 2 = {{
<dealii::TrilinosWrappers::VectorBase> = {
<dealii::Subscriptor> = {
_vptr.Subscriptor = 0x7ffff7cf8d18 <vtable for dealii::TrilinosWrappers::MPI::Vector+16>,
counter = 0,
counter_map = std::map with 0 elements,
object_info = 0x0
},
members of dealii::TrilinosWrappers::VectorBase:
last_action = Zero,
compressed = true,
---Type <return> to continue, or q <return> to quit---q
Quit
Any help or advise would be appreciated. Thank you!
Best,
Qing