xbraid
xbraid copied to clipboard
Better User Information on When to SetRFactor
As of right now, the user doesn't have good information on when to SetRFactor. The user could easily SetRFactor during FCRelax and during FRestrict, while on level 0, and the effort to compute SetRFactor during FCRelax would be wasted.
So, the proposal is to create a new Status element (say, "RFactorOK") that tells the user (True/False) whether to compute an RFactor.
This value would only ever be true during FRestrict on level 0, so the user would only be "told" to SetRFactor exactly once for each point on the fine grid per iteration. This new status element would have to be set to TRUE during FRestrict during BOTH the F-relax and C-relax for the residual computation.
All other StepStatusInit() calls would have to set this value to False. No other status structures (Access, CoarsenRef,...) would use this status element.
LASTLY, the SetRFactor function in braid_status.c would have to be changed. Instead of the if (ii >= 0) we would check if core/status->RFactorOK == True
The same logic would need to be done in SetRefinementDtValues
Lastly, the example codes would have to be updated to use this new status element.
@jbschroder, @rfalgout,
Can't this be achieved by just doing:
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));
}
I was wondering about something like this myself, since I am working on the adaptive refinement stuff for theta method, this would be handy.