xbraid icon indicating copy to clipboard operation
xbraid copied to clipboard

Adds StatusAcceptsRFactor

Open cadaverous-lives opened this issue 1 year ago • 1 comments

Mainly adds the function braid_StatusAcceptsRFactor which allows the user to query XBraid whether the function braid_StepStatusSetRFactor will actually take effect after this step or not. This gives users a simple way to compute error estimates only when absolutely necessary for refinement in time.

I am absolutely open to changing the name of this function if you don't find "accepts rfactor" to be intuitive, but I wanted to get a PR here before I forgot about this feature again.

Here is the implementation of this function:

braid_Int
braid_StatusAcceptsRFactor(braid_Status status)
{
   braid_Int level  = _braid_StatusElt(status, level);
   braid_Int caller = _braid_StatusElt(status, calling_function);
   /* Only accept rfactors in FRestrict on the fine-grid */
   return ((caller == braid_ASCaller_FRestrict || caller == braid_ASCaller_FASResidual) && (level == 0));
}

cadaverous-lives avatar Dec 13 '23 23:12 cadaverous-lives

This should probably include logic to check whether the max_refine limit has been reached, right?

cadaverous-lives avatar Dec 14 '23 02:12 cadaverous-lives