Skip to content

Remove global mesh#3131

Open
bendudson wants to merge 3 commits intonextfrom
remove-global-mesh
Open

Remove global mesh#3131
bendudson wants to merge 3 commits intonextfrom
remove-global-mesh

Conversation

@bendudson
Copy link
Copy Markdown
Contributor

Very much a breaking change. Experimental, to see what changes are needed to remove the global mesh.

Work in progress.

bendudson and others added 3 commits June 20, 2025 17:26
- Removing bout::globals::mesh
- Delete GRID_LOAD2 .. GRID_LOAD6
- Move GRID_LOAD macro into bout/mesh.hxx
Not compiling yet. Issues in IO and Solver.
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 116. Check the log or trigger a new build to see more.

Comment thread include/bout/field2d.hxx
* By default the global Mesh pointer (mesh) is used.
*/
Field2D(Mesh* localmesh = nullptr, CELL_LOC location_in = CELL_CENTRE,
Field2D(Mesh* localmesh, CELL_LOC location_in = CELL_CENTRE,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "CELL_CENTRE" is directly included [misc-include-cleaner]

  Field2D(Mesh* localmesh, CELL_LOC location_in = CELL_CENTRE,
                                                  ^

Comment thread include/bout/field2d.hxx
* By default the global Mesh pointer (mesh) is used.
*/
Field2D(Mesh* localmesh = nullptr, CELL_LOC location_in = CELL_CENTRE,
Field2D(Mesh* localmesh, CELL_LOC location_in = CELL_CENTRE,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "CELL_LOC" is directly included [misc-include-cleaner]

include/bout/field2d.hxx:26:

- class Field2D;
+ #include "bout/bout_types.hxx"
+ class Field2D;

Comment thread include/bout/field2d.hxx
* boundary cells.
*/
Field2D(BoutReal val, Mesh* localmesh = nullptr);
Field2D(BoutReal val, Mesh* localmesh);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "BoutReal" is directly included [misc-include-cleaner]

  Field2D(BoutReal val, Mesh* localmesh);
          ^

static constexpr auto default_type = "hermitespline";

ReturnType create(Options* options, int y_offset = 0, Mesh* mesh = nullptr,
ReturnType create(Mesh* mesh, Options* options, int y_offset = 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "Options" is directly included [misc-include-cleaner]

include/bout/interpolation_z.hxx:26:

- #include "bout/paralleltransform.hxx"
+ #include "bout/options.hxx"
+ #include "bout/paralleltransform.hxx"

}
ReturnType create(const std::string& type, Options* options) const {
return Factory::create(type, nullptr, options, CELL_CENTRE);
ReturnType create(const std::string& type, Mesh* mesh, Options* options) const {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "std::string" is directly included [misc-include-cleaner]

include/bout/invert/laplacexz.hxx:38:

+ #include <string>

Comment thread include/bout/rkscheme.hxx
static constexpr auto option_name = "scheme";
static constexpr auto default_type = RKSCHEME_RKF45;

ReturnType create(const std::string& type, Mesh*, Options* options) const {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
ReturnType create(const std::string& type, Mesh*, Options* options) const {
ReturnType create(const std::string& type, Mesh* /*unused*/, Options* options) const {

Comment thread include/bout/rkscheme.hxx
static constexpr auto option_name = "scheme";
static constexpr auto default_type = RKSCHEME_RKF45;

ReturnType create(const std::string& type, Mesh*, Options* options) const {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "Mesh" is directly included [misc-include-cleaner]

include/bout/rkscheme.hxx:32:

- class RKScheme;
+ #include "bout/field2d.hxx"
+ class RKScheme;

Comment thread include/bout/solver.hxx
SOLVERPVODE;
#endif

ReturnType create(const std::string& type, Mesh*, Options* options) const {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
ReturnType create(const std::string& type, Mesh*, Options* options) const {
ReturnType create(const std::string& type, Mesh* /*unused*/, Options* options) const {

Comment thread src/bout++.cxx
bout::globals::mpi = new MpiWrapper();
bout::globals::mesh = Mesh::create();
bout::globals::mesh->load();
auto mesh = Mesh::create();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: 'auto mesh' can be declared as 'auto *mesh' [readability-qualified-auto]

Suggested change
auto mesh = Mesh::create();
auto *mesh = Mesh::create();

Comment thread src/field/field_data.cxx
// fieldmesh==nullptr indicates that some initialization that would
// be done in the constructor if fieldmesh was a valid Mesh object
// still needs to be done.
ASSERT0(fieldmesh);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "ASSERT0" is directly included [misc-include-cleaner]

src/field/field_data.cxx:1:

- #include "bout/parallel_boundary_op.hxx"
+ #include "bout/assert.hxx"
+ #include "bout/parallel_boundary_op.hxx"

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.

1 participant