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

Incorrect use of short-circuit 'or'? #1285

Closed
maxaehle opened this issue May 10, 2021 · 1 comment · Fixed by #1284
Closed

Incorrect use of short-circuit 'or'? #1285

maxaehle opened this issue May 10, 2021 · 1 comment · Fixed by #1284
Labels

Comments

@maxaehle
Copy link
Contributor

In CDiscAdjMultizoneDriver::HandleDataTransfer we have the following code structure:

bool DeformMesh = false;
for (unsigned short jZone = 0; jZone < nZone; jZone++){
  if (jZone != iZone && interface_container[jZone][iZone] != nullptr) {
    DeformMesh = DeformMesh || Transfer_Data(jZone, iZone);
  }
}
if (DeformMesh) DynamicMeshUpdate(iZone, ExtIter);

Transfer_Data returns true if and only if the interface type is BOUNDARY_DISPLACEMENTS. If this happens once, no further call to Transfer_Data will occur for this particular iZone because of short-circuit evaluation of the ||.

Though I'm new to the adjoint driver, I can hardly imagine that this is intended. Maybe the order of the arguments of || should be swapped, or it should be coded as in CMultizoneDriver::Update?

@pcarruscag
Copy link
Member

Thanks, I'll fix it in #1284

@pcarruscag pcarruscag added the bug label May 10, 2021
pcarruscag added a commit that referenced this issue May 10, 2021
@pcarruscag pcarruscag linked a pull request May 10, 2021 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants