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

Resized the rotation matrix vector in the weighted outputs for the CPO postprocessor #5332

Merged
merged 1 commit into from Aug 11, 2023

Conversation

srivatsvyas
Copy link
Contributor

Pull Request Checklist. Please read and check each box with an X. Delete any part not applicable. Ask on the forum if you need help with any step.

Resized the rotation matrix vector while generating weighted outputs in Crystal preferred orientation postprocessor. Before the fix if the option of generating a weighted CPO was chosen in the input file, a segmentation fault was thrown. This PR looks to fix that

For all pull requests:

For new features/models or changes of existing features:

  • [ X] I have tested my new feature locally to ensure it is correct.

@gassmoeller
Copy link
Member

/rebuild

Comment on lines +392 to +399
weighted_rotation_matrices.resize(n_minerals);
std::vector<std::vector<double>> volume_fractions_grains(n_minerals,std::vector<double>(n_grains,-1.));
for (unsigned int mineral = 0; mineral < n_minerals; ++mineral)
{
for (unsigned int i_grain = 0; i_grain < n_grains; ++i_grain)
{
weighted_euler_angles[mineral].resize(n_grains);
weighted_rotation_matrices[mineral].resize(n_grains);
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why was this necessary? Did you get error messages/segmentation faults without resizing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.. Had a similar issue on the add_drexpp_V3 branch and this helped so just used it here and it works.

Copy link
Contributor

Choose a reason for hiding this comment

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

This points to a bigger problem. If the code previously had a bug whereby you'd get error messages without the resize() calls, then there are not enough tests that test this code. Would you be able to write an input file that triggers the error before, and that is fixed with the addition of the code here?

Copy link
Member

@gassmoeller gassmoeller left a comment

Choose a reason for hiding this comment

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

Let's not delay this bugfix by waiting for an unrelated test. @MFraters can you later look into the testing situation for the CPO code?

Otherwise this looks good to go.

@gassmoeller gassmoeller merged commit 38ef6dc into geodynamics:main Aug 11, 2023
7 checks passed
@MFraters
Copy link
Member

Sorry, I had missed this pull request. I think we (@srivatsvyas and me) had talked about this on the last day of the hackathon when he found the issue. Great that it is merged!

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.

None yet

4 participants