On Mon, Mar 23, 2020 at 5:12 PM Lisandro Dalcin <[email protected]> wrote:
> > > On Mon, 23 Mar 2020 at 17:57, [email protected] <[email protected]> > wrote: > >> Lisandro: >> >>> MatProductSetFromOptions() is not really setting any options. It looks >>> like the correct name for this API is MatProductSetUp(). In any case, it >>> looks like both SetFromOptions() and SetUp() should be provided. >>> >> >> Not all product and matrix types enable algorithmic options. For those >> who do have options, >> MatProductSetFromOptions_mattype_producttype() enables it. >> See MatProductSetFromOptions_MPIAIJ_AB(). >> > > I have to insist, you should separate SetFromOptions() from SetUp(). For > many types, SetFromOptions may be empty (you can even use a NULL pointer to > handle these cases), but the rest of the code that does setup stuff (that > is, preparing the data structures) should go SetUp() routines. > This design pattern is used everywhere in PETSc. That's the proper way to > do it, IMHO. This way is the one that gives maximum flexibility to power > users/developers, because some times developers may want to configure > objects with some parameters, and do a SetUp() without calling > SetFromOptions() to prevent users to mess up with the parameters the > developer carefully chose. > I agree here. We should not be using options in SetUp or setting up in SetFromOptions() since it might not be called. I am tying to fix all this in DM. Matt > -- > Lisandro Dalcin > ============ > Research Scientist > Extreme Computing Research Center (ECRC) > King Abdullah University of Science and Technology (KAUST) > http://ecrc.kaust.edu.sa/ > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
