Matrix-free : Get the wrong user_data when assemble_rhs during loop all cell_iterator

26 views
Skip to first unread message

Tom Li

unread,
Apr 11, 2023, 4:40:40 AM4/11/23
to deal.II User Group
Dear all:
        I write a function in my programm named "get_element_cache", this function is mainly for setting the user_data of every active_cell, it looks like the file "get_element_cache.cc".And when I want to assemble_rhs, I need some information in the UserData,But I got the wrong information..The file assemble_rhs.cc includes my code.For example, one of the parameter of the UserData is seed_index1, It can only be -1, 0,1,2 and I try to print the number I got 1626017872.That is obviously wrong.So I am confused where something went wrong.Thanks a lot!
Tom
_)@][{QCG6LEO90JJ]E)ZCD.jpg
get_element_cache.cc
assemble_rhs.cc

Wolfgang Bangerth

unread,
Apr 11, 2023, 1:05:09 PM4/11/23
to dea...@googlegroups.com
On 4/11/23 02:40, Tom Li wrote:
>         I write a function in my programm named "get_element_cache",
> this function is mainly for setting the user_data of every active_cell,
> it looks like the file "get_element_cache.cc".And when I want to
> assemble_rhs, I need some information in the UserData,But I got the
> wrong information..The file assemble_rhs.cc includes my code.For
> example, one of the parameter of the UserData is seed_index1, It can
> only be -1, 0,1,2 and I try to print the number I got 1626017872.That is
> obviously wrong.So I am confused where something went wrong.

Tom: We don't have the resources to debug these problems for everyone on
the mailing list (or indeed for *anyone* on the mailing list). But in
your case, at least you know *what* goes wrong (namely, you get a wrong
number, and later you get a segmentation fault). These are both problems
that are relatively easy to figure out if you run your program in a
debugger. I would first try to understand where and why you get the
segmentation fault because the debugger will stop at the location where
you are accessing invalid memory.

Separately, it looks like you are running the program with multiple MPI
processes. Does the problem also happen when you run with only one
process? That may be a case that's easier to debug.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
Reply all
Reply to author
Forward
0 new messages