[ET Trac] [Einstein Toolkit] #222: Dubious code in Hydro_InitExcision.c
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Thu Jan 20 16:01:04 CST 2011
#222: Dubious code in Hydro_InitExcision.c
----------------------+-----------------------------------------------------
Reporter: eschnett | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: Cactus | Version:
Keywords: |
----------------------+-----------------------------------------------------
Hydro_InitExcision.c contains the following code:
if ( (hydro_initexcision_coordinate_length <= 0.0) &&
( ( x_frac > 0.5 - hydro_initexcision_fraction) &&
( x_frac < 0.5 + hydro_initexcision_fraction) &&
( y_frac > 0.5 - hydro_initexcision_fraction) &&
( y_frac < 0.5 + hydro_initexcision_fraction) &&
( z_frac > 0.5 - hydro_initexcision_fraction) &&
( z_frac < 0.5 + hydro_initexcision_fraction)
) ||
( (hydro_initexcision_coordinate_length > 0.0) &&
( fabs(x[point]-hydro_initexcision_position_x) <=
hydro_initexcision_coordinate_length*0.5) &&
( fabs(y[point]-hydro_initexcision_position_y) <=
hydro_initexcision_coordinate_length*0.5) &&
( fabs(z[point]-hydro_initexcision_position_z) <=
hydro_initexcision_coordinate_length*0.5)
)
)
This code has an "and" (&&) and an "or" (||) operation at top level. Is
this intended? The code would be clearer with an additional set of
parenthesis, or by introducing a suitable set of temporaries for sub-
expressions.
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/222>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list