Skip to content

Flip fresh#4

Open
MohamedElkamash wants to merge 13 commits intoaprilnovak:nextfrom
MohamedElkamash:flip_fresh
Open

Flip fresh#4
MohamedElkamash wants to merge 13 commits intoaprilnovak:nextfrom
MohamedElkamash:flip_fresh

Conversation

@MohamedElkamash
Copy link

  • Added FlipSidesetGenerator Class
  • Added four tests
  • Added documentation

@aprilnovak
Copy link
Owner

In this PR, it looks like you are trying to merge into my devel branch - but on the other PR, you specified my next branch as the target. Can you edit this PR to use next as the target? If not, just make a new PR which picks aprilnovak:next as the target.

@MohamedElkamash MohamedElkamash changed the base branch from devel to next December 6, 2023 21:23
@MohamedElkamash
Copy link
Author

Done

@aprilnovak
Copy link
Owner

Looks good! I will review now

@aprilnovak
Copy link
Owner

@lindsayad sorry we do not need a review from you - Mohamed is my student and we are doing a practice PR here on my fork before doing a real PR in MOOSE.

@aprilnovak aprilnovak removed the request for review from lindsayad December 6, 2023 21:29
std::unique_ptr<MeshBase> & _input;

///Name of the sideset to flip
const BoundaryName _sideset_name;
Copy link
Owner

@aprilnovak aprilnovak Dec 6, 2023

Choose a reason for hiding this comment

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

This should be a const reference (const BoundaryName &)

Copy link
Author

Choose a reason for hiding this comment

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

Is there a specific reason for this?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, one reason is related to MOOSE's Controls system. That system allows an input file to essentially modify input file parameters on-the-fly -- so using a reference will make sure that everything in an input file is deeply connected to the input parameter.

It's also convention in MOOSE to use whenever possible, so when you cannot do const references there's some extra context that the software developer can have.


//To find the new_side_id:
//loop over new_elem sides until you find the neighbor which have the same id as the old elem
for (unsigned int i = 0; i < new_elem_n_sides; ++i)
Copy link
Owner

Choose a reason for hiding this comment

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

Did you ever try that "neighbor through face" idea? Which would get this information from the mesh topology instead of looping through and checking each face as a candidate?

Copy link
Author

Choose a reason for hiding this comment

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

Do you mean using a built in function that takes a neighbor and returns the side?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, I thought you had found a possible candidate - I'd prefer that if possible since it'd be a bit more readable code and would hopefully be faster (not a constraint from the test cases you have, but could be important for larger meshes).

Copy link
Author

Choose a reason for hiding this comment

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

The only function I found that seemed to do something similar was: which_side_am_i (const Elem * e) which we discussed before and found that is not doing what I thought, other than this I didn't find a suitable candidate function

Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, I am not sure - ok let's leave the code as-is for now, and we can ask on the MOOSE repo if they have any advice on where to look for something like that (if it exists).

Copy link
Author

Choose a reason for hiding this comment

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

Can you check which_neighbor_am_i()
I think this may be the one, I didn't understand its documentation the first time but may be it the correct one
https://mooseframework.inl.gov/docs/doxygen/libmesh/classlibMesh_1_1Elem.html#ac4fd20bbdc7f49f25ecc67d67f2a2295

Copy link
Owner

@aprilnovak aprilnovak Dec 6, 2023

Choose a reason for hiding this comment

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

I think that might be it (not 100% sure until we test it). It looks like these lines in which_neighbor_am_i look like they're doing the same looping-over-candidates you are doing (but it would be preferred if we can use the which_neighbor_am_i to reduce code duplication).

2326   for (unsigned int s=0, n_s = this->n_sides(); s != n_s; ++s)
 2327     if (this->[neighbor_ptr](s) == eparent)
 2328       return s;

Can you try it out?

input = 'no_sideset.i'
cli_args = '--mesh-only'
expect_err = "sideset doesn't exist in mesh"
requirement = 'The system shall error'
Copy link
Owner

Choose a reason for hiding this comment

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

This should be expanded to get more specific - generally, you want the requirement to be unique for every test in the tests file (otherwise, strictly speaking, a test would be redundant with another test if it was entirely duplicative in what it is checking)

Copy link
Owner

Choose a reason for hiding this comment

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

Same comment applies to the other three tests as well

@aprilnovak
Copy link
Owner

Done with my review - when you make changes, you can just add another commit locally, and then push it to the same branch (flip_fresh). It will automatically update the github PR page here.

@lindsayad
Copy link
Collaborator

Haha no worries

@MohamedElkamash
Copy link
Author

I committed the new changes and pushed them, do I need to submit another pull request?

@aprilnovak
Copy link
Owner

No, github knows to update this existing PR - if you look in the "Files changed" tab, you can verify that your recent changes from this morning are indeed there.

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.

4 participants