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

Get rid of using namespace libMesh; in Moose.h #28499

Open
dschwen opened this issue Aug 29, 2024 · 0 comments · May be fixed by #28842
Open

Get rid of using namespace libMesh; in Moose.h #28499

dschwen opened this issue Aug 29, 2024 · 0 comments · May be fixed by #28842
Labels
C: Framework T: task An enhancement to the software.

Comments

@dschwen
Copy link
Member

dschwen commented Aug 29, 2024

Motivation

We should never be putting a using namespace in the global scope in a header file. This pollutes the entire project and can create ambiguities between libMesh and other third party libraries. I just ran into a case where both libMesh and neml2 have a print_helper function with similar signatures. The neml2 version is called from within the neml2 namespace, but due to the using namespace libMesh directive in Moose.h the libMesh version of that function now is an ambiguous alternative for the compiler.

Design

A workaround would be to ask the NEML2 developer to explicitly add a scope resolution operator (call neml2::print_helper instead). But that would look redundant on the NEML2 side, and were asking someone else to fix a problem we created.
I realize we have a ton on types and function that we pull in from the libMesh namespace (starting with simple things like Real or dof_id_type), and addinglibMesh:: everytime we use those would clutter up our code. But we can be more specific with our using statements (e.g. using libMesh::Real in MooseTypes.h etc.).
This would be a laborious effort... #technicaldebt @loganharbour

Impact

Reduce global namespace pollution

@dschwen dschwen added the T: task An enhancement to the software. label Aug 29, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
@GiudGiud GiudGiud linked a pull request Oct 14, 2024 that will close this issue
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 14, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/falcon that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 15, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 18, 2024
- declare sub-namespaces of libMesh as their own namespaces
- add libMesh:: in front of many objects
- add using libMesh::many_common_ones
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 18, 2024
- heavily rely on using namespace libMesh
- for some files, add libMesh:: everywhere
refs idaholab#28499
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 18, 2024
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Framework T: task An enhancement to the software.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants