Improve dealii namespace inclusion #6219
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is something I noticed while working on #6217: About half of our header files (and some source files) have the directive
using namespace dealii;
in their respective namespaces (or sometimes in the mainaspect
namespace). The other half doesnt, and relies on some header file including the namespace. I think it would make sense to unify this. In particular, since all of our files are expected to includeglobal.h
either directly or through their headers, I think it would make sense to only include the deal.II namespace inaspect/global.h
, and make sure thedealii
namespace is always included in theaspect
namespace. This lowers the likelihood of name collision in all namespaces except for the globalaspect
namespace itself and hides a directive that many new users (familiar with C or python) will not understand. It also reduces the number of lines of code.An alternative to this PR would be to make sure every file includes the
dealii
namespace in an appropriate place.All of the code changes are very straightforward, except:
using namespace dealii
also incompat.h
(likely becausecompat.h
andglobal.h
have a circular includesource/postprocess/particle_count_statistics.cc
that I fixednamespace aspect
in a number of source files of tests that previously did everything in the global namespace. This adds a lot of whitespace change in those files. Not sure this is the cleanest solution, but I think it is reasonable to except all ASPECT code to live in theaspect
namespace.