Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
9837aba8
Commit
9837aba8
authored
May 18, 2017
by
Andrew Heather
Browse files
COMP: specie - ensure if block is evaluated
parent
d0befa42
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/thermophysicalModels/specie/specie/specieI.H
View file @
9837aba8
...
...
@@ -159,14 +159,17 @@ inline specie operator==(const specie& st1, const specie& st2)
diffY
=
SMALL
;
}
const
scalar
diffRW
=
st2
.
Y_
/
st2
.
molWeight_
-
st1
.
Y_
/
st1
.
molWeight_
;
const
scalar
diffRW
=
st2
.
Y_
/
st2
.
molWeight_
-
st1
.
Y_
/
st1
.
molWeight_
;
scalar
molWeight
=
GREAT
;
if
(
mag
(
diffRW
)
>
SMALL
)
{
molWeight
=
diffY
/
diffRW
;
}
// if (mag(diffRW) > SMALL)
// {
// molWeight = diffY/diffRW;
// }
// Using intermediate volatile bool to prevent compiler optimising out the
// if block (above) - CLANG 3.7.1
volatile
const
bool
valid
=
(
mag
(
diffRW
)
>
SMALL
);
const
scalar
molWeight
=
valid
?
diffY
/
diffRW
:
GREAT
;
return
specie
(
diffY
,
molWeight
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment