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

Remove using namespace libMesh #28842

Open
wants to merge 8 commits into
base: next
Choose a base branch
from

Conversation

GiudGiud
Copy link
Contributor

@GiudGiud GiudGiud commented Oct 14, 2024

closes #28499

patches:

I used the techniques below to make this a little painful. Some of these are not "best practices" so I can avoid these shortcuts, but at the cost of a lot more work most likely.

For source files:

  • added libMesh:: in a lot of source files initially. This was taking forever so I...
  • added using namespace libMesh at the top of source files. This is probably the cleaner way to do this. Unfortunately this quick and easy solution should not be done in headers. And because of unity build I probably have to do this again a few times to get every single source file that actually needs it

For headers:

  • I did add libMesh:: in a lot of headers as well. This was also taking forever, it would be needed in thousands of places
  • so I started adding using libMesh::Real/ .../ in common headers. Namely MooseTypes.h, MooseMesh.h, AuxiliarySystem.h .... This is not a recommended practice but I don't really see us having libMesh::Real (or using libMesh::Real;) in every header?? But maybe we should. Since too many files were needed, I ended up centralizing in libMeshReduceNamespace.h
  • for the nested namespaces, I added something like namespace Threads = libMesh::Threads which effectively nullifies the effect of removing using namespace libMesh. So we keep the same degree of contamination with regards to these nested namespaces of libMesh (e.g. you can't use a Threads namespace with overlapping symbols from another library)
  • then to pass CI of the other apps I basically had to add a couple other using libMesh:: at the end of the libMeshReducedNamespace.h. The alternative is to patch every single app, which is not very reasonable at this point. Unfortunately most apps do not have a XYZnameoftheapp.h header they include everywhere.

In any case, even if we don't like any of these practices, we can fix these gradually, unlike the removal of using namespace libMesh which can only be brutal

I think I can improve what I did in libMeshReducedNamespace.h by using forward declarations. I ll try that
EDIT: done

@grmnptr

@GiudGiud GiudGiud self-assigned this Oct 14, 2024
@GiudGiud
Copy link
Contributor Author

@dschwen @lindsayad

@idaholab idaholab deleted a comment from moosebuild Oct 14, 2024
@GiudGiud GiudGiud force-pushed the PR_delibmeshisize branch 8 times, most recently from a4a4951 to 2a2f71f Compare October 15, 2024 13:44
@idaholab idaholab deleted a comment from moosebuild Oct 15, 2024
@GiudGiud GiudGiud force-pushed the PR_delibmeshisize branch 6 times, most recently from 18448c7 to 5c63179 Compare October 15, 2024 16:04
@idaholab idaholab deleted a comment from moosebuild Oct 15, 2024
@GiudGiud GiudGiud force-pushed the PR_delibmeshisize branch 6 times, most recently from b2c1d40 to cc51284 Compare October 15, 2024 20:44
@idaholab idaholab deleted a comment from moosebuild Oct 15, 2024
@GiudGiud GiudGiud marked this pull request as ready for review October 15, 2024 22:09
#include "libmesh/perf_log.h"
#include "libmesh/libmesh_common.h"
#include "XTermConstants.h"
#include "libmesh/utility.h" // to declare namespace
Copy link
Contributor Author

Choose a reason for hiding this comment

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

self-note to remove this

Copy link
Contributor

Choose a reason for hiding this comment

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

You want it just for the namespace declaration? You can just put namespace libMesh {} in MOOSE code to get that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup! I ended up figuring this out later on

@moosebuild
Copy link
Contributor

moosebuild commented Oct 15, 2024

Job Documentation, step Docs: sync website on 340196c wanted to post the following:

View the site here

This comment will be updated on new commits.

@moosebuild
Copy link
Contributor

moosebuild commented Oct 15, 2024

Job Coverage, step Generate coverage on 340196c wanted to post the following:

Framework coverage

b3924e #28842 340196
Total Total +/- New
Rate 85.05% 85.04% -0.00% 70.10%
Hits 106298 106311 +13 340
Misses 18691 18696 +5 145

Diff coverage report

Full coverage report

Modules coverage

Heat transfer

b3924e #28842 340196
Total Total +/- New
Rate 88.71% 88.71% +0.00% 100.00%
Hits 4351 4352 +1 5
Misses 554 554 - 0

Diff coverage report

Full coverage report

Level set

b3924e #28842 340196
Total Total +/- New
Rate 85.45% 85.49% +0.04% 100.00%
Hits 323 324 +1 2
Misses 55 55 - 0

Diff coverage report

Full coverage report

Navier stokes

b3924e #28842 340196
Total Total +/- New
Rate 84.48% 84.48% - 100.00%
Hits 17002 17002 - 2
Misses 3123 3123 - 0

Diff coverage report

Full coverage report

Phase field

b3924e #28842 340196
Total Total +/- New
Rate 86.01% 86.01% +0.00% 75.00%
Hits 13673 13675 +2 6
Misses 2224 2224 - 2

Diff coverage report

Full coverage report

Porous flow

b3924e #28842 340196
Total Total +/- New
Rate 95.30% 95.30% - 100.00%
Hits 11336 11336 - 4
Misses 559 559 - 0

Diff coverage report

Full coverage report

Ray tracing

b3924e #28842 340196
Total Total +/- New
Rate 95.33% 95.33% - 100.00%
Hits 4364 4364 - 7
Misses 214 214 - 0

Diff coverage report

Full coverage report

Reactor

b3924e #28842 340196
Total Total +/- New
Rate 93.65% 93.65% - 100.00%
Hits 7613 7613 - 1
Misses 516 516 - 0

Diff coverage report

Full coverage report

Richards

b3924e #28842 340196
Total Total +/- New
Rate 93.11% 93.11% - 100.00%
Hits 3324 3324 - 2
Misses 246 246 - 0

Diff coverage report

Full coverage report

Solid mechanics

b3924e #28842 340196
Total Total +/- New
Rate 84.91% 84.91% - 100.00%
Hits 28158 28158 - 3
Misses 5006 5006 - 0

Diff coverage report

Full coverage report

Stochastic tools

b3924e #28842 340196
Total Total +/- New
Rate 90.68% 90.68% - 100.00%
Hits 8093 8093 - 1
Misses 832 832 - 0

Diff coverage report

Full coverage report

Thermal hydraulics

b3924e #28842 340196
Total Total +/- New
Rate 88.35% 88.35% +0.00% 100.00%
Hits 13910 13911 +1 15
Misses 1834 1834 - 0

Diff coverage report

Full coverage report

Xfem

b3924e #28842 340196
Total Total +/- New
Rate 82.38% 82.38% - 100.00%
Hits 6907 6907 - 1
Misses 1477 1477 - 0

Diff coverage report

Full coverage report

Full coverage reports

Reports

Warnings

  • framework new line coverage rate 70.10% is less than the suggested 90.0%
  • phase_field new line coverage rate 75.00% is less than the suggested 90.0%

This comment will be updated on new commits.

@GiudGiud
Copy link
Contributor Author

GiudGiud commented Oct 17, 2024

All (needed with the huge concessions on the namespace) patches are merged this should be good to go.

This will collect merge conflicts and unexpected failures (from new uses of objects that are not in the namespace) like no other PR so it'd be great to process it fast

Copy link
Member

@loganharbour loganharbour left a comment

Choose a reason for hiding this comment

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

At the very least needs a newsletter entry. this is pretty significant

Added more testing for nonstandard configurations. I suspect we might break a few apps with nonstandard configs (that aren't tested in on-moose app tests), but we can deal with that on app devels as they pop up

Copy link
Member

@lindsayad lindsayad left a comment

Choose a reason for hiding this comment

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

seems like a great start

@GiudGiud
Copy link
Contributor Author

Thanks thanks
Looks like the jit stuff fails on Mac I ll try to figure it out

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.

Get rid of using namespace libMesh; in Moose.h
5 participants