From a885f002c42dab651d8ad2746dd9a3f61cd3e0a1 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 9 Oct 2024 11:56:06 -0600 Subject: [PATCH] IOSS, EJOIN: Analyzer fixes --- .../seacas/applications/ejoin/EJ_vector3d.C | 10 ++++----- .../seacas/applications/ejoin/EJ_vector3d.h | 21 ++++++++++--------- .../seacas/libraries/ioss/src/main/vector3d.h | 14 ++++++------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/packages/seacas/applications/ejoin/EJ_vector3d.C b/packages/seacas/applications/ejoin/EJ_vector3d.C index 2b189aeea3..6bdc739549 100644 --- a/packages/seacas/applications/ejoin/EJ_vector3d.C +++ b/packages/seacas/applications/ejoin/EJ_vector3d.C @@ -11,7 +11,7 @@ vector3d::vector3d(double X, double Y, double Z) : x(X), y(Y), z(Z) {} //---------------------------------------------------------------------------- -vector3d::vector3d(double location[3]) : x(location[0]), y(location[1]), z(location[2]) {} +vector3d::vector3d(const double location[3]) : x(location[0]), y(location[1]), z(location[2]) {} void vector3d::set(double X, double Y, double Z) { @@ -35,14 +35,14 @@ vector3d &vector3d::reverse() return *this; } -bool vector3d::operator==(const vector3d &from) const +bool operator==(const vector3d &lhs, const vector3d &rhs) { - return (x == from.x && y == from.y && z == from.z); + return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z); } -bool vector3d::operator!=(const vector3d &from) const +bool operator!=(const vector3d &lhs, const vector3d &rhs) { - return (x != from.x || y != from.y || z != from.z); + return (lhs.x != rhs.x || lhs.y != rhs.y || lhs.z == rhs.z); } vector3d operator+(const vector3d &lhs, const vector3d &rhs) diff --git a/packages/seacas/applications/ejoin/EJ_vector3d.h b/packages/seacas/applications/ejoin/EJ_vector3d.h index 29a4c871ad..6dd4c6252f 100644 --- a/packages/seacas/applications/ejoin/EJ_vector3d.h +++ b/packages/seacas/applications/ejoin/EJ_vector3d.h @@ -10,12 +10,10 @@ class vector3d public: vector3d() = default; vector3d(double X, double Y, double Z); - explicit vector3d(double location[3]); + explicit vector3d(const double location[3]); double x{}, y{}, z{}; - bool operator==(const vector3d &from) const; - bool operator!=(const vector3d &from) const; void set(double X, double Y, double Z); void set(const double location[3]); vector3d &reverse(); @@ -30,17 +28,20 @@ class vector3d vector3d &operator*=(double scalar); vector3d &operator/=(double scalar); + friend bool operator==(const vector3d &lhs, const vector3d &rhs); + friend bool operator!=(const vector3d &lhs, const vector3d &rhs); + + friend vector3d operator*(double scalar, const vector3d &from); + friend vector3d operator*(const vector3d &lhs, double scalar); + friend vector3d operator/(const vector3d &lhs, double scalar); + + friend vector3d operator+(const vector3d &lhs, const vector3d &rhs); + friend vector3d operator-(const vector3d &lhs, const vector3d &rhs); + double length() const; vector3d cross(const vector3d &from) const; }; -vector3d operator*(double scalar, const vector3d &from); -vector3d operator*(const vector3d &lhs, double scalar); -vector3d operator/(const vector3d &lhs, double scalar); - -vector3d operator+(const vector3d &lhs, const vector3d &rhs); -vector3d operator-(const vector3d &lhs, const vector3d &rhs); - //---------------------------------------------------------------------------- inline vector3d vector3d::cross(const vector3d &from) const { diff --git a/packages/seacas/libraries/ioss/src/main/vector3d.h b/packages/seacas/libraries/ioss/src/main/vector3d.h index d0f2925905..ff0e33dbff 100644 --- a/packages/seacas/libraries/ioss/src/main/vector3d.h +++ b/packages/seacas/libraries/ioss/src/main/vector3d.h @@ -29,19 +29,19 @@ class vector3d vector3d &operator*=(double scalar); vector3d &operator/=(double scalar); + friend vector3d operator*(double scalar, const vector3d &from); + friend vector3d operator*(const vector3d &lhs, double scalar); + friend vector3d operator/(const vector3d &lhs, double scalar); + + friend vector3d operator+(const vector3d &lhs, const vector3d &rhs); + friend vector3d operator-(const vector3d &lhs, const vector3d &rhs); + double length() const; double normalize(double tolerance = 1e-06); vector3d cross(const vector3d &from) const; static vector3d plane_normal(const vector3d &v1, const vector3d &v2, const vector3d &v3); }; -vector3d operator*(double scalar, const vector3d &from); -vector3d operator*(const vector3d &lhs, double scalar); -vector3d operator/(const vector3d &lhs, double scalar); - -vector3d operator+(const vector3d &lhs, const vector3d &rhs); -vector3d operator-(const vector3d &lhs, const vector3d &rhs); - //---------------------------------------------------------------------------- inline vector3d vector3d::cross(const vector3d &from) const {