Add factory for LaplaceXY, LaplaceXY2, LaplaceXY2Hypre#3187
Conversation
59a68f3 to
fbe8a7f
Compare
|
I think there's still more that could be tidied up here, but at least we can switch between PETSc and HYPRE at runtime, and there's few compile warnings. |
| #include <bout/bout.hxx> | ||
| #include <bout/constants.hxx> | ||
| #include <bout/derivs.hxx> | ||
| #include <bout/field_factory.hxx> |
There was a problem hiding this comment.
warning: duplicate include [readability-duplicate-include]
examples/elm-pb-outerloop/elm_pb_outerloop.cxx:34:
- #include <bout/derivs.hxx>
- #include <bout/derivs.hxx>
+ #include <bout/derivs.hxx>| #include <bout/invert/laplacexy.hxx> | ||
| #include <bout/invert_laplace.hxx> | ||
| #include <bout/invert_parderiv.hxx> | ||
| #include <bout/msg_stack.hxx> |
There was a problem hiding this comment.
warning: duplicate include [readability-duplicate-include]
examples/elm-pb-outerloop/elm_pb_outerloop.cxx:40:
- #include <bout/invert_laplace.hxx>
- #include <bout/invert_laplace.hxx>
+ #include <bout/invert_laplace.hxx>| BOUT_OVERRIDE_DEFAULT_OPTION("phi:bndry_xin", "none"); | ||
| BOUT_OVERRIDE_DEFAULT_OPTION("phi:bndry_xout", "none"); | ||
|
|
||
| #if BOUT_HAS_HYPRE |
There was a problem hiding this comment.
warning: no header providing "BOUT_HAS_HYPRE" is directly included [misc-include-cleaner]
examples/elm-pb/elm_pb.cxx:7:
- #include <bout/bout.hxx>
+ #include "bout/build_defines.hxx"
+ #include <bout/bout.hxx>|
|
||
| /// Create a LaplaceXY object | ||
| LaplaceXY laplacexy(bout::globals::mesh); | ||
| auto laplacexy = LaplaceXY::create(bout::globals::mesh); |
There was a problem hiding this comment.
warning: no header providing "bout::globals::mesh" is directly included [misc-include-cleaner]
examples/laplacexy/simple/test-laplacexy.cxx:1:
- #include <bout/bout.hxx>
+ #include "bout/globals.hxx"
+ #include <bout/bout.hxx>| Field2D x = 0.0; | ||
|
|
||
| x = laplacexy.solve(rhs, x); | ||
| Field2D result = laplacexy->solve(rhs, 0.0); |
There was a problem hiding this comment.
warning: variable 'result' of type 'Field2D' can be declared 'const' [misc-const-correctness]
| Field2D result = laplacexy->solve(rhs, 0.0); | |
| Field2D const result = laplacexy->solve(rhs, 0.0); |
| // LaplaceXY object that this monitor belongs to | ||
| LaplaceXY& laplacexy; | ||
| }; | ||
| static std::unique_ptr<LaplaceXY> create(Mesh* m = nullptr, Options* opt = nullptr, |
There was a problem hiding this comment.
warning: no header providing "std::unique_ptr" is directly included [misc-include-cleaner]
include/bout/invert/laplacexy.hxx:40:
- #include <string>
+ #include <memory>
+ #include <string>
Not quite sure why these were standalone classes, or if we indeed still want to keep all of them, but I've now squashed them into the generic factory capability so they can be switched between at runtime -- and we also avoid an annoying compiletime warning if compiling without PETSc or HYPRE!