and -> &&, or -> ||

This commit is contained in:
jingang 2019-06-14 20:07:42 -04:00
parent e5b2c6b477
commit 23d7e41592

View file

@ -4,7 +4,6 @@
#include <cmath>
#include <sstream>
#include <utility>
#include <ciso646>
#include "openmc/error.h"
#include "openmc/hdf5_interface.h"
@ -298,7 +297,7 @@ template<int i> double
axis_aligned_plane_distance(Position r, Direction u, bool coincident, double offset)
{
const double f = offset - r[i];
if (coincident or std::abs(f) < FP_COINCIDENT or u[i] == 0.0) return INFTY;
if (coincident || std::abs(f) < FP_COINCIDENT || u[i] == 0.0) return INFTY;
const double d = f / u[i];
if (d < 0.0) return INFTY;
return d;
@ -494,7 +493,7 @@ SurfacePlane::distance(Position r, Direction u, bool coincident) const
{
const double f = A_*r.x + B_*r.y + C_*r.z - D_;
const double projection = A_*u.x + B_*u.y + C_*u.z;
if (coincident or std::abs(f) < FP_COINCIDENT or projection == 0.0) {
if (coincident || std::abs(f) < FP_COINCIDENT || projection == 0.0) {
return INFTY;
} else {
const double d = -f / projection;
@ -574,7 +573,7 @@ axis_aligned_cylinder_distance(Position r, Direction u,
// No intersection with cylinder.
return INFTY;
} else if (coincident or std::abs(c) < FP_COINCIDENT) {
} else if (coincident || std::abs(c) < FP_COINCIDENT) {
// Particle is on the cylinder, thus one distance is positive/negative
// and the other is zero. The sign of k determines if we are facing in or
// out.
@ -744,7 +743,7 @@ double SurfaceSphere::distance(Position r, Direction u, bool coincident) const
// No intersection with sphere.
return INFTY;
} else if (coincident or std::abs(c) < FP_COINCIDENT) {
} else if (coincident || std::abs(c) < FP_COINCIDENT) {
// Particle is on the sphere, thus one distance is positive/negative and
// the other is zero. The sign of k determines if we are facing in or out.
if (k >= 0.0) {
@ -821,7 +820,7 @@ axis_aligned_cone_distance(Position r, Direction u,
// No intersection with cone.
return INFTY;
} else if (coincident or std::abs(c) < FP_COINCIDENT) {
} else if (coincident || std::abs(c) < FP_COINCIDENT) {
// Particle is on the cone, thus one distance is positive/negative
// and the other is zero. The sign of k determines if we are facing in or
// out.
@ -1009,7 +1008,7 @@ SurfaceQuadric::distance(Position r, Direction ang, bool coincident) const
// No intersection with surface.
return INFTY;
} else if (coincident or std::abs(c) < FP_COINCIDENT) {
} else if (coincident || std::abs(c) < FP_COINCIDENT) {
// Particle is on the surface, thus one distance is positive/negative and
// the other is zero. The sign of k determines which distance is zero and
// which is not.
@ -1156,27 +1155,27 @@ void read_surfaces(pugi::xml_node node)
// See if this surface makes part of the global bounding box.
BoundingBox bb = surf->bounding_box();
if (bb.xmin > -INFTY and bb.xmin < xmin) {
if (bb.xmin > -INFTY && bb.xmin < xmin) {
xmin = bb.xmin;
i_xmin = i_surf;
}
if (bb.xmax < INFTY and bb.xmax > xmax) {
if (bb.xmax < INFTY && bb.xmax > xmax) {
xmax = bb.xmax;
i_xmax = i_surf;
}
if (bb.ymin > -INFTY and bb.ymin < ymin) {
if (bb.ymin > -INFTY && bb.ymin < ymin) {
ymin = bb.ymin;
i_ymin = i_surf;
}
if (bb.ymax < INFTY and bb.ymax > ymax) {
if (bb.ymax < INFTY && bb.ymax > ymax) {
ymax = bb.ymax;
i_ymax = i_surf;
}
if (bb.zmin > -INFTY and bb.zmin < zmin) {
if (bb.zmin > -INFTY && bb.zmin < zmin) {
zmin = bb.zmin;
i_zmin = i_surf;
}
if (bb.zmax < INFTY and bb.zmax > zmax) {
if (bb.zmax < INFTY && bb.zmax > zmax) {
zmax = bb.zmax;
i_zmax = i_surf;
}