Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds StatusAcceptsRFactor #94

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${default}"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
16 changes: 11 additions & 5 deletions braid/braid_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,20 +445,26 @@ braid_StatusSetTightFineTolx(braid_Status status,
return _braid_error_flag;
}

braid_Int
braid_StepStatusAcceptsRFactor(braid_StepStatus 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));
}

braid_Int
braid_StatusSetRFactor(braid_Status status,
braid_Real rfactor
)
{
braid_Int level = _braid_StatusElt(status, level);

/* Only set the rfactor on level 0 */
if (level == 0)
if (braid_StepStatusAcceptsRFactor((braid_StepStatus) status))
{
_braid_Grid **grids = _braid_StatusElt(status, grids);
braid_Int *rfactors = _braid_StatusElt(status, rfactors);
braid_Int index = _braid_StatusElt(status, idx);
braid_Int ilower = _braid_GridElt(grids[level], ilower);
braid_Int ilower = _braid_GridElt(grids[0], ilower);
braid_Int ii = index+1 - ilower;

/* Set refinement factor
Expand Down
8 changes: 8 additions & 0 deletions braid/braid_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,14 @@ braid_StatusSetTightFineTolx(braid_Status status, /**< structure contai
braid_Real tight_fine_tolx /**< input, boolean indicating whether the tight tolx has been used */
);

/**
* Check if the status structure will accept a refinement factor.
* If yes, return 1, otherwise return 0.
**/
braid_Int
braid_StepStatusAcceptsRFactor(braid_StepStatus status /**< structure containing current simulation info */
);

/**
* Set the rfactor, a desired refinement factor for this interval. rfactor=1
* indicates no refinement, otherwise, this inteval is subdivided rfactor
Expand Down
Loading