Need help with the step-9 tutorial program

71 views
Skip to first unread message

Gerald Marewo

unread,
Jul 16, 2025, 7:39:23 AM7/16/25
to deal.II User Group
Dear all,

I have been going through a number of dealii tutorial programs and currently I am working on step-9 (the linear advection problem, assembling A U = F using multi-threading, ...).

I have a basic idea of the WorkStream concept for multi-threading.

However, I am struggling to make sense of the 4th argument to the function WorkStream::run, i.e,

std::function<void(const EstimateCopyData &)>()

My understanding is that this is a function from the standard C++ library with a template parameter and no input arguments. How is the template parameter interpreted here?

I am not much of a C++ programer.

I look forward to hearing from you soon.

Thanks in advance.

Regards,

Gerald.

Wolfgang Bangerth

unread,
Jul 16, 2025, 7:51:53 PM7/16/25
to dea...@googlegroups.com
On 7/16/25 05:04, Gerald Marewo wrote:
>
> I have a basic idea of the WorkStream concept for multi-threading.
>
> However, I am struggling to make sense of the 4th argument to the function
> WorkStream::run, i.e,
>
> std::function<void(const EstimateCopyData &)>()
>
> My understanding is that this is a function from the standard C++ library with
> a template parameter and no input arguments. How is the template parameter
> interpreted here?

Gerald:
the syntax C++ uses is admittedly not helpful, but that argument represents a
function that takes an object of type EstimateCopyData as input and does
something with it. WorkStream in essence takes two functions as argument:
* A function that does the work and puts the results into an intermediate
object
* A function that takes the information from the intermediate object and puts
it into the final place.
The function you mention is the one that does the second operation.

If you want more information: The documentation of the WorkStream class links
to a paper that discusses the design of this class.

Best
W.

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


gtma...@gmail.com

unread,
Jul 17, 2025, 6:14:20 AM7/17/25
to dea...@googlegroups.com
Dear W,

Thank you for the quick reply.

The WorkStream::run story makes more sense to me now.

Just out of curiosity, why is the EstimateCopyData object taken as a parameter instead of an input argument? Is there a possibility of passing it as an object of different class?

Bye for now.

Gerald. 

Wolfgang Bangerth

unread,
Jul 17, 2025, 4:12:22 PM7/17/25
to dea...@googlegroups.com
On 7/17/25 01:10, gtma...@gmail.com wrote:
>
> Just out of curiosity, why is the EstimateCopyData object taken as a parameter
> instead of an input argument? Is there a possibility of passing it as an
> object of different class?

parameter=argument. The function in question takes an object of type
EstimateCopyData as argument.

Best
W.

Gerald Marewo

unread,
Jul 21, 2025, 10:20:24 AM7/21/25
to deal.II User Group
Dear W,

I apologise for the late reply.

Thanks for the advice.

I finally got a gist of step-9.

Upon reading the documentation of step-9 I noticed that the results section has missing results just after the console output. I can generate them on my own for my own records but I thought I should let you know.

Brilliant work. I learn a lot with evern tutorial program.

Regards,

Gerald.

Wolfgang Bangerth

unread,
Jul 22, 2025, 8:42:13 AM7/22/25
to dea...@googlegroups.com
On 7/21/25 07:58, Gerald Marewo wrote:
>
> Upon reading the documentation of step-9 I noticed that the results section
> has missing results just after the console output. I can generate them on my
> own for my own records but I thought I should let you know.

I imagine you were referring to the pictures not loading. Half a dozen of the
maintainers figured it out last night, and it should work again now!

Best
W.

gtma...@gmail.com

unread,
Jul 22, 2025, 10:43:10 AM7/22/25
to dea...@googlegroups.com
Yes. I meant that.

Pictures are loading now.

Thanks.

Regards,

Gerald.
Reply all
Reply to author
Forward
0 new messages