boutproject / BOUT-dev

BOUT++: Plasma fluid finite-difference simulation code in curvilinear coordinate systems
http://boutproject.github.io/
GNU Lesser General Public License v3.0
179 stars 93 forks source link

Unused `mesh` member functions #734

Open d7919 opened 6 years ago

d7919 commented 6 years ago

There are a reasonable number of functions in the mesh parent class that don't seem to be used anywhere in bout++, the examples or the tests. Removing these and simplifying the parent class might make things a bit clearer so I'd be interested in deleting these and/or exporting any that don't need to be member functions to some other location.

The list of what I think are unused functions is:

(~300 lines)

Some are just used in one place but may be more widely used in other's models (may be worth spinning off to new location in some cases?):

Following just for non-local example (but presumably used in some models?):

Following just for dalf3 example

In total I think this would remove somewhere in the region of 500 lines (~20% of boutmesh.cxx)

bendudson commented 6 years ago

Definitely agree that Mesh needs simplifying, and removing unused functions is a good start.

These are too low-level, and constrain the way that Mesh can be implemented. I would like to see these replaced by a more generic/ higher-level function in terms of the mathematical function it is trying to implement.

d7919 commented 6 years ago

Yes I do wonder if a unified treatment of different regions might indeed be possible, if not with the current iterator then with the single index version at least. This could simplify some of this.

The addBoundary routine does appear in main mesh -- are you suggesting it shouldn't (as could just be a part of FakeMesh as an extension)?

nick-walkden commented 6 years ago

iterateBndryLowerOuterY, iterateBndryLowerInnerY, iterateBndryUpperOuterY, iterateBndryUpperInnerY

These were put in to allow more flexibility iterating over boundaries when the branch cuts are specified. Agree that if a better, unified treatment is possible these could (should) be removed. I suspect the usage of these function is limited to just me currently though so if there is a push to remove them sooner rather than later I can work around.

d7919 commented 6 years ago

I don't think there's any desperate need to remove any of these if they are being used/useful but by identifying those bits of the code that aren't used very much/in many places it can be a bit easier to think about refactoring etc.

ZedThree commented 6 years ago

An update on the current situation. The following are still in Mesh:

The following can be replaced by SDI regions once #775 goes in:

ZedThree commented 1 year ago

Some years later, the following are still in Mesh: