You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, in the C++ interface to XBraid, when the user writes their subclass of BraidApp (in braid.hpp), they are given the unhelpful incomplete type braid_Vector, which they have to cast every time to a pointer of their own BraidVector type. For example, in examples/ex-01-pp.cpp:
The pointer casting then takes place in the _BraidAppX functions automatically. I think this is pretty obviously nicer for the user, since there's never really a situation where they want to use braid_Vector in C++, and the pointer casts are probably free.
The only other small change this creates though is either:
...
// Initialize Braid Core Object and set some solver options
BraidCore<MyBraidVector> core(MPI_COMM_WORLD, &app);
core.SetPrintLevel(2);
...
or
2. BraidCore's SetSpacialCoarsenAndRefine, SetSync and SetResidual methods (which take no arguments) can be changed to boolean optional arguments to the BraidCore constructor, so unless you use those methods, no change is needed to your code. This option is rendered in my generic_cpp_2 branch.
I don't know how flexible the API for the C++ interface is, but I hope this change can be considered
The text was updated successfully, but these errors were encountered:
Currently, in the C++ interface to XBraid, when the user writes their subclass of
BraidApp
(in braid.hpp), they are given the unhelpful incomplete typebraid_Vector
, which they have to cast every time to a pointer of their ownBraidVector
type. For example, in examples/ex-01-pp.cpp:This could be fixed by adding a template type to the
BraidApp
super class. For example, in thegeneric_cpp
branch where I've made the change the declaration ofMyBraidApp
changes only slightly:Then all the methods can be written much nicer using the
BraidVector
type (which is typedef'd in this example toMyBraidVector *
):The pointer casting then takes place in the
_BraidAppX
functions automatically. I think this is pretty obviously nicer for the user, since there's never really a situation where they want to usebraid_Vector
in C++, and the pointer casts are probably free.The only other small change this creates though is either:
BraidCore
must have a template type as well:or
2.
BraidCore
'sSetSpacialCoarsenAndRefine
,SetSync
andSetResidual
methods (which take no arguments) can be changed to boolean optional arguments to theBraidCore
constructor, so unless you use those methods, no change is needed to your code. This option is rendered in mygeneric_cpp_2
branch.I don't know how flexible the API for the C++ interface is, but I hope this change can be considered
The text was updated successfully, but these errors were encountered: