Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a signal before building patches for visualization output #5787

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

anne-glerum
Copy link
Contributor

Add a signal that can modify data_out during the creation of visualization output. It can be used to for example select only part of the domain to be outputted.

For all pull requests:

For new features/models or changes of existing features:

  • I have tested my new feature locally to ensure it is correct.
  • I have created a testcase for the new feature/benchmark in the tests/ directory.
  • I have added a changelog entry in the doc/modules/changes directory that will inform other users of my change.

@anne-glerum anne-glerum requested a review from tjhei June 5, 2024 05:11
template <int dim>
void pre_data_out_build_patches (DataOut<dim> &)
{
std::cout << "\npre_data_out_build_patches:\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this output is not triggered or am I wrong? Are you generating graphical output in every step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is triggered. The test output I committed is still from the test I copied from. But you can see that "npre_data_out_build_patches:" is printed by the tester. See attached figure. I'll update with the results from the tester.
Screenshot 2024-06-05 at 16 58 25

Comment on lines +292 to +299
/**
* A signal that is called before the build_patches() function is called during
* the creation of the visualization output. This signal
* allows for registering functions that take a DataOut object and can for example
* be used to select only certain cells of the mesh to be built into patches through
* calling the DataOut member function set_cell_selection().
*/
boost::signals2::signal<void (DataOut<dim> &)> pre_data_out_build_patches;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one way. I assume you want to use this to let the called function attach itself to the DataOut? Why not have a signal that returns a function object selecting individual cells that can then directly be attached to DoFHandler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As just discussed, we tried to keep the signal as general as possible as other things could be done with DataOut.

Copy link
Contributor

@bangerth bangerth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot: Would you mind reducing the number of commits?

@tjhei tjhei requested a review from bangerth June 5, 2024 20:12
@tjhei tjhei merged commit 2a6921e into geodynamics:main Jun 5, 2024
8 checks passed
@anne-glerum anne-glerum deleted the data_out_signal branch June 5, 2024 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants