Skip to content

Use node_ptr_range() when scaling - #4510

Merged
roystgnr merged 1 commit into
libMesh:develfrom
roystgnr:no_exceptions_c0poly_fix
Aug 1, 2026
Merged

Use node_ptr_range() when scaling#4510
roystgnr merged 1 commit into
libMesh:develfrom
roystgnr:no_exceptions_c0poly_fix

Conversation

@roystgnr

@roystgnr roystgnr commented Aug 1, 2026

Copy link
Copy Markdown
Member

I'm guessing the reason it's just a new C0Poly test that's triggering this is because that gave us some node numbering gaps, but I still have no idea why it's only segfaulting for us in a --disable-exceptions build, I'm just thankful that I was able to replicate that.

The worst thing Undefined Behavior can do is "what you expect, but not all the time".

This fixes a unit test segfault in my --disable-exceptions build that seems to match the one in CI; hopefully it'll be enough for our stopped-up devel->master CI too.

I'm guessing it's just a new C0Poly test that's triggering this because
that gave us some node numbering gaps, but I still have no idea why it's
only segfaulting for us in a --disable-exceptions build, I'm just
thankful that I was able to replicate that.

The worst thing Undefined Behavior can do is "what you expect, but not
all the time".

@loganharbour loganharbour left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use refs?

edit: I didn't actually look at the reason. oops. I'm still not sure why the original code didn't work...

Comment on lines +1780 to +1784
for (Node * node : mesh.node_ptr_range())
{
mesh.node_ref(p)(0) = (mesh.node_ref(p)(0))*(xmax-xmin) + xmin;
mesh.node_ref(p)(1) = (mesh.node_ref(p)(1))*(ymax-ymin) + ymin;
mesh.node_ref(p)(2) = (mesh.node_ref(p)(2))*(zmax-zmin) + zmin;
(*node)(0) = ((*node)(0))*(xmax-xmin) + xmin;
(*node)(1) = ((*node)(1))*(ymax-ymin) + ymin;
(*node)(2) = ((*node)(2))*(zmax-zmin) + zmin;

@loganharbour loganharbour Aug 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
for (Node * node : mesh.node_ptr_range())
{
mesh.node_ref(p)(0) = (mesh.node_ref(p)(0))*(xmax-xmin) + xmin;
mesh.node_ref(p)(1) = (mesh.node_ref(p)(1))*(ymax-ymin) + ymin;
mesh.node_ref(p)(2) = (mesh.node_ref(p)(2))*(zmax-zmin) + zmin;
(*node)(0) = ((*node)(0))*(xmax-xmin) + xmin;
(*node)(1) = ((*node)(1))*(ymax-ymin) + ymin;
(*node)(2) = ((*node)(2))*(zmax-zmin) + zmin;
for (auto & node : mesh.node_ref_range())
{
node(0) = node(0)*(xmax-xmin) + xmin;
node(1) = node(1)*(ymax-ymin) + ymin;
node(2) = node(2)*(zmax-zmin) + zmin;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is no MeshBase::node_ref_range(), that's an Elem API.

@moosebuild

Copy link
Copy Markdown

Job Coverage, step Generate coverage on 71b108c wanted to post the following:

Coverage

165cb7 #4510 71b108
Total Total +/- New
Rate 65.82% 65.82% +0.00% 100.00%
Hits 79325 79327 +2 4
Misses 41198 41197 -1 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

@roystgnr
roystgnr merged commit e2d805f into libMesh:devel Aug 1, 2026
23 checks passed
@roystgnr
roystgnr deleted the no_exceptions_c0poly_fix branch August 1, 2026 20:19
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.

5 participants