Skip to content

Refactor Rotated Projection Logic#453

Open
mabruzzo wants to merge 11 commits intocholla-hydro:devfrom
mabruzzo:RotatedProjection
Open

Refactor Rotated Projection Logic#453
mabruzzo wants to merge 11 commits intocholla-hydro:devfrom
mabruzzo:RotatedProjection

Conversation

@mabruzzo
Copy link
Collaborator

@mabruzzo mabruzzo commented Sep 18, 2025

This PR should be reviewed after #433 has been merged.

Overview

This PR essentially makes 3 changes:

  1. It introduces the RotatedProjWriter class. This is a callable (e.g. it acts like a function with state) that is tracked within WriterManager.
  2. It does some light refactoring so that an instance of the Rotation struct is no longer tracked by the Grid3D class. Now RotatedProjWriter tracks an instance.
  3. It refactors so that Rotation instances are no longer initialized from values in a Parameters struct. Now, values are directly parsed in the constructor of Rotation

Review Advice

It may be easier to review this commit-by-commit.

  • The first four commits simply move around logic
  • The fifth commit starts using the new parameter parsing approach
  • The sixth commit moves the contents of Ouptut_Rotated_Projection_Data into the callable method of the RotatedProjWriter class. (This may be a little controversial since I am moving contents between files).
  • The last commit does a little cleanup

mabruzzo and others added 9 commits September 18, 2025 13:37
This first commit simply tries to lay the foundations for this new
class. At the moment, the class does not accomplish anything of
substance.
We choose to define this constructor in the RotatedProjWriter.cpp file
because we'll be moving the declaration of the `Rotation` struct into
the associated header in an upcoming commit
We now track the `Rotation` struct as a member of `RotatedProjWriter`, &
explicitly pass it to the functions where it is used.
In more detail:
- I deleted the default constructor (to prevent invalid states)
- the main constructor now takes `ParameterMap&` as an argument (in preparation for the next commit)
- I added a docstring for the class
- I adjusted the docstrings of the members (they were unnecessarily verbose for Doxygen)
This takes advantage of the fact that I previously defined the procID
variable when we aren't using MPI. It also leverages some the
function-like error-checking macros
// create the filename
std::string filename = fname_template.format_fname(nfile, "_rot_proj");

// it may be a little more explicit to use a switch statement instead of if/elif/else
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that a switch statement would be clearer if you wanted to change it (but I don't think it's necessary for this PR if you don't feel like it).

// should we make it an error to specify the:
// - ddelta_dt parameter when flag_delta != 1
// - n_delta parameter when flag_delta != 2

Copy link
Collaborator

Choose a reason for hiding this comment

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

I do think it's a good idea to check that the values of these parameters are valid, at least for the basic things of being positive/nonzero (either in this PR or a future one).

Also, I think it's okay for the n_delta/ddelta_dt parameters to go unused if they're defined with the wrong flag_delta value. But if you're concerned about it being confused, I think printing a warning could also be a good option.

@helenarichie helenarichie self-assigned this Dec 17, 2025
Copy link
Collaborator

@helenarichie helenarichie left a comment

Choose a reason for hiding this comment

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

I think this looks great and is good to go as-is!
I shared my thoughts on a couple of the questions you left in the comments. If you want to make any of those changes in this PR, go ahead, and I'll review them, but if not, feel free to just resolve my comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants