From 1ff0855256bdc6de7c99f9ee1837def047fe86d7 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Mon, 12 Jan 2026 16:08:47 -0500 Subject: [PATCH 1/5] BUG: Fix bugs inside of the _calcRodNearestOrigin function. Earlier commit from Nov 2025 changed the RodSym values to 4 component values but that function still assumed it was a 3 component Rodrigues Orientation. --- Source/EbsdLib/LaueOps/CubicLowOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/CubicLowOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/CubicOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/CubicOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/HexagonalLowOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/HexagonalLowOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/HexagonalOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/HexagonalOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/LaueOps.cpp | 19 ++++++++++++------- Source/EbsdLib/LaueOps/LaueOps.h | 10 ++++++++-- Source/EbsdLib/LaueOps/MonoclinicOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/MonoclinicOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/OrthoRhombicOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/TetragonalLowOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/TetragonalLowOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/TetragonalOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/TetragonalOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/TriclinicOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/TriclinicOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/TrigonalLowOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/TrigonalLowOps.h | 20 ++++++++++++++++++-- Source/EbsdLib/LaueOps/TrigonalOps.cpp | 15 +++++++++------ Source/EbsdLib/LaueOps/TrigonalOps.h | 20 ++++++++++++++++++-- 24 files changed, 317 insertions(+), 97 deletions(-) diff --git a/Source/EbsdLib/LaueOps/CubicLowOps.cpp b/Source/EbsdLib/LaueOps/CubicLowOps.cpp index fb7476a..c5a6965 100644 --- a/Source/EbsdLib/LaueOps/CubicLowOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicLowOps.cpp @@ -266,11 +266,14 @@ QuatD CubicLowOps::getQuatSymOp(int32_t i) const return CubicLow::QuatSym[i]; } -void CubicLowOps::getRodSymOp(int i, double* r) const +int32_t CubicLowOps::getNumRodriguesSymOps() const { - r[0] = CubicLow::RodSym[i][0]; - r[1] = CubicLow::RodSym[i][1]; - r[2] = CubicLow::RodSym[i][2]; + return CubicLow::RodSym.size(); +} + +RodriguesDType CubicLowOps::getRodSymOp(size_t i) const +{ + return CubicLow::RodSym[i]; } ebsdlib::Matrix3X3D CubicLowOps::getMatSymOpD(int i) const @@ -317,7 +320,7 @@ void CubicLowOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType CubicLowOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(CubicLow::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -325,7 +328,7 @@ RodriguesDType CubicLowOps::getODFFZRod(const RodriguesDType& rod) const // ----------------------------------------------------------------------------- RodriguesDType CubicLowOps::getMDFFZRod(const RodriguesDType& inRod) const { - RodriguesDType rod = _calcRodNearestOrigin(CubicLow::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); auto ax = rod.toAxisAngle(); double n1 = ax[0]; diff --git a/Source/EbsdLib/LaueOps/CubicLowOps.h b/Source/EbsdLib/LaueOps/CubicLowOps.h index 6ac82c1..bc37327 100644 --- a/Source/EbsdLib/LaueOps/CubicLowOps.h +++ b/Source/EbsdLib/LaueOps/CubicLowOps.h @@ -151,9 +151,25 @@ class EbsdLib_EXPORT CubicLowOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/CubicOps.cpp b/Source/EbsdLib/LaueOps/CubicOps.cpp index d20ca6e..0f5fd9a 100644 --- a/Source/EbsdLib/LaueOps/CubicOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicOps.cpp @@ -609,11 +609,14 @@ QuatD CubicOps::getQuatSymOp(int32_t i) const return CubicHigh::QuatSym[i]; } -void CubicOps::getRodSymOp(int i, double* r) const +int32_t CubicOps::getNumRodriguesSymOps() const { - r[0] = CubicHigh::RodSym[i][0]; - r[1] = CubicHigh::RodSym[i][1]; - r[2] = CubicHigh::RodSym[i][2]; + return CubicHigh::RodSym.size(); +} + +RodriguesDType CubicOps::getRodSymOp(size_t i) const +{ + return CubicHigh::RodSym[i]; } ebsdlib::Matrix3X3D CubicOps::getMatSymOpD(int i) const @@ -660,7 +663,7 @@ void CubicOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType CubicOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(CubicHigh::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -671,7 +674,7 @@ RodriguesDType CubicOps::getMDFFZRod(const RodriguesDType& inRod) const double w, n1, n2, n3; double FZw, FZn1, FZn2, FZn3; - RodriguesDType rod = _calcRodNearestOrigin(CubicHigh::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); n1 = ax[0]; diff --git a/Source/EbsdLib/LaueOps/CubicOps.h b/Source/EbsdLib/LaueOps/CubicOps.h index 150c1f2..d0e4008 100644 --- a/Source/EbsdLib/LaueOps/CubicOps.h +++ b/Source/EbsdLib/LaueOps/CubicOps.h @@ -150,9 +150,25 @@ class EbsdLib_EXPORT CubicOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp index 9782a9f..9602b85 100644 --- a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp @@ -233,11 +233,14 @@ QuatD HexagonalLowOps::getQuatSymOp(int32_t i) const return HexagonalLow::QuatSym[i]; } -void HexagonalLowOps::getRodSymOp(int i, double* r) const +int32_t HexagonalLowOps::getNumRodriguesSymOps() const { - r[0] = HexagonalLow::RodSym[i][0]; - r[1] = HexagonalLow::RodSym[i][1]; - r[2] = HexagonalLow::RodSym[i][2]; + return HexagonalLow::RodSym.size(); +} + +RodriguesDType HexagonalLowOps::getRodSymOp(size_t i) const +{ + return HexagonalLow::RodSym[i]; } ebsdlib::Matrix3X3D HexagonalLowOps::getMatSymOpD(int i) const @@ -284,7 +287,7 @@ void HexagonalLowOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType HexagonalLowOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(HexagonalLow::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -296,7 +299,7 @@ RodriguesDType HexagonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const double FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0, FZw = 0.0; double n1n2mag = 0.0; - RodriguesDType rod = _calcRodNearestOrigin(HexagonalLow::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); diff --git a/Source/EbsdLib/LaueOps/HexagonalLowOps.h b/Source/EbsdLib/LaueOps/HexagonalLowOps.h index 17f6a34..87531f5 100644 --- a/Source/EbsdLib/LaueOps/HexagonalLowOps.h +++ b/Source/EbsdLib/LaueOps/HexagonalLowOps.h @@ -151,9 +151,25 @@ class EbsdLib_EXPORT HexagonalLowOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/HexagonalOps.cpp b/Source/EbsdLib/LaueOps/HexagonalOps.cpp index d1468f0..9605e0b 100644 --- a/Source/EbsdLib/LaueOps/HexagonalOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalOps.cpp @@ -278,11 +278,14 @@ QuatD HexagonalOps::getQuatSymOp(int32_t i) const // q.w = HexagonalHigh::QuatSym[i][3]; } -void HexagonalOps::getRodSymOp(int i, double* r) const +int32_t HexagonalOps::getNumRodriguesSymOps() const { - r[0] = HexagonalHigh::RodSym[i][0]; - r[1] = HexagonalHigh::RodSym[i][1]; - r[2] = HexagonalHigh::RodSym[i][2]; + return HexagonalHigh::RodSym.size(); +} + +RodriguesDType HexagonalOps::getRodSymOp(size_t i) const +{ + return HexagonalHigh::RodSym[i]; } ebsdlib::Matrix3X3D HexagonalOps::getMatSymOpD(int i) const @@ -328,7 +331,7 @@ void HexagonalOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType HexagonalOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(HexagonalHigh::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -340,7 +343,7 @@ RodriguesDType HexagonalOps::getMDFFZRod(const RodriguesDType& inRod) const double FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0, FZw = 0.0; double n1n2mag; - RodriguesDType rod = _calcRodNearestOrigin(HexagonalHigh::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); diff --git a/Source/EbsdLib/LaueOps/HexagonalOps.h b/Source/EbsdLib/LaueOps/HexagonalOps.h index a395398..196ab71 100644 --- a/Source/EbsdLib/LaueOps/HexagonalOps.h +++ b/Source/EbsdLib/LaueOps/HexagonalOps.h @@ -151,9 +151,25 @@ class EbsdLib_EXPORT HexagonalOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/LaueOps.cpp b/Source/EbsdLib/LaueOps/LaueOps.cpp index 801dc84..9199e6b 100644 --- a/Source/EbsdLib/LaueOps/LaueOps.cpp +++ b/Source/EbsdLib/LaueOps/LaueOps.cpp @@ -545,7 +545,7 @@ AxisAngleDType LaueOps::calculateMisorientationInternal(const std::vector // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -RodriguesDType LaueOps::_calcRodNearestOrigin(const std::vector& rodsym, const RodriguesDType& inRod) const +RodriguesDType LaueOps::_calcRodNearestOrigin(const RodriguesDType& inRod) const { double denom = 0.0f, dist = 0.0f; double smallestdist = 100000000.0f; @@ -556,13 +556,18 @@ RodriguesDType LaueOps::_calcRodNearestOrigin(const std::vector& rod[0] *= rod[3]; rod[1] *= rod[3]; rod[2] *= rod[3]; - size_t numsym = rodsym.size(); + size_t numsym = static_cast(getNumRodriguesSymOps()); + for(size_t i = 0; i < numsym; i++) { - denom = 1 - (rod[0] * rodsym[i][0] + rod[1] * rodsym[i][1] + rod[2] * rodsym[i][2]); - rc1 = (rod[0] + rodsym[i][0] - (rod[1] * rodsym[i][2] - rod[2] * rodsym[i][1])) / denom; - rc2 = (rod[1] + rodsym[i][1] - (rod[2] * rodsym[i][0] - rod[0] * rodsym[i][2])) / denom; - rc3 = (rod[2] + rodsym[i][2] - (rod[0] * rodsym[i][1] - rod[1] * rodsym[i][0])) / denom; + RodriguesDType currentRodSymmetry = getRodSymOp(i); + // Convert Rodrigues 4 component into a 3 component + std::array symRod = {currentRodSymmetry[0] * currentRodSymmetry[3], currentRodSymmetry[1] * currentRodSymmetry[3], currentRodSymmetry[2] * currentRodSymmetry[3]}; + + denom = 1 - (rod[0] * symRod[0] + rod[1] * symRod[1] + rod[2] * symRod[2]); + rc1 = (rod[0] + symRod[0] - (rod[1] * symRod[2] - rod[2] * symRod[1])) / denom; + rc2 = (rod[1] + symRod[1] - (rod[2] * symRod[0] - rod[0] * symRod[2])) / denom; + rc3 = (rod[2] + symRod[2] - (rod[0] * symRod[1] - rod[1] * symRod[0])) / denom; dist = rc1 * rc1 + rc2 * rc2 + rc3 * rc3; if(dist < smallestdist) { @@ -572,7 +577,7 @@ RodriguesDType LaueOps::_calcRodNearestOrigin(const std::vector& outRod[2] = rc3; } } - double mag = sqrt(outRod[0] * outRod[0] + outRod[1] * outRod[1] + outRod[2] * outRod[2]); + double mag = std::sqrt(outRod[0] * outRod[0] + outRod[1] * outRod[1] + outRod[2] * outRod[2]); if(mag == 0.0f) { outRod[3] = std::numeric_limits::infinity(); diff --git a/Source/EbsdLib/LaueOps/LaueOps.h b/Source/EbsdLib/LaueOps/LaueOps.h index 322873e..7bef0e2 100644 --- a/Source/EbsdLib/LaueOps/LaueOps.h +++ b/Source/EbsdLib/LaueOps/LaueOps.h @@ -131,6 +131,12 @@ class EbsdLib_EXPORT LaueOps */ virtual int getNumSymOps() const = 0; + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + virtual int getNumRodriguesSymOps() const = 0; + /** * @brief getSymmetryName Returns the name of the symmetry * @return @@ -183,7 +189,7 @@ class EbsdLib_EXPORT LaueOps * @param i Index of the symmetry operator * @param r Pointer to store the Rodrigues vector into. */ - virtual void getRodSymOp(int i, double* r) const = 0; + virtual RodriguesDType getRodSymOp(size_t i) const = 0; /** * @brief Retrieves a specific Symmetry Operator for a giving index @@ -450,7 +456,7 @@ class EbsdLib_EXPORT LaueOps * @param rod * @return */ - RodriguesDType _calcRodNearestOrigin(const std::vector& rodsym, const RodriguesDType& rod) const; + RodriguesDType _calcRodNearestOrigin(const RodriguesDType& rod) const; /** * @brief diff --git a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp index e5d528b..8f55d6c 100644 --- a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp @@ -209,11 +209,14 @@ QuatD MonoclinicOps::getQuatSymOp(int32_t i) const return Monoclinic::QuatSym[i]; } -void MonoclinicOps::getRodSymOp(int i, double* r) const +int32_t MonoclinicOps::getNumRodriguesSymOps() const { - r[0] = Monoclinic::RodSym[i][0]; - r[1] = Monoclinic::RodSym[i][1]; - r[2] = Monoclinic::RodSym[i][2]; + return Monoclinic::RodSym.size(); +} + +RodriguesDType MonoclinicOps::getRodSymOp(size_t i) const +{ + return Monoclinic::RodSym[i]; } ebsdlib::Matrix3X3D MonoclinicOps::getMatSymOpD(int i) const @@ -260,7 +263,7 @@ void MonoclinicOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType MonoclinicOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(Monoclinic::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -274,7 +277,7 @@ RodriguesDType MonoclinicOps::getMDFFZRod(const RodriguesDType& inRod) const // double w = 0.0, n1 = 0.0, n2 = 0.0, n3 = 0.0; // double FZw = 0.0, FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0; // - // OrientationType rod = LaueOps::_calcRodNearestOrigin(Monoclinic::RodSym, inRod); + // OrientationType rod = LaueOps::_calcRodNearestOrigin(inRod); // AxisAngleDType ax = rod.toAxisAngle(); // n1 = ax[0]; // n2 = ax[1], n3 = ax[2], w = ax[3]; diff --git a/Source/EbsdLib/LaueOps/MonoclinicOps.h b/Source/EbsdLib/LaueOps/MonoclinicOps.h index 5218213..cd7a18c 100644 --- a/Source/EbsdLib/LaueOps/MonoclinicOps.h +++ b/Source/EbsdLib/LaueOps/MonoclinicOps.h @@ -150,9 +150,25 @@ class EbsdLib_EXPORT MonoclinicOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp index d27076b..e9ec99a 100644 --- a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp +++ b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp @@ -218,11 +218,14 @@ QuatD OrthoRhombicOps::getQuatSymOp(int32_t i) const return OrthoRhombic::QuatSym[i]; } -void OrthoRhombicOps::getRodSymOp(int i, double* r) const +int32_t OrthoRhombicOps::getNumRodriguesSymOps() const { - r[0] = OrthoRhombic::RodSym[i][0]; - r[1] = OrthoRhombic::RodSym[i][1]; - r[2] = OrthoRhombic::RodSym[i][2]; + return OrthoRhombic::RodSym.size(); +} + +RodriguesDType OrthoRhombicOps::getRodSymOp(size_t i) const +{ + return OrthoRhombic::RodSym[i]; } ebsdlib::Matrix3X3D OrthoRhombicOps::getMatSymOpD(int i) const @@ -269,7 +272,7 @@ void OrthoRhombicOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType OrthoRhombicOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(OrthoRhombic::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -281,7 +284,7 @@ RodriguesDType OrthoRhombicOps::getMDFFZRod(const RodriguesDType& inRod) const double FZn1 = 0.0f, FZn2 = 0.0f, FZn3 = 0.0f, FZw = 0.0f; - RodriguesDType rod = _calcRodNearestOrigin(OrthoRhombic::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); // double n1 = ax[0]; // double n2 = ax[1]; diff --git a/Source/EbsdLib/LaueOps/OrthoRhombicOps.h b/Source/EbsdLib/LaueOps/OrthoRhombicOps.h index 20df3cf..1b3b333 100644 --- a/Source/EbsdLib/LaueOps/OrthoRhombicOps.h +++ b/Source/EbsdLib/LaueOps/OrthoRhombicOps.h @@ -152,9 +152,25 @@ class EbsdLib_EXPORT OrthoRhombicOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp index 251050c..1a8ec00 100644 --- a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp @@ -217,11 +217,14 @@ QuatD TetragonalLowOps::getQuatSymOp(int32_t i) const return TetragonalLow::QuatSym[i]; } -void TetragonalLowOps::getRodSymOp(int i, double* r) const +int32_t TetragonalLowOps::getNumRodriguesSymOps() const { - r[0] = TetragonalLow::RodSym[i][0]; - r[1] = TetragonalLow::RodSym[i][1]; - r[2] = TetragonalLow::RodSym[i][2]; + return TetragonalLow::RodSym.size(); +} + +RodriguesDType TetragonalLowOps::getRodSymOp(size_t i) const +{ + return TetragonalLow::RodSym[i]; } ebsdlib::Matrix3X3D TetragonalLowOps::getMatSymOpD(int i) const @@ -268,7 +271,7 @@ void TetragonalLowOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType TetragonalLowOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(TetragonalLow::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- // @@ -277,7 +280,7 @@ RodriguesDType TetragonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const { double FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0, FZw = 0.0; - RodriguesDType rod = _calcRodNearestOrigin(TetragonalLow::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); FZn1 = std::fabs(ax[0]); diff --git a/Source/EbsdLib/LaueOps/TetragonalLowOps.h b/Source/EbsdLib/LaueOps/TetragonalLowOps.h index 52d1bd8..13436f5 100644 --- a/Source/EbsdLib/LaueOps/TetragonalLowOps.h +++ b/Source/EbsdLib/LaueOps/TetragonalLowOps.h @@ -152,9 +152,25 @@ class EbsdLib_EXPORT TetragonalLowOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/TetragonalOps.cpp b/Source/EbsdLib/LaueOps/TetragonalOps.cpp index 90bebcd..c80af4a 100644 --- a/Source/EbsdLib/LaueOps/TetragonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalOps.cpp @@ -244,11 +244,14 @@ QuatD TetragonalOps::getQuatSymOp(int32_t i) const return TetragonalHigh::QuatSym[i]; } -void TetragonalOps::getRodSymOp(int i, double* r) const +int32_t TetragonalOps::getNumRodriguesSymOps() const { - r[0] = TetragonalHigh::RodSym[i][0]; - r[1] = TetragonalHigh::RodSym[i][1]; - r[2] = TetragonalHigh::RodSym[i][2]; + return TetragonalHigh::RodSym.size(); +} + +RodriguesDType TetragonalOps::getRodSymOp(size_t i) const +{ + return TetragonalHigh::RodSym[i]; } ebsdlib::Matrix3X3D TetragonalOps::getMatSymOpD(int i) const @@ -295,7 +298,7 @@ void TetragonalOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType TetragonalOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(TetragonalHigh::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -305,7 +308,7 @@ RodriguesDType TetragonalOps::getMDFFZRod(const RodriguesDType& inRod) const { double FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0, FZw = 0.0; - RodriguesDType rod = _calcRodNearestOrigin(TetragonalHigh::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); diff --git a/Source/EbsdLib/LaueOps/TetragonalOps.h b/Source/EbsdLib/LaueOps/TetragonalOps.h index 9c378eb..c16e691 100644 --- a/Source/EbsdLib/LaueOps/TetragonalOps.h +++ b/Source/EbsdLib/LaueOps/TetragonalOps.h @@ -152,9 +152,25 @@ class EbsdLib_EXPORT TetragonalOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/TriclinicOps.cpp b/Source/EbsdLib/LaueOps/TriclinicOps.cpp index 5d6a9a4..7262a21 100644 --- a/Source/EbsdLib/LaueOps/TriclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/TriclinicOps.cpp @@ -206,11 +206,14 @@ QuatD TriclinicOps::getQuatSymOp(int32_t i) const return Triclinic::QuatSym[i]; } -void TriclinicOps::getRodSymOp(int i, double* r) const +int32_t TriclinicOps::getNumRodriguesSymOps() const { - r[0] = Triclinic::RodSym[i][0]; - r[1] = Triclinic::RodSym[i][1]; - r[2] = Triclinic::RodSym[i][2]; + return Triclinic::RodSym.size(); +} + +RodriguesDType TriclinicOps::getRodSymOp(size_t i) const +{ + return Triclinic::RodSym[i]; } ebsdlib::Matrix3X3D TriclinicOps::getMatSymOpD(int i) const @@ -256,7 +259,7 @@ void TriclinicOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType TriclinicOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(Triclinic::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -266,7 +269,7 @@ RodriguesDType TriclinicOps::getMDFFZRod(const RodriguesDType& inRod) const { throw ebsdlib::method_not_implemented("TriclinicOps::getMDFFZRod not implemented"); - RodriguesDType rod = LaueOps::_calcRodNearestOrigin(Triclinic::RodSym, inRod); + RodriguesDType rod = LaueOps::_calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); /// FIXME: Are we missing code for TriclinicOps MDF FZ Rodrigues calculation? diff --git a/Source/EbsdLib/LaueOps/TriclinicOps.h b/Source/EbsdLib/LaueOps/TriclinicOps.h index 6a52cfb..ef4f9bc 100644 --- a/Source/EbsdLib/LaueOps/TriclinicOps.h +++ b/Source/EbsdLib/LaueOps/TriclinicOps.h @@ -152,9 +152,25 @@ class EbsdLib_EXPORT TriclinicOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp index 75e333c..5fc432a 100644 --- a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp @@ -215,11 +215,14 @@ QuatD TrigonalLowOps::getQuatSymOp(int32_t i) const return TrigonalLow::QuatSym[i]; } -void TrigonalLowOps::getRodSymOp(int i, double* r) const +int32_t TrigonalLowOps::getNumRodriguesSymOps() const { - r[0] = TrigonalLow::RodSym[i][0]; - r[1] = TrigonalLow::RodSym[i][1]; - r[2] = TrigonalLow::RodSym[i][2]; + return TrigonalLow::RodSym.size(); +} + +RodriguesDType TrigonalLowOps::getRodSymOp(size_t i) const +{ + return TrigonalLow::RodSym[i]; } ebsdlib::Matrix3X3D TrigonalLowOps::getMatSymOpD(int i) const @@ -265,7 +268,7 @@ void TrigonalLowOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType TrigonalLowOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(TrigonalLow::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -276,7 +279,7 @@ RodriguesDType TrigonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const double FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0, FZw = 0.0; float n1n2mag = 0.0f; - RodriguesDType rod = _calcRodNearestOrigin(TrigonalLow::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); float denom = static_cast(std::sqrt(ax[0] * ax[0] + ax[1] * ax[1] + ax[2] * ax[2])); diff --git a/Source/EbsdLib/LaueOps/TrigonalLowOps.h b/Source/EbsdLib/LaueOps/TrigonalLowOps.h index 1839dd1..51753dc 100644 --- a/Source/EbsdLib/LaueOps/TrigonalLowOps.h +++ b/Source/EbsdLib/LaueOps/TrigonalLowOps.h @@ -153,9 +153,25 @@ class EbsdLib_EXPORT TrigonalLowOps : public LaueOps * @return Axis Angle Representation */ // ebsdlib::AxisAngleDType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index diff --git a/Source/EbsdLib/LaueOps/TrigonalOps.cpp b/Source/EbsdLib/LaueOps/TrigonalOps.cpp index 4409f5a..ae4d1f6 100644 --- a/Source/EbsdLib/LaueOps/TrigonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalOps.cpp @@ -231,11 +231,14 @@ QuatD TrigonalOps::getQuatSymOp(int32_t i) const return TrigonalHigh::QuatSym[i]; } -void TrigonalOps::getRodSymOp(int i, double* r) const +int32_t TrigonalOps::getNumRodriguesSymOps() const { - r[0] = TrigonalHigh::RodSym[i][0]; - r[1] = TrigonalHigh::RodSym[i][1]; - r[2] = TrigonalHigh::RodSym[i][2]; + return TrigonalHigh::RodSym.size(); +} + +RodriguesDType TrigonalOps::getRodSymOp(size_t i) const +{ + return TrigonalHigh::RodSym[i]; } ebsdlib::Matrix3X3D TrigonalOps::getMatSymOpD(int i) const @@ -281,7 +284,7 @@ void TrigonalOps::getMatSymOp(int i, float g[3][3]) const // ----------------------------------------------------------------------------- RodriguesDType TrigonalOps::getODFFZRod(const RodriguesDType& rod) const { - return _calcRodNearestOrigin(TrigonalHigh::RodSym, rod); + return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- @@ -293,7 +296,7 @@ RodriguesDType TrigonalOps::getMDFFZRod(const RodriguesDType& inRod) const double FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0, FZw = 0.0; double n1n2mag = 0.0f; - RodriguesDType rod = _calcRodNearestOrigin(TrigonalHigh::RodSym, inRod); + RodriguesDType rod = _calcRodNearestOrigin(inRod); AxisAngleDType ax = rod.toAxisAngle(); diff --git a/Source/EbsdLib/LaueOps/TrigonalOps.h b/Source/EbsdLib/LaueOps/TrigonalOps.h index e976dab..15061c2 100644 --- a/Source/EbsdLib/LaueOps/TrigonalOps.h +++ b/Source/EbsdLib/LaueOps/TrigonalOps.h @@ -152,9 +152,25 @@ class EbsdLib_EXPORT TrigonalOps : public LaueOps * @return Axis Angle Representation */ // AxisAngleFType calculateMisorientation(const QuatF& q1, const QuatF& q2) const override; - + /** + * @brief getQuatSymOp Returns the symmetry operator at index i + * @param i The index into the Symmetry operators array + * @return The quaternion symmetry operator + */ QuatD getQuatSymOp(int i) const override; - void getRodSymOp(int i, double* r) const override; + + /** + * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i + * @param i Index of the symmetry operator + * @param r Pointer to store the Rodrigues vector into. + */ + RodriguesDType getRodSymOp(size_t i) const override; + + /** + * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators + * @return + */ + int32_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index From 08cf743d061809b8aa79924f2622670e31584ce3 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Mon, 12 Jan 2026 17:42:58 -0500 Subject: [PATCH 2/5] Update some static constants to constexpr --- Source/EbsdLib/LaueOps/CubicLowOps.cpp | 20 ++++++++-------- Source/EbsdLib/LaueOps/CubicOps.cpp | 22 +++++++++--------- Source/EbsdLib/LaueOps/HexagonalLowOps.cpp | 24 ++++++++++---------- Source/EbsdLib/LaueOps/HexagonalOps.cpp | 24 ++++++++++---------- Source/EbsdLib/LaueOps/MonoclinicOps.cpp | 24 ++++++++++---------- Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp | 24 ++++++++++---------- Source/EbsdLib/LaueOps/TetragonalLowOps.cpp | 24 ++++++++++---------- Source/EbsdLib/LaueOps/TetragonalOps.cpp | 24 ++++++++++---------- Source/EbsdLib/LaueOps/TriclinicOps.cpp | 24 ++++++++++---------- Source/EbsdLib/LaueOps/TrigonalLowOps.cpp | 22 +++++++++--------- Source/EbsdLib/LaueOps/TrigonalOps.cpp | 24 ++++++++++---------- Source/EbsdLib/Utilities/CanvasUtilities.cpp | 2 +- 12 files changed, 129 insertions(+), 129 deletions(-) diff --git a/Source/EbsdLib/LaueOps/CubicLowOps.cpp b/Source/EbsdLib/LaueOps/CubicLowOps.cpp index c5a6965..eaffa39 100644 --- a/Source/EbsdLib/LaueOps/CubicLowOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicLowOps.cpp @@ -58,21 +58,21 @@ using namespace ebsdlib; namespace CubicLow { -static const std::array OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0))}; static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0]) / 2.0, OdfDimInitValue[1] / static_cast(OdfNumBins[1]) / 2.0, OdfDimInitValue[2] / static_cast(OdfNumBins[2]) / 2.0}; -static const int symSize0 = 6; -static const int symSize1 = 12; -static const int symSize2 = 8; +constexpr int symSize0 = 6; +constexpr int symSize1 = 12; +constexpr int symSize2 = 8; -static const int k_OdfSize = 46656; -static const int k_MdfSize = 46656; -static const int k_SymOpsCount = 12; -static const int k_NumMdfBins = 18; +constexpr int k_OdfSize = 46656; +constexpr int k_MdfSize = 46656; +constexpr int k_SymOpsCount = 12; +constexpr int k_NumMdfBins = 18; // Rotation Point Group: 23 /* clang-format off */ @@ -157,8 +157,8 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 90.0; } // namespace CubicLow // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/CubicOps.cpp b/Source/EbsdLib/LaueOps/CubicOps.cpp index 0f5fd9a..989636b 100644 --- a/Source/EbsdLib/LaueOps/CubicOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicOps.cpp @@ -62,7 +62,7 @@ using namespace ebsdlib; namespace CubicHigh { -static const std::array OdfNumBins = {18, 18, 18}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {18, 18, 18}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0)), std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0)), std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0))}; @@ -70,14 +70,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib: static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 6; -static const int symSize1 = 12; -static const int symSize2 = 8; +constexpr int symSize0 = 6; +constexpr int symSize1 = 12; +constexpr int symSize2 = 8; -static const int k_OdfSize = 5832; -static const int k_MdfSize = 5832; -static const int k_SymOpsCount = 24; -static const int k_NumMdfBins = 13; +constexpr int k_OdfSize = 5832; +constexpr int k_MdfSize = 5832; +constexpr int k_SymOpsCount = 24; +constexpr int k_NumMdfBins = 13; static const double SlipDirections[12][3] = {{0.0, 1.0, -1.0}, {1.0, 0.0, -1.0}, {1.0, -1.0, 0.0}, {1.0, -1.0, 0.0}, {1.0, 0.0, 1.0}, {0.0, 1.0, 1.0}, {1.0, 1.0, 0.0}, {0.0, 1.0, 1.0}, {1.0, 0.0, -1.0}, {1.0, 1.0, 0.0}, {1.0, 0.0, 1.0}, {0.0, 1.0, -1.0}}; @@ -240,8 +240,8 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 45.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 45.0; } // namespace CubicHigh @@ -2057,7 +2057,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp index 9602b85..ad65f32 100644 --- a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp @@ -57,7 +57,7 @@ using namespace ebsdlib; namespace HexagonalLow { -static const std::array OdfNumBins = {72, 72, 12}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {72, 72, 12}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), std::pow((0.75 * ((ebsdlib::constants::k_PiD / 6.0) - std::sin(ebsdlib::constants::k_PiD / 6.0))), (1.0 / 3.0))}; @@ -65,14 +65,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib: static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 2; -static const int symSize2 = 2; +constexpr int symSize0 = 2; +constexpr int symSize1 = 2; +constexpr int symSize2 = 2; -static const int k_OdfSize = 62208; -static const int k_MdfSize = 62208; -static const int k_SymOpsCount = 6; -static const int k_NumMdfBins = 36; +constexpr int k_OdfSize = 62208; +constexpr int k_MdfSize = 62208; +constexpr int k_SymOpsCount = 6; +constexpr int k_NumMdfBins = 36; static double sq32 = std::sqrt(3.0) / 2.0; @@ -124,9 +124,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 60.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 60.0; +constexpr double k_ChiMax = 90.0; } // namespace HexagonalLow // ----------------------------------------------------------------------------- @@ -1539,7 +1539,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/HexagonalOps.cpp b/Source/EbsdLib/LaueOps/HexagonalOps.cpp index 9605e0b..d47a5d3 100644 --- a/Source/EbsdLib/LaueOps/HexagonalOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalOps.cpp @@ -59,7 +59,7 @@ using namespace ebsdlib; namespace HexagonalHigh { -static const std::array OdfNumBins = {36, 36, 12}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {36, 36, 12}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * (((ebsdlib::constants::k_PiOver2D)) - std::sin(((ebsdlib::constants::k_PiOver2D))))), (1.0 / 3.0)), std::pow((0.75 * (((ebsdlib::constants::k_PiOver2D)) - std::sin(((ebsdlib::constants::k_PiOver2D))))), (1.0 / 3.0)), @@ -67,14 +67,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * (((ebsdli static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 6; -static const int symSize2 = 6; +constexpr int symSize0 = 2; +constexpr int symSize1 = 6; +constexpr int symSize2 = 6; -static const int k_OdfSize = 15552; -static const int k_MdfSize = 15552; -static const int k_SymOpsCount = 12; -static const int k_NumMdfBins = 20; +constexpr int k_OdfSize = 15552; +constexpr int k_MdfSize = 15552; +constexpr int k_SymOpsCount = 12; +constexpr int k_NumMdfBins = 20; static double sq32 = std::sqrt(3.0) / 2.0; // Rotation Point Group: 622 @@ -163,9 +163,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 30.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 30.0; +constexpr double k_ChiMax = 90.0; // Use a namespace for some detail that only this class needs } // namespace HexagonalHigh @@ -1594,7 +1594,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp index 8f55d6c..c3ef132 100644 --- a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp @@ -57,7 +57,7 @@ using namespace ebsdlib; namespace Monoclinic { -static const std::array OdfNumBins = {72, 36, 72}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {72, 36, 72}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.7f * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), @@ -65,14 +65,14 @@ static const std::array OdfDimInitValue = {std::pow((0.7f * ((ebsdlib static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0]) / 2.0, OdfDimInitValue[1] / static_cast(OdfNumBins[1]) / 2.0, OdfDimInitValue[2] / static_cast(OdfNumBins[2]) / 2.0}; -static const int symSize0 = 2; -static const int symSize1 = 2; -static const int symSize2 = 2; +constexpr int symSize0 = 2; +constexpr int symSize1 = 2; +constexpr int symSize2 = 2; -static const int k_OdfSize = 186624; -static const int k_MdfSize = 186624; -static const int k_SymOpsCount = 2; -static const int k_NumMdfBins = 36; +constexpr int k_OdfSize = 186624; +constexpr int k_MdfSize = 186624; +constexpr int k_SymOpsCount = 2; +constexpr int k_NumMdfBins = 36; // Rotation Point Group: 2 /* clang-format off */ static const std::vector QuatSym ={ @@ -97,9 +97,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 180.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 180.0; +constexpr double k_ChiMax = 90.0; } // namespace Monoclinic // ----------------------------------------------------------------------------- @@ -901,7 +901,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp index e9ec99a..45c6b16 100644 --- a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp +++ b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp @@ -58,7 +58,7 @@ using namespace ebsdlib; namespace OrthoRhombic { -static const std::array OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), @@ -66,14 +66,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 2; -static const int symSize2 = 2; +constexpr int symSize0 = 2; +constexpr int symSize1 = 2; +constexpr int symSize2 = 2; -static const int k_OdfSize = 46656; -static const int k_MdfSize = 46656; -static const int k_SymOpsCount = 4; -static const int k_NumMdfBins = 36; +constexpr int k_OdfSize = 46656; +constexpr int k_MdfSize = 46656; +constexpr int k_SymOpsCount = 4; +constexpr int k_NumMdfBins = 36; // Rotation Point Group: 222 /* clang-format off */ static const std::vector QuatSym ={ @@ -109,9 +109,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 90.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 90.0; +constexpr double k_ChiMax = 90.0; } // namespace OrthoRhombic // ----------------------------------------------------------------------------- @@ -913,7 +913,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp index 1a8ec00..a48d221 100644 --- a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp @@ -56,7 +56,7 @@ using namespace ebsdlib; namespace TetragonalLow { -static const std::array OdfNumBins = {72, 72, 18}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {72, 72, 18}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), @@ -64,14 +64,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 2; -static const int symSize2 = 2; +constexpr int symSize0 = 2; +constexpr int symSize1 = 2; +constexpr int symSize2 = 2; -static const int k_OdfSize = 93312; -static const int k_MdfSize = 93312; -static const int k_SymOpsCount = 4; -static const int k_NumMdfBins = 36; +constexpr int k_OdfSize = 93312; +constexpr int k_MdfSize = 93312; +constexpr int k_SymOpsCount = 4; +constexpr int k_NumMdfBins = 36; // Rotation Point Group: 4 /* clang-format off */ static const std::vector QuatSym ={ @@ -108,9 +108,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 90.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 90.0; +constexpr double k_ChiMax = 90.0; } // namespace TetragonalLow // ----------------------------------------------------------------------------- @@ -912,7 +912,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/TetragonalOps.cpp b/Source/EbsdLib/LaueOps/TetragonalOps.cpp index c80af4a..9c84e2d 100644 --- a/Source/EbsdLib/LaueOps/TetragonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalOps.cpp @@ -57,7 +57,7 @@ using namespace ebsdlib; namespace TetragonalHigh { -static const std::array OdfNumBins = {36, 36, 18}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {36, 36, 18}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), @@ -65,14 +65,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 4; -static const int symSize2 = 4; +constexpr int symSize0 = 2; +constexpr int symSize1 = 4; +constexpr int symSize2 = 4; -static const int k_OdfSize = 23328; -static const int k_MdfSize = 23328; -static const int k_SymOpsCount = 8; -static const int k_NumMdfBins = 20; +constexpr int k_OdfSize = 23328; +constexpr int k_MdfSize = 23328; +constexpr int k_SymOpsCount = 8; +constexpr int k_NumMdfBins = 20; // Rotation Point Group: 422 /* clang-format off */ @@ -133,9 +133,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 45.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 45.0; +constexpr double k_ChiMax = 90.0; } // namespace TetragonalHigh // ----------------------------------------------------------------------------- @@ -955,7 +955,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/TriclinicOps.cpp b/Source/EbsdLib/LaueOps/TriclinicOps.cpp index 7262a21..eaccbae 100644 --- a/Source/EbsdLib/LaueOps/TriclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/TriclinicOps.cpp @@ -59,7 +59,7 @@ using namespace ebsdlib; namespace Triclinic { -static const std::array OdfNumBins = {72, 72, 72}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {72, 72, 72}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), @@ -67,14 +67,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 2; -static const int symSize2 = 2; +constexpr int symSize0 = 2; +constexpr int symSize1 = 2; +constexpr int symSize2 = 2; -static const int k_OdfSize = 373248; -static const int k_MdfSize = 373248; -static const int k_SymOpsCount = 1; -static const int k_NumMdfBins = 36; +constexpr int k_OdfSize = 373248; +constexpr int k_MdfSize = 373248; +constexpr int k_SymOpsCount = 1; +constexpr int k_NumMdfBins = 36; // Rotation Point Group: 1 /* clang-format off */ static const std::vector QuatSym ={ @@ -93,9 +93,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = 0.0; -static const double k_EtaMax = 180.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = 0.0; +constexpr double k_EtaMax = 180.0; +constexpr double k_ChiMax = 90.0; } // namespace Triclinic @@ -894,7 +894,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp index 5fc432a..4becab9 100644 --- a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp @@ -58,7 +58,7 @@ using namespace ebsdlib; namespace TrigonalLow { -static const std::array OdfNumBins = {72, 72, 24}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {72, 72, 24}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), @@ -66,14 +66,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib: static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 2; -static const int symSize2 = 2; +constexpr int symSize0 = 2; +constexpr int symSize1 = 2; +constexpr int symSize2 = 2; -static const int k_OdfSize = 124416; -static const int k_MdfSize = 124416; -static const int k_SymOpsCount = 3; -static const int k_NumMdfBins = 12; +constexpr int k_OdfSize = 124416; +constexpr int k_MdfSize = 124416; +constexpr int k_SymOpsCount = 3; +constexpr int k_NumMdfBins = 12; static double sq32 = std::sqrt(3.0) / 2.0; @@ -106,9 +106,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = -120.0; -static const double k_EtaMax = 0.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = -120.0; +constexpr double k_EtaMax = 0.0; +constexpr double k_ChiMax = 90.0; } // namespace TrigonalLow // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TrigonalOps.cpp b/Source/EbsdLib/LaueOps/TrigonalOps.cpp index ae4d1f6..ff78a3e 100644 --- a/Source/EbsdLib/LaueOps/TrigonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalOps.cpp @@ -57,7 +57,7 @@ using namespace ebsdlib; namespace TrigonalHigh { -static const std::array OdfNumBins = {36, 36, 24}; // Represents a 5Deg bin +constexpr std::array OdfNumBins = {36, 36, 24}; // Represents a 5Deg bin static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), @@ -65,14 +65,14 @@ static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib: static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; -static const int symSize0 = 2; -static const int symSize1 = 2; -static const int symSize2 = 2; +constexpr int symSize0 = 2; +constexpr int symSize1 = 2; +constexpr int symSize2 = 2; -static const int k_OdfSize = 31104; -static const int k_MdfSize = 31104; -static const int k_SymOpsCount = 6; -static const int k_NumMdfBins = 12; +constexpr int k_OdfSize = 31104; +constexpr int k_MdfSize = 31104; +constexpr int k_SymOpsCount = 6; +constexpr int k_NumMdfBins = 12; static double sq32 = std::sqrt(3.0) / 2.0; // Rotation Point Group: 32 @@ -122,9 +122,9 @@ static const double MatSym[k_SymOpsCount][3][3] = { }; /* clang-format on */ -static const double k_EtaMin = -90.0; -static const double k_EtaMax = -30.0; -static const double k_ChiMax = 90.0; +constexpr double k_EtaMin = -90.0; +constexpr double k_EtaMax = -30.0; +constexpr double k_ChiMax = 90.0; } // namespace TrigonalHigh // ----------------------------------------------------------------------------- @@ -967,7 +967,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); diff --git a/Source/EbsdLib/Utilities/CanvasUtilities.cpp b/Source/EbsdLib/Utilities/CanvasUtilities.cpp index 5ef7f6d..772d1ed 100644 --- a/Source/EbsdLib/Utilities/CanvasUtilities.cpp +++ b/Source/EbsdLib/Utilities/CanvasUtilities.cpp @@ -291,7 +291,7 @@ ebsdlib::UInt8ArrayType::Pointer DrawStandardHexagonalProjection(ebsdlib::UInt8A { radius = 1.0F; float angle = angles[idx]; - float rads = angle * M_PI / 180.0f; + float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); float y = radius * (sin(rads)); From 59a634a920e774344a5bde20fe289917896efd71 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Mon, 12 Jan 2026 17:43:34 -0500 Subject: [PATCH 3/5] COMP: Remove legacy float[3][3] for MatSymOp functions --- Source/EbsdLib/LaueOps/CubicLowOps.cpp | 30 ++---------------- Source/EbsdLib/LaueOps/CubicLowOps.h | 6 ++-- Source/EbsdLib/LaueOps/CubicOps.cpp | 30 ++---------------- Source/EbsdLib/LaueOps/CubicOps.h | 6 ++-- Source/EbsdLib/LaueOps/HexagonalLowOps.cpp | 34 +++----------------- Source/EbsdLib/LaueOps/HexagonalLowOps.h | 6 ++-- Source/EbsdLib/LaueOps/HexagonalOps.cpp | 35 +++------------------ Source/EbsdLib/LaueOps/HexagonalOps.h | 6 ++-- Source/EbsdLib/LaueOps/LaueOps.h | 8 ++--- Source/EbsdLib/LaueOps/MonoclinicOps.cpp | 30 ++---------------- Source/EbsdLib/LaueOps/MonoclinicOps.h | 6 ++-- Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp | 30 ++---------------- Source/EbsdLib/LaueOps/OrthoRhombicOps.h | 6 ++-- Source/EbsdLib/LaueOps/TetragonalLowOps.cpp | 30 ++---------------- Source/EbsdLib/LaueOps/TetragonalLowOps.h | 6 ++-- Source/EbsdLib/LaueOps/TetragonalOps.cpp | 30 ++---------------- Source/EbsdLib/LaueOps/TetragonalOps.h | 6 ++-- Source/EbsdLib/LaueOps/TriclinicOps.cpp | 29 ++--------------- Source/EbsdLib/LaueOps/TriclinicOps.h | 6 ++-- Source/EbsdLib/LaueOps/TrigonalLowOps.cpp | 29 ++--------------- Source/EbsdLib/LaueOps/TrigonalLowOps.h | 6 ++-- Source/EbsdLib/LaueOps/TrigonalOps.cpp | 29 ++--------------- Source/EbsdLib/LaueOps/TrigonalOps.h | 6 ++-- 23 files changed, 52 insertions(+), 358 deletions(-) diff --git a/Source/EbsdLib/LaueOps/CubicLowOps.cpp b/Source/EbsdLib/LaueOps/CubicLowOps.cpp index eaffa39..ccdd5c0 100644 --- a/Source/EbsdLib/LaueOps/CubicLowOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicLowOps.cpp @@ -276,45 +276,19 @@ RodriguesDType CubicLowOps::getRodSymOp(size_t i) const return CubicLow::RodSym[i]; } -ebsdlib::Matrix3X3D CubicLowOps::getMatSymOpD(int i) const +Matrix3X3D CubicLowOps::getMatSymOpD(int i) const { return {CubicLow::MatSym[i][0][0], CubicLow::MatSym[i][0][1], CubicLow::MatSym[i][0][2], CubicLow::MatSym[i][1][0], CubicLow::MatSym[i][1][1], CubicLow::MatSym[i][1][2], CubicLow::MatSym[i][2][0], CubicLow::MatSym[i][2][1], CubicLow::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F CubicLowOps::getMatSymOpF(int i) const +Matrix3X3F CubicLowOps::getMatSymOpF(int i) const { return {static_cast(CubicLow::MatSym[i][0][0]), static_cast(CubicLow::MatSym[i][0][1]), static_cast(CubicLow::MatSym[i][0][2]), static_cast(CubicLow::MatSym[i][1][0]), static_cast(CubicLow::MatSym[i][1][1]), static_cast(CubicLow::MatSym[i][1][2]), static_cast(CubicLow::MatSym[i][2][0]), static_cast(CubicLow::MatSym[i][2][1]), static_cast(CubicLow::MatSym[i][2][2])}; } -void CubicLowOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = CubicLow::MatSym[i][0][0]; - g[0][1] = CubicLow::MatSym[i][0][1]; - g[0][2] = CubicLow::MatSym[i][0][2]; - g[1][0] = CubicLow::MatSym[i][1][0]; - g[1][1] = CubicLow::MatSym[i][1][1]; - g[1][2] = CubicLow::MatSym[i][1][2]; - g[2][0] = CubicLow::MatSym[i][2][0]; - g[2][1] = CubicLow::MatSym[i][2][1]; - g[2][2] = CubicLow::MatSym[i][2][2]; -} - -void CubicLowOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(CubicLow::MatSym[i][0][0]); - g[0][1] = static_cast(CubicLow::MatSym[i][0][1]); - g[0][2] = static_cast(CubicLow::MatSym[i][0][2]); - g[1][0] = static_cast(CubicLow::MatSym[i][1][0]); - g[1][1] = static_cast(CubicLow::MatSym[i][1][1]); - g[1][2] = static_cast(CubicLow::MatSym[i][1][2]); - g[2][0] = static_cast(CubicLow::MatSym[i][2][0]); - g[2][1] = static_cast(CubicLow::MatSym[i][2][1]); - g[2][2] = static_cast(CubicLow::MatSym[i][2][2]); -} - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/CubicLowOps.h b/Source/EbsdLib/LaueOps/CubicLowOps.h index bc37327..5d7a6a7 100644 --- a/Source/EbsdLib/LaueOps/CubicLowOps.h +++ b/Source/EbsdLib/LaueOps/CubicLowOps.h @@ -176,10 +176,8 @@ class EbsdLib_EXPORT CubicLowOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/CubicOps.cpp b/Source/EbsdLib/LaueOps/CubicOps.cpp index 989636b..8d19cf8 100644 --- a/Source/EbsdLib/LaueOps/CubicOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicOps.cpp @@ -619,45 +619,19 @@ RodriguesDType CubicOps::getRodSymOp(size_t i) const return CubicHigh::RodSym[i]; } -ebsdlib::Matrix3X3D CubicOps::getMatSymOpD(int i) const +Matrix3X3D CubicOps::getMatSymOpD(int i) const { return {CubicHigh::MatSym[i][0][0], CubicHigh::MatSym[i][0][1], CubicHigh::MatSym[i][0][2], CubicHigh::MatSym[i][1][0], CubicHigh::MatSym[i][1][1], CubicHigh::MatSym[i][1][2], CubicHigh::MatSym[i][2][0], CubicHigh::MatSym[i][2][1], CubicHigh::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F CubicOps::getMatSymOpF(int i) const +Matrix3X3F CubicOps::getMatSymOpF(int i) const { return {static_cast(CubicHigh::MatSym[i][0][0]), static_cast(CubicHigh::MatSym[i][0][1]), static_cast(CubicHigh::MatSym[i][0][2]), static_cast(CubicHigh::MatSym[i][1][0]), static_cast(CubicHigh::MatSym[i][1][1]), static_cast(CubicHigh::MatSym[i][1][2]), static_cast(CubicHigh::MatSym[i][2][0]), static_cast(CubicHigh::MatSym[i][2][1]), static_cast(CubicHigh::MatSym[i][2][2])}; } -void CubicOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = CubicHigh::MatSym[i][0][0]; - g[0][1] = CubicHigh::MatSym[i][0][1]; - g[0][2] = CubicHigh::MatSym[i][0][2]; - g[1][0] = CubicHigh::MatSym[i][1][0]; - g[1][1] = CubicHigh::MatSym[i][1][1]; - g[1][2] = CubicHigh::MatSym[i][1][2]; - g[2][0] = CubicHigh::MatSym[i][2][0]; - g[2][1] = CubicHigh::MatSym[i][2][1]; - g[2][2] = CubicHigh::MatSym[i][2][2]; -} - -void CubicOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(CubicHigh::MatSym[i][0][0]); - g[0][1] = static_cast(CubicHigh::MatSym[i][0][1]); - g[0][2] = static_cast(CubicHigh::MatSym[i][0][2]); - g[1][0] = static_cast(CubicHigh::MatSym[i][1][0]); - g[1][1] = static_cast(CubicHigh::MatSym[i][1][1]); - g[1][2] = static_cast(CubicHigh::MatSym[i][1][2]); - g[2][0] = static_cast(CubicHigh::MatSym[i][2][0]); - g[2][1] = static_cast(CubicHigh::MatSym[i][2][1]); - g[2][2] = static_cast(CubicHigh::MatSym[i][2][2]); -} - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/CubicOps.h b/Source/EbsdLib/LaueOps/CubicOps.h index d0e4008..f19c861 100644 --- a/Source/EbsdLib/LaueOps/CubicOps.h +++ b/Source/EbsdLib/LaueOps/CubicOps.h @@ -175,10 +175,8 @@ class EbsdLib_EXPORT CubicOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp index ad65f32..9999d73 100644 --- a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp @@ -243,45 +243,19 @@ RodriguesDType HexagonalLowOps::getRodSymOp(size_t i) const return HexagonalLow::RodSym[i]; } -ebsdlib::Matrix3X3D HexagonalLowOps::getMatSymOpD(int i) const +Matrix3X3D HexagonalLowOps::getMatSymOpD(int i) const { return {HexagonalLow::MatSym[i][0][0], HexagonalLow::MatSym[i][0][1], HexagonalLow::MatSym[i][0][2], HexagonalLow::MatSym[i][1][0], HexagonalLow::MatSym[i][1][1], HexagonalLow::MatSym[i][1][2], HexagonalLow::MatSym[i][2][0], HexagonalLow::MatSym[i][2][1], HexagonalLow::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F HexagonalLowOps::getMatSymOpF(int i) const +Matrix3X3F HexagonalLowOps::getMatSymOpF(int i) const { return {static_cast(HexagonalLow::MatSym[i][0][0]), static_cast(HexagonalLow::MatSym[i][0][1]), static_cast(HexagonalLow::MatSym[i][0][2]), static_cast(HexagonalLow::MatSym[i][1][0]), static_cast(HexagonalLow::MatSym[i][1][1]), static_cast(HexagonalLow::MatSym[i][1][2]), static_cast(HexagonalLow::MatSym[i][2][0]), static_cast(HexagonalLow::MatSym[i][2][1]), static_cast(HexagonalLow::MatSym[i][2][2])}; } -void HexagonalLowOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = HexagonalLow::MatSym[i][0][0]; - g[0][1] = HexagonalLow::MatSym[i][0][1]; - g[0][2] = HexagonalLow::MatSym[i][0][2]; - g[1][0] = HexagonalLow::MatSym[i][1][0]; - g[1][1] = HexagonalLow::MatSym[i][1][1]; - g[1][2] = HexagonalLow::MatSym[i][1][2]; - g[2][0] = HexagonalLow::MatSym[i][2][0]; - g[2][1] = HexagonalLow::MatSym[i][2][1]; - g[2][2] = HexagonalLow::MatSym[i][2][2]; -} - -void HexagonalLowOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(HexagonalLow::MatSym[i][0][0]); - g[0][1] = static_cast(HexagonalLow::MatSym[i][0][1]); - g[0][2] = static_cast(HexagonalLow::MatSym[i][0][2]); - g[1][0] = static_cast(HexagonalLow::MatSym[i][1][0]); - g[1][1] = static_cast(HexagonalLow::MatSym[i][1][1]); - g[1][2] = static_cast(HexagonalLow::MatSym[i][1][2]); - g[2][0] = static_cast(HexagonalLow::MatSym[i][2][0]); - g[2][1] = static_cast(HexagonalLow::MatSym[i][2][1]); - g[2][2] = static_cast(HexagonalLow::MatSym[i][2][2]); -} - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -837,7 +811,7 @@ double HexagonalLowOps::getmPrime(const QuatD& q1, const QuatD& q2, double LD[3] return 0.0; #if 0 /* I am asserting here because this code will simply give junk results and if someone uses it - * they could unknowningly get really bad results + * they could unknowingly get really bad results */ double g1[3][3]; double g2[3][3]; @@ -877,7 +851,7 @@ double HexagonalLowOps::getF1(const QuatD& q1, const QuatD& q2, double LD[3], bo return 0.0; #if 0 /* I am asserting here because this code will simply give junk results and if someone uses it - * they could unknowningly get really bad results + * they could unknowingly get really bad results */ double g1[3][3]; double g2[3][3]; diff --git a/Source/EbsdLib/LaueOps/HexagonalLowOps.h b/Source/EbsdLib/LaueOps/HexagonalLowOps.h index 87531f5..b81279f 100644 --- a/Source/EbsdLib/LaueOps/HexagonalLowOps.h +++ b/Source/EbsdLib/LaueOps/HexagonalLowOps.h @@ -176,10 +176,8 @@ class EbsdLib_EXPORT HexagonalLowOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/HexagonalOps.cpp b/Source/EbsdLib/LaueOps/HexagonalOps.cpp index d47a5d3..6314083 100644 --- a/Source/EbsdLib/LaueOps/HexagonalOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalOps.cpp @@ -288,44 +288,19 @@ RodriguesDType HexagonalOps::getRodSymOp(size_t i) const return HexagonalHigh::RodSym[i]; } -ebsdlib::Matrix3X3D HexagonalOps::getMatSymOpD(int i) const +Matrix3X3D HexagonalOps::getMatSymOpD(int i) const { return {HexagonalHigh::MatSym[i][0][0], HexagonalHigh::MatSym[i][0][1], HexagonalHigh::MatSym[i][0][2], HexagonalHigh::MatSym[i][1][0], HexagonalHigh::MatSym[i][1][1], HexagonalHigh::MatSym[i][1][2], HexagonalHigh::MatSym[i][2][0], HexagonalHigh::MatSym[i][2][1], HexagonalHigh::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F HexagonalOps::getMatSymOpF(int i) const +Matrix3X3F HexagonalOps::getMatSymOpF(int i) const { return {static_cast(HexagonalHigh::MatSym[i][0][0]), static_cast(HexagonalHigh::MatSym[i][0][1]), static_cast(HexagonalHigh::MatSym[i][0][2]), static_cast(HexagonalHigh::MatSym[i][1][0]), static_cast(HexagonalHigh::MatSym[i][1][1]), static_cast(HexagonalHigh::MatSym[i][1][2]), static_cast(HexagonalHigh::MatSym[i][2][0]), static_cast(HexagonalHigh::MatSym[i][2][1]), static_cast(HexagonalHigh::MatSym[i][2][2])}; } -void HexagonalOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = HexagonalHigh::MatSym[i][0][0]; - g[0][1] = HexagonalHigh::MatSym[i][0][1]; - g[0][2] = HexagonalHigh::MatSym[i][0][2]; - g[1][0] = HexagonalHigh::MatSym[i][1][0]; - g[1][1] = HexagonalHigh::MatSym[i][1][1]; - g[1][2] = HexagonalHigh::MatSym[i][1][2]; - g[2][0] = HexagonalHigh::MatSym[i][2][0]; - g[2][1] = HexagonalHigh::MatSym[i][2][1]; - g[2][2] = HexagonalHigh::MatSym[i][2][2]; -} - -void HexagonalOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(HexagonalHigh::MatSym[i][0][0]); - g[0][1] = static_cast(HexagonalHigh::MatSym[i][0][1]); - g[0][2] = static_cast(HexagonalHigh::MatSym[i][0][2]); - g[1][0] = static_cast(HexagonalHigh::MatSym[i][1][0]); - g[1][1] = static_cast(HexagonalHigh::MatSym[i][1][1]); - g[1][2] = static_cast(HexagonalHigh::MatSym[i][1][2]); - g[2][0] = static_cast(HexagonalHigh::MatSym[i][2][0]); - g[2][1] = static_cast(HexagonalHigh::MatSym[i][2][1]); - g[2][2] = static_cast(HexagonalHigh::MatSym[i][2][2]); -} // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -883,7 +858,7 @@ double HexagonalOps::getmPrime(const QuatD& q1, const QuatD& q2, double LD[3]) c return 0.0; #if 0 /* I am asserting here because this code will simply give junk results and if someone uses it - * they could unknowningly get really bad results + * they could unknowingly get really bad results */ double g1[3][3]; double g2[3][3]; @@ -922,7 +897,7 @@ double HexagonalOps::getF1(const QuatD& q1, const QuatD& q2, double LD[3], bool return 0.0; #if 0 /* I am asserting here because this code will simply give junk results and if someone uses it - * they could unknowningly get really bad results + * they could unknowingly get really bad results */ double g1[3][3]; double g2[3][3]; @@ -1378,7 +1353,7 @@ std::vector HexagonalOps::generatePoleFigure(P generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); diff --git a/Source/EbsdLib/LaueOps/HexagonalOps.h b/Source/EbsdLib/LaueOps/HexagonalOps.h index 196ab71..65ca4b1 100644 --- a/Source/EbsdLib/LaueOps/HexagonalOps.h +++ b/Source/EbsdLib/LaueOps/HexagonalOps.h @@ -176,10 +176,8 @@ class EbsdLib_EXPORT HexagonalOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/LaueOps.h b/Source/EbsdLib/LaueOps/LaueOps.h index 7bef0e2..9616607 100644 --- a/Source/EbsdLib/LaueOps/LaueOps.h +++ b/Source/EbsdLib/LaueOps/LaueOps.h @@ -167,7 +167,7 @@ class EbsdLib_EXPORT LaueOps * @param q2 Input Quaternion * @return Axis Angle Representation */ - virtual ebsdlib::AxisAngleDType calculateMisorientation(const QuatD& q1, const QuatD& q2) const = 0; + virtual AxisAngleDType calculateMisorientation(const QuatD& q1, const QuatD& q2) const = 0; /** * @brief calculateMisorientation Finds the misorientation between 2 quaternions and returns the result as an Axis Angle value @@ -197,10 +197,8 @@ class EbsdLib_EXPORT LaueOps * @param g The g matrix * @return void or a Matrix3X3 object. */ - virtual void getMatSymOp(int i, double g[3][3]) const = 0; - virtual void getMatSymOp(int i, float g[3][3]) const = 0; - virtual ebsdlib::Matrix3X3F getMatSymOpF(int i) const = 0; - virtual ebsdlib::Matrix3X3D getMatSymOpD(int i) const = 0; + virtual Matrix3X3F getMatSymOpF(int i) const = 0; + virtual Matrix3X3D getMatSymOpD(int i) const = 0; /** * @brief getODFFZRod diff --git a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp index c3ef132..a61ec4e 100644 --- a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp @@ -219,45 +219,19 @@ RodriguesDType MonoclinicOps::getRodSymOp(size_t i) const return Monoclinic::RodSym[i]; } -ebsdlib::Matrix3X3D MonoclinicOps::getMatSymOpD(int i) const +Matrix3X3D MonoclinicOps::getMatSymOpD(int i) const { return {Monoclinic::MatSym[i][0][0], Monoclinic::MatSym[i][0][1], Monoclinic::MatSym[i][0][2], Monoclinic::MatSym[i][1][0], Monoclinic::MatSym[i][1][1], Monoclinic::MatSym[i][1][2], Monoclinic::MatSym[i][2][0], Monoclinic::MatSym[i][2][1], Monoclinic::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F MonoclinicOps::getMatSymOpF(int i) const +Matrix3X3F MonoclinicOps::getMatSymOpF(int i) const { return {static_cast(Monoclinic::MatSym[i][0][0]), static_cast(Monoclinic::MatSym[i][0][1]), static_cast(Monoclinic::MatSym[i][0][2]), static_cast(Monoclinic::MatSym[i][1][0]), static_cast(Monoclinic::MatSym[i][1][1]), static_cast(Monoclinic::MatSym[i][1][2]), static_cast(Monoclinic::MatSym[i][2][0]), static_cast(Monoclinic::MatSym[i][2][1]), static_cast(Monoclinic::MatSym[i][2][2])}; } -void MonoclinicOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = Monoclinic::MatSym[i][0][0]; - g[0][1] = Monoclinic::MatSym[i][0][1]; - g[0][2] = Monoclinic::MatSym[i][0][2]; - g[1][0] = Monoclinic::MatSym[i][1][0]; - g[1][1] = Monoclinic::MatSym[i][1][1]; - g[1][2] = Monoclinic::MatSym[i][1][2]; - g[2][0] = Monoclinic::MatSym[i][2][0]; - g[2][1] = Monoclinic::MatSym[i][2][1]; - g[2][2] = Monoclinic::MatSym[i][2][2]; -} - -void MonoclinicOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(Monoclinic::MatSym[i][0][0]); - g[0][1] = static_cast(Monoclinic::MatSym[i][0][1]); - g[0][2] = static_cast(Monoclinic::MatSym[i][0][2]); - g[1][0] = static_cast(Monoclinic::MatSym[i][1][0]); - g[1][1] = static_cast(Monoclinic::MatSym[i][1][1]); - g[1][2] = static_cast(Monoclinic::MatSym[i][1][2]); - g[2][0] = static_cast(Monoclinic::MatSym[i][2][0]); - g[2][1] = static_cast(Monoclinic::MatSym[i][2][1]); - g[2][2] = static_cast(Monoclinic::MatSym[i][2][2]); -} - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/MonoclinicOps.h b/Source/EbsdLib/LaueOps/MonoclinicOps.h index cd7a18c..89a0b4d 100644 --- a/Source/EbsdLib/LaueOps/MonoclinicOps.h +++ b/Source/EbsdLib/LaueOps/MonoclinicOps.h @@ -175,10 +175,8 @@ class EbsdLib_EXPORT MonoclinicOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp index 45c6b16..a516d38 100644 --- a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp +++ b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp @@ -228,45 +228,19 @@ RodriguesDType OrthoRhombicOps::getRodSymOp(size_t i) const return OrthoRhombic::RodSym[i]; } -ebsdlib::Matrix3X3D OrthoRhombicOps::getMatSymOpD(int i) const +Matrix3X3D OrthoRhombicOps::getMatSymOpD(int i) const { return {OrthoRhombic::MatSym[i][0][0], OrthoRhombic::MatSym[i][0][1], OrthoRhombic::MatSym[i][0][2], OrthoRhombic::MatSym[i][1][0], OrthoRhombic::MatSym[i][1][1], OrthoRhombic::MatSym[i][1][2], OrthoRhombic::MatSym[i][2][0], OrthoRhombic::MatSym[i][2][1], OrthoRhombic::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F OrthoRhombicOps::getMatSymOpF(int i) const +Matrix3X3F OrthoRhombicOps::getMatSymOpF(int i) const { return {static_cast(OrthoRhombic::MatSym[i][0][0]), static_cast(OrthoRhombic::MatSym[i][0][1]), static_cast(OrthoRhombic::MatSym[i][0][2]), static_cast(OrthoRhombic::MatSym[i][1][0]), static_cast(OrthoRhombic::MatSym[i][1][1]), static_cast(OrthoRhombic::MatSym[i][1][2]), static_cast(OrthoRhombic::MatSym[i][2][0]), static_cast(OrthoRhombic::MatSym[i][2][1]), static_cast(OrthoRhombic::MatSym[i][2][2])}; } -void OrthoRhombicOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = OrthoRhombic::MatSym[i][0][0]; - g[0][1] = OrthoRhombic::MatSym[i][0][1]; - g[0][2] = OrthoRhombic::MatSym[i][0][2]; - g[1][0] = OrthoRhombic::MatSym[i][1][0]; - g[1][1] = OrthoRhombic::MatSym[i][1][1]; - g[1][2] = OrthoRhombic::MatSym[i][1][2]; - g[2][0] = OrthoRhombic::MatSym[i][2][0]; - g[2][1] = OrthoRhombic::MatSym[i][2][1]; - g[2][2] = OrthoRhombic::MatSym[i][2][2]; -} - -void OrthoRhombicOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(OrthoRhombic::MatSym[i][0][0]); - g[0][1] = static_cast(OrthoRhombic::MatSym[i][0][1]); - g[0][2] = static_cast(OrthoRhombic::MatSym[i][0][2]); - g[1][0] = static_cast(OrthoRhombic::MatSym[i][1][0]); - g[1][1] = static_cast(OrthoRhombic::MatSym[i][1][1]); - g[1][2] = static_cast(OrthoRhombic::MatSym[i][1][2]); - g[2][0] = static_cast(OrthoRhombic::MatSym[i][2][0]); - g[2][1] = static_cast(OrthoRhombic::MatSym[i][2][1]); - g[2][2] = static_cast(OrthoRhombic::MatSym[i][2][2]); -} - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/OrthoRhombicOps.h b/Source/EbsdLib/LaueOps/OrthoRhombicOps.h index 1b3b333..26c727c 100644 --- a/Source/EbsdLib/LaueOps/OrthoRhombicOps.h +++ b/Source/EbsdLib/LaueOps/OrthoRhombicOps.h @@ -177,10 +177,8 @@ class EbsdLib_EXPORT OrthoRhombicOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp index a48d221..015f1df 100644 --- a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp @@ -227,45 +227,19 @@ RodriguesDType TetragonalLowOps::getRodSymOp(size_t i) const return TetragonalLow::RodSym[i]; } -ebsdlib::Matrix3X3D TetragonalLowOps::getMatSymOpD(int i) const +Matrix3X3D TetragonalLowOps::getMatSymOpD(int i) const { return {TetragonalLow::MatSym[i][0][0], TetragonalLow::MatSym[i][0][1], TetragonalLow::MatSym[i][0][2], TetragonalLow::MatSym[i][1][0], TetragonalLow::MatSym[i][1][1], TetragonalLow::MatSym[i][1][2], TetragonalLow::MatSym[i][2][0], TetragonalLow::MatSym[i][2][1], TetragonalLow::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F TetragonalLowOps::getMatSymOpF(int i) const +Matrix3X3F TetragonalLowOps::getMatSymOpF(int i) const { return {static_cast(TetragonalLow::MatSym[i][0][0]), static_cast(TetragonalLow::MatSym[i][0][1]), static_cast(TetragonalLow::MatSym[i][0][2]), static_cast(TetragonalLow::MatSym[i][1][0]), static_cast(TetragonalLow::MatSym[i][1][1]), static_cast(TetragonalLow::MatSym[i][1][2]), static_cast(TetragonalLow::MatSym[i][2][0]), static_cast(TetragonalLow::MatSym[i][2][1]), static_cast(TetragonalLow::MatSym[i][2][2])}; } -void TetragonalLowOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = TetragonalLow::MatSym[i][0][0]; - g[0][1] = TetragonalLow::MatSym[i][0][1]; - g[0][2] = TetragonalLow::MatSym[i][0][2]; - g[1][0] = TetragonalLow::MatSym[i][1][0]; - g[1][1] = TetragonalLow::MatSym[i][1][1]; - g[1][2] = TetragonalLow::MatSym[i][1][2]; - g[2][0] = TetragonalLow::MatSym[i][2][0]; - g[2][1] = TetragonalLow::MatSym[i][2][1]; - g[2][2] = TetragonalLow::MatSym[i][2][2]; -} - -void TetragonalLowOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(TetragonalLow::MatSym[i][0][0]); - g[0][1] = static_cast(TetragonalLow::MatSym[i][0][1]); - g[0][2] = static_cast(TetragonalLow::MatSym[i][0][2]); - g[1][0] = static_cast(TetragonalLow::MatSym[i][1][0]); - g[1][1] = static_cast(TetragonalLow::MatSym[i][1][1]); - g[1][2] = static_cast(TetragonalLow::MatSym[i][1][2]); - g[2][0] = static_cast(TetragonalLow::MatSym[i][2][0]); - g[2][1] = static_cast(TetragonalLow::MatSym[i][2][1]); - g[2][2] = static_cast(TetragonalLow::MatSym[i][2][2]); -} - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TetragonalLowOps.h b/Source/EbsdLib/LaueOps/TetragonalLowOps.h index 13436f5..7289460 100644 --- a/Source/EbsdLib/LaueOps/TetragonalLowOps.h +++ b/Source/EbsdLib/LaueOps/TetragonalLowOps.h @@ -177,10 +177,8 @@ class EbsdLib_EXPORT TetragonalLowOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TetragonalOps.cpp b/Source/EbsdLib/LaueOps/TetragonalOps.cpp index 9c84e2d..8f8f93c 100644 --- a/Source/EbsdLib/LaueOps/TetragonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalOps.cpp @@ -254,45 +254,19 @@ RodriguesDType TetragonalOps::getRodSymOp(size_t i) const return TetragonalHigh::RodSym[i]; } -ebsdlib::Matrix3X3D TetragonalOps::getMatSymOpD(int i) const +Matrix3X3D TetragonalOps::getMatSymOpD(int i) const { return {TetragonalHigh::MatSym[i][0][0], TetragonalHigh::MatSym[i][0][1], TetragonalHigh::MatSym[i][0][2], TetragonalHigh::MatSym[i][1][0], TetragonalHigh::MatSym[i][1][1], TetragonalHigh::MatSym[i][1][2], TetragonalHigh::MatSym[i][2][0], TetragonalHigh::MatSym[i][2][1], TetragonalHigh::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F TetragonalOps::getMatSymOpF(int i) const +Matrix3X3F TetragonalOps::getMatSymOpF(int i) const { return {static_cast(TetragonalHigh::MatSym[i][0][0]), static_cast(TetragonalHigh::MatSym[i][0][1]), static_cast(TetragonalHigh::MatSym[i][0][2]), static_cast(TetragonalHigh::MatSym[i][1][0]), static_cast(TetragonalHigh::MatSym[i][1][1]), static_cast(TetragonalHigh::MatSym[i][1][2]), static_cast(TetragonalHigh::MatSym[i][2][0]), static_cast(TetragonalHigh::MatSym[i][2][1]), static_cast(TetragonalHigh::MatSym[i][2][2])}; } -void TetragonalOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = TetragonalHigh::MatSym[i][0][0]; - g[0][1] = TetragonalHigh::MatSym[i][0][1]; - g[0][2] = TetragonalHigh::MatSym[i][0][2]; - g[1][0] = TetragonalHigh::MatSym[i][1][0]; - g[1][1] = TetragonalHigh::MatSym[i][1][1]; - g[1][2] = TetragonalHigh::MatSym[i][1][2]; - g[2][0] = TetragonalHigh::MatSym[i][2][0]; - g[2][1] = TetragonalHigh::MatSym[i][2][1]; - g[2][2] = TetragonalHigh::MatSym[i][2][2]; -} - -void TetragonalOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(TetragonalHigh::MatSym[i][0][0]); - g[0][1] = static_cast(TetragonalHigh::MatSym[i][0][1]); - g[0][2] = static_cast(TetragonalHigh::MatSym[i][0][2]); - g[1][0] = static_cast(TetragonalHigh::MatSym[i][1][0]); - g[1][1] = static_cast(TetragonalHigh::MatSym[i][1][1]); - g[1][2] = static_cast(TetragonalHigh::MatSym[i][1][2]); - g[2][0] = static_cast(TetragonalHigh::MatSym[i][2][0]); - g[2][1] = static_cast(TetragonalHigh::MatSym[i][2][1]); - g[2][2] = static_cast(TetragonalHigh::MatSym[i][2][2]); -} - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TetragonalOps.h b/Source/EbsdLib/LaueOps/TetragonalOps.h index c16e691..de56c03 100644 --- a/Source/EbsdLib/LaueOps/TetragonalOps.h +++ b/Source/EbsdLib/LaueOps/TetragonalOps.h @@ -177,10 +177,8 @@ class EbsdLib_EXPORT TetragonalOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TriclinicOps.cpp b/Source/EbsdLib/LaueOps/TriclinicOps.cpp index eaccbae..e85d8de 100644 --- a/Source/EbsdLib/LaueOps/TriclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/TriclinicOps.cpp @@ -216,44 +216,19 @@ RodriguesDType TriclinicOps::getRodSymOp(size_t i) const return Triclinic::RodSym[i]; } -ebsdlib::Matrix3X3D TriclinicOps::getMatSymOpD(int i) const +Matrix3X3D TriclinicOps::getMatSymOpD(int i) const { return {Triclinic::MatSym[i][0][0], Triclinic::MatSym[i][0][1], Triclinic::MatSym[i][0][2], Triclinic::MatSym[i][1][0], Triclinic::MatSym[i][1][1], Triclinic::MatSym[i][1][2], Triclinic::MatSym[i][2][0], Triclinic::MatSym[i][2][1], Triclinic::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F TriclinicOps::getMatSymOpF(int i) const +Matrix3X3F TriclinicOps::getMatSymOpF(int i) const { return {static_cast(Triclinic::MatSym[i][0][0]), static_cast(Triclinic::MatSym[i][0][1]), static_cast(Triclinic::MatSym[i][0][2]), static_cast(Triclinic::MatSym[i][1][0]), static_cast(Triclinic::MatSym[i][1][1]), static_cast(Triclinic::MatSym[i][1][2]), static_cast(Triclinic::MatSym[i][2][0]), static_cast(Triclinic::MatSym[i][2][1]), static_cast(Triclinic::MatSym[i][2][2])}; } -void TriclinicOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = Triclinic::MatSym[i][0][0]; - g[0][1] = Triclinic::MatSym[i][0][1]; - g[0][2] = Triclinic::MatSym[i][0][2]; - g[1][0] = Triclinic::MatSym[i][1][0]; - g[1][1] = Triclinic::MatSym[i][1][1]; - g[1][2] = Triclinic::MatSym[i][1][2]; - g[2][0] = Triclinic::MatSym[i][2][0]; - g[2][1] = Triclinic::MatSym[i][2][1]; - g[2][2] = Triclinic::MatSym[i][2][2]; -} - -void TriclinicOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(Triclinic::MatSym[i][0][0]); - g[0][1] = static_cast(Triclinic::MatSym[i][0][1]); - g[0][2] = static_cast(Triclinic::MatSym[i][0][2]); - g[1][0] = static_cast(Triclinic::MatSym[i][1][0]); - g[1][1] = static_cast(Triclinic::MatSym[i][1][1]); - g[1][2] = static_cast(Triclinic::MatSym[i][1][2]); - g[2][0] = static_cast(Triclinic::MatSym[i][2][0]); - g[2][1] = static_cast(Triclinic::MatSym[i][2][1]); - g[2][2] = static_cast(Triclinic::MatSym[i][2][2]); -} // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TriclinicOps.h b/Source/EbsdLib/LaueOps/TriclinicOps.h index ef4f9bc..bf5c729 100644 --- a/Source/EbsdLib/LaueOps/TriclinicOps.h +++ b/Source/EbsdLib/LaueOps/TriclinicOps.h @@ -177,10 +177,8 @@ class EbsdLib_EXPORT TriclinicOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp index 4becab9..9a77dfa 100644 --- a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp @@ -225,44 +225,19 @@ RodriguesDType TrigonalLowOps::getRodSymOp(size_t i) const return TrigonalLow::RodSym[i]; } -ebsdlib::Matrix3X3D TrigonalLowOps::getMatSymOpD(int i) const +Matrix3X3D TrigonalLowOps::getMatSymOpD(int i) const { return {TrigonalLow::MatSym[i][0][0], TrigonalLow::MatSym[i][0][1], TrigonalLow::MatSym[i][0][2], TrigonalLow::MatSym[i][1][0], TrigonalLow::MatSym[i][1][1], TrigonalLow::MatSym[i][1][2], TrigonalLow::MatSym[i][2][0], TrigonalLow::MatSym[i][2][1], TrigonalLow::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F TrigonalLowOps::getMatSymOpF(int i) const +Matrix3X3F TrigonalLowOps::getMatSymOpF(int i) const { return {static_cast(TrigonalLow::MatSym[i][0][0]), static_cast(TrigonalLow::MatSym[i][0][1]), static_cast(TrigonalLow::MatSym[i][0][2]), static_cast(TrigonalLow::MatSym[i][1][0]), static_cast(TrigonalLow::MatSym[i][1][1]), static_cast(TrigonalLow::MatSym[i][1][2]), static_cast(TrigonalLow::MatSym[i][2][0]), static_cast(TrigonalLow::MatSym[i][2][1]), static_cast(TrigonalLow::MatSym[i][2][2])}; } -void TrigonalLowOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = TrigonalLow::MatSym[i][0][0]; - g[0][1] = TrigonalLow::MatSym[i][0][1]; - g[0][2] = TrigonalLow::MatSym[i][0][2]; - g[1][0] = TrigonalLow::MatSym[i][1][0]; - g[1][1] = TrigonalLow::MatSym[i][1][1]; - g[1][2] = TrigonalLow::MatSym[i][1][2]; - g[2][0] = TrigonalLow::MatSym[i][2][0]; - g[2][1] = TrigonalLow::MatSym[i][2][1]; - g[2][2] = TrigonalLow::MatSym[i][2][2]; -} - -void TrigonalLowOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(TrigonalLow::MatSym[i][0][0]); - g[0][1] = static_cast(TrigonalLow::MatSym[i][0][1]); - g[0][2] = static_cast(TrigonalLow::MatSym[i][0][2]); - g[1][0] = static_cast(TrigonalLow::MatSym[i][1][0]); - g[1][1] = static_cast(TrigonalLow::MatSym[i][1][1]); - g[1][2] = static_cast(TrigonalLow::MatSym[i][1][2]); - g[2][0] = static_cast(TrigonalLow::MatSym[i][2][0]); - g[2][1] = static_cast(TrigonalLow::MatSym[i][2][1]); - g[2][2] = static_cast(TrigonalLow::MatSym[i][2][2]); -} // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TrigonalLowOps.h b/Source/EbsdLib/LaueOps/TrigonalLowOps.h index 51753dc..1d3bb8e 100644 --- a/Source/EbsdLib/LaueOps/TrigonalLowOps.h +++ b/Source/EbsdLib/LaueOps/TrigonalLowOps.h @@ -178,10 +178,8 @@ class EbsdLib_EXPORT TrigonalLowOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TrigonalOps.cpp b/Source/EbsdLib/LaueOps/TrigonalOps.cpp index ff78a3e..1d6ba77 100644 --- a/Source/EbsdLib/LaueOps/TrigonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalOps.cpp @@ -241,44 +241,19 @@ RodriguesDType TrigonalOps::getRodSymOp(size_t i) const return TrigonalHigh::RodSym[i]; } -ebsdlib::Matrix3X3D TrigonalOps::getMatSymOpD(int i) const +Matrix3X3D TrigonalOps::getMatSymOpD(int i) const { return {TrigonalHigh::MatSym[i][0][0], TrigonalHigh::MatSym[i][0][1], TrigonalHigh::MatSym[i][0][2], TrigonalHigh::MatSym[i][1][0], TrigonalHigh::MatSym[i][1][1], TrigonalHigh::MatSym[i][1][2], TrigonalHigh::MatSym[i][2][0], TrigonalHigh::MatSym[i][2][1], TrigonalHigh::MatSym[i][2][2]}; } -ebsdlib::Matrix3X3F TrigonalOps::getMatSymOpF(int i) const +Matrix3X3F TrigonalOps::getMatSymOpF(int i) const { return {static_cast(TrigonalHigh::MatSym[i][0][0]), static_cast(TrigonalHigh::MatSym[i][0][1]), static_cast(TrigonalHigh::MatSym[i][0][2]), static_cast(TrigonalHigh::MatSym[i][1][0]), static_cast(TrigonalHigh::MatSym[i][1][1]), static_cast(TrigonalHigh::MatSym[i][1][2]), static_cast(TrigonalHigh::MatSym[i][2][0]), static_cast(TrigonalHigh::MatSym[i][2][1]), static_cast(TrigonalHigh::MatSym[i][2][2])}; } -void TrigonalOps::getMatSymOp(int i, double g[3][3]) const -{ - g[0][0] = TrigonalHigh::MatSym[i][0][0]; - g[0][1] = TrigonalHigh::MatSym[i][0][1]; - g[0][2] = TrigonalHigh::MatSym[i][0][2]; - g[1][0] = TrigonalHigh::MatSym[i][1][0]; - g[1][1] = TrigonalHigh::MatSym[i][1][1]; - g[1][2] = TrigonalHigh::MatSym[i][1][2]; - g[2][0] = TrigonalHigh::MatSym[i][2][0]; - g[2][1] = TrigonalHigh::MatSym[i][2][1]; - g[2][2] = TrigonalHigh::MatSym[i][2][2]; -} - -void TrigonalOps::getMatSymOp(int i, float g[3][3]) const -{ - g[0][0] = static_cast(TrigonalHigh::MatSym[i][0][0]); - g[0][1] = static_cast(TrigonalHigh::MatSym[i][0][1]); - g[0][2] = static_cast(TrigonalHigh::MatSym[i][0][2]); - g[1][0] = static_cast(TrigonalHigh::MatSym[i][1][0]); - g[1][1] = static_cast(TrigonalHigh::MatSym[i][1][1]); - g[1][2] = static_cast(TrigonalHigh::MatSym[i][1][2]); - g[2][0] = static_cast(TrigonalHigh::MatSym[i][2][0]); - g[2][1] = static_cast(TrigonalHigh::MatSym[i][2][1]); - g[2][2] = static_cast(TrigonalHigh::MatSym[i][2][2]); -} // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TrigonalOps.h b/Source/EbsdLib/LaueOps/TrigonalOps.h index 15061c2..facc605 100644 --- a/Source/EbsdLib/LaueOps/TrigonalOps.h +++ b/Source/EbsdLib/LaueOps/TrigonalOps.h @@ -177,10 +177,8 @@ class EbsdLib_EXPORT TrigonalOps : public LaueOps * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - void getMatSymOp(int i, double g[3][3]) const override; - void getMatSymOp(int i, float g[3][3]) const override; - ebsdlib::Matrix3X3F getMatSymOpF(int i) const override; - ebsdlib::Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(int i) const override; + Matrix3X3D getMatSymOpD(int i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; From 45b363c98c14ee53c75e9bedd291fe6c3929a36b Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Tue, 13 Jan 2026 11:24:52 -0500 Subject: [PATCH 4/5] ENH: Update more functions, static constants, formatting and other bits --- Source/Apps/gen_sym_code.cpp | 12 +- Source/Apps/make_ipf.cpp | 10 +- Source/EbsdLib/Core/EbsdDataArray.cpp | 2 - Source/EbsdLib/Core/EbsdSetGetMacros.h | 4 - Source/EbsdLib/Core/EbsdTransform.cpp | 4 - Source/EbsdLib/Core/OrientationMath.cpp | 16 - .../Core/OrientationTransformation.hpp | 2 - Source/EbsdLib/IO/AngleFileLoader.cpp | 6 - Source/EbsdLib/IO/BrukerNano/EspritPhase.cpp | 14 - .../EbsdLib/IO/BrukerNano/H5EspritFields.cpp | 6 - .../EbsdLib/IO/BrukerNano/H5EspritReader.cpp | 24 - Source/EbsdLib/IO/EbsdReader.cpp | 6 - Source/EbsdLib/IO/H5EbsdVolumeInfo.cpp | 40 -- Source/EbsdLib/IO/H5EbsdVolumeReader.cpp | 22 - Source/EbsdLib/IO/HKL/CtfFields.cpp | 6 - Source/EbsdLib/IO/HKL/CtfPhase.cpp | 14 - Source/EbsdLib/IO/HKL/CtfReader.cpp | 42 -- Source/EbsdLib/IO/HKL/DataParser.hpp | 4 - Source/EbsdLib/IO/HKL/H5CtfImporter.cpp | 20 - Source/EbsdLib/IO/HKL/H5CtfReader.cpp | 16 - Source/EbsdLib/IO/HKL/H5CtfVolumeReader.cpp | 16 - Source/EbsdLib/IO/HKL/H5OINAReader.cpp | 14 - Source/EbsdLib/IO/TSL/AngFields.cpp | 6 - Source/EbsdLib/IO/TSL/AngPhase.cpp | 36 -- Source/EbsdLib/IO/TSL/AngReader.cpp | 22 - Source/EbsdLib/IO/TSL/H5AngImporter.cpp | 18 - Source/EbsdLib/IO/TSL/H5AngReader.cpp | 18 - Source/EbsdLib/IO/TSL/H5AngVolumeReader.cpp | 16 - Source/EbsdLib/IO/TSL/H5OIMReader.cpp | 20 - Source/EbsdLib/LaueOps/CubicLowOps.cpp | 349 +++++----- Source/EbsdLib/LaueOps/CubicLowOps.h | 16 +- Source/EbsdLib/LaueOps/CubicOps.cpp | 612 ++++++++---------- Source/EbsdLib/LaueOps/CubicOps.h | 16 +- Source/EbsdLib/LaueOps/HexagonalLowOps.cpp | 315 ++++----- Source/EbsdLib/LaueOps/HexagonalLowOps.h | 16 +- Source/EbsdLib/LaueOps/HexagonalOps.cpp | 396 +++++------- Source/EbsdLib/LaueOps/HexagonalOps.h | 16 +- Source/EbsdLib/LaueOps/LaueOps.cpp | 20 +- Source/EbsdLib/LaueOps/LaueOps.h | 38 +- Source/EbsdLib/LaueOps/MonoclinicOps.cpp | 269 ++++---- Source/EbsdLib/LaueOps/MonoclinicOps.h | 16 +- Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp | 291 ++++----- Source/EbsdLib/LaueOps/OrthoRhombicOps.h | 16 +- Source/EbsdLib/LaueOps/SO3Sampler.cpp | 4 - Source/EbsdLib/LaueOps/TetragonalLowOps.cpp | 294 ++++----- Source/EbsdLib/LaueOps/TetragonalLowOps.h | 16 +- Source/EbsdLib/LaueOps/TetragonalOps.cpp | 342 +++++----- Source/EbsdLib/LaueOps/TetragonalOps.h | 16 +- Source/EbsdLib/LaueOps/TriclinicOps.cpp | 259 +++----- Source/EbsdLib/LaueOps/TriclinicOps.h | 16 +- Source/EbsdLib/LaueOps/TrigonalLowOps.cpp | 280 ++++---- Source/EbsdLib/LaueOps/TrigonalLowOps.h | 16 +- Source/EbsdLib/LaueOps/TrigonalOps.cpp | 315 ++++----- Source/EbsdLib/LaueOps/TrigonalOps.h | 16 +- Source/EbsdLib/Math/EbsdLibRandom.cpp | 8 - Source/EbsdLib/Math/Matrix3X1.hpp | 10 +- Source/EbsdLib/Math/SourceList.cmake | 4 - .../Math/{ => deprecated}/EbsdMatrixMath.cpp | 6 - .../Math/{ => deprecated}/EbsdMatrixMath.h | 2 + .../Math/{ => deprecated}/GeometryMath.cpp | 0 .../Math/{ => deprecated}/GeometryMath.h | 2 + Source/EbsdLib/Orientation/Quaternion.hpp | 4 +- Source/EbsdLib/Texture/TexturePreset.cpp | 8 - Source/EbsdLib/Utilities/CanvasUtilities.cpp | 4 +- Source/EbsdLib/Utilities/ColorTable.cpp | 6 - Source/EbsdLib/Utilities/ColorUtilities.cpp | 10 - .../ComputeStereographicProjection.cpp | 6 - .../ComputeStereographicProjection.h | 2 +- Source/EbsdLib/Utilities/LambertUtilities.cpp | 6 - .../Utilities/ModifiedLambertProjection.cpp | 34 - .../ModifiedLambertProjectionArray.cpp | 80 --- Source/EbsdLib/Utilities/PoleFigureData.cpp | 8 - .../EbsdLib/Utilities/PoleFigureUtilities.cpp | 22 +- Source/EbsdLib/Utilities/ToolTipGenerator.cpp | 22 - Source/Test/AngleFileLoaderTest.cpp | 2 - Source/Test/CtfReaderTest.cpp | 8 - Source/Test/Not_Used/TestPrintFunctions.h | 18 - Source/Test/QuaternionTest.cpp | 7 +- Source/Test/UnitTestSupport.hpp | 16 - cmake/cmpVersion.cpp.in | 18 - 80 files changed, 1741 insertions(+), 2968 deletions(-) rename Source/EbsdLib/Math/{ => deprecated}/EbsdMatrixMath.cpp (91%) rename Source/EbsdLib/Math/{ => deprecated}/EbsdMatrixMath.h (99%) rename Source/EbsdLib/Math/{ => deprecated}/GeometryMath.cpp (100%) rename Source/EbsdLib/Math/{ => deprecated}/GeometryMath.h (99%) diff --git a/Source/Apps/gen_sym_code.cpp b/Source/Apps/gen_sym_code.cpp index 4851c7c..189b618 100644 --- a/Source/Apps/gen_sym_code.cpp +++ b/Source/Apps/gen_sym_code.cpp @@ -158,9 +158,9 @@ void Print3x3(const OrientationMatrixDType& m) std::cout << std::fixed; std::cout << std::setprecision(16); size_t i = 0; - std::cout << " {{" << m[i++] << ", " << m[i++] << ", " << m[i++] << "},\n"; - std::cout << " {" << m[i++] << ", " << m[i++] << ", " << m[i++] << "},\n"; - std::cout << " {" << m[i++] << ", " << m[i++] << ", " << m[i++] << "}},\n"; + std::cout << " {" << m[i++] << ", " << m[i++] << ", " << m[i++] << ",\n"; + std::cout << " " << m[i++] << ", " << m[i++] << ", " << m[i++] << ",\n"; + std::cout << " " << m[i++] << ", " << m[i++] << ", " << m[i++] << "},\n"; } void PrintQuat(const QuatD& q, bool sv) @@ -208,7 +208,7 @@ int main(int argc, char* argv[]) std::cout << std::setprecision(8); std::cout << "/* clang-format off */\n"; - std::cout << "static const std::vector QuatSym ={\n"; + std::cout << "static const std::vector k_QuatSym ={\n"; for(const auto& symOp : symOPs) { PrintQuat(symOp, false); @@ -216,7 +216,7 @@ int main(int argc, char* argv[]) } std::cout << "};\n\n"; - std::cout << "static const std::vector RodSym = {\n"; + std::cout << "static const std::vector k_RodSym = {\n"; for(const auto& symOp : symOPs) { auto ro = QuaternionDType(symOp).toRodrigues(); @@ -225,7 +225,7 @@ int main(int argc, char* argv[]) } std::cout << "};\n\n"; - std::cout << "static const double MatSym[k_SymOpsCount][3][3] = {\n"; + std::cout << "static const std::vector k_MatSym = {\n"; for(const auto& symOp : symOPs) { auto om = QuaternionDType(symOp).toOrientationMatrix(); diff --git a/Source/Apps/make_ipf.cpp b/Source/Apps/make_ipf.cpp index ed39943..c856c6e 100644 --- a/Source/Apps/make_ipf.cpp +++ b/Source/Apps/make_ipf.cpp @@ -9,7 +9,6 @@ #include "EbsdLib/IO/TSL/AngPhase.h" #include "EbsdLib/IO/TSL/AngReader.h" #include "EbsdLib/LaueOps/LaueOps.h" -#include "EbsdLib/Math/EbsdMatrixMath.h" #include "EbsdLib/Utilities/ColorTable.h" #include "EbsdLib/Utilities/TiffWriter.h" @@ -26,7 +25,7 @@ using namespace ebsdlib; class GenerateIPFColorsImpl { public: - GenerateIPFColorsImpl(FloatVec3Type& referenceDir, const std::vector& eulers, int32_t* phases, std::vector& crystalStructures, bool* goodVoxels, uint8_t* colors) + GenerateIPFColorsImpl(Matrix3X1F& referenceDir, const std::vector& eulers, int32_t* phases, std::vector& crystalStructures, bool* goodVoxels, uint8_t* colors) : m_ReferenceDir(referenceDir) , m_CellEulerAngles(eulers) , m_CellPhases(phases) @@ -96,7 +95,7 @@ class GenerateIPFColorsImpl } private: - FloatVec3Type m_ReferenceDir; + Matrix3X1F m_ReferenceDir; const std::vector& m_CellEulerAngles; int32_t* m_CellPhases; std::vector m_PhaseInfos; @@ -119,7 +118,7 @@ class Ang2IPF Ang2IPF& operator=(const Ang2IPF&) = delete; // Copy Assignment Not Implemented Ang2IPF& operator=(Ang2IPF&&) = delete; // Move Assignment Not Implemented - std::array m_ReferenceDir = {0.0F, 0.0F, 1.0F}; + Matrix3X1F m_ReferenceDir = {0.0f, 0.0f, 1.0f}; /** * @brief incrementPhaseWarningCount @@ -152,8 +151,7 @@ class Ang2IPF // int32_t numPhase = static_cast(crystalStructures.size()); // Make sure we are dealing with a unit 1 vector. - std::array normRefDir = m_ReferenceDir; // Make a copy of the reference Direction - ebsdlib::EbsdMatrixMath::Normalize3x1(normRefDir[0], normRefDir[1], normRefDir[2]); + Matrix3X1F normRefDir = m_ReferenceDir.normalize(); // Make a copy of the reference Direction and normalize it float* phi1Ptr = reader.getPhi1Pointer(false); float* phiPtr = reader.getPhiPointer(false); diff --git a/Source/EbsdLib/Core/EbsdDataArray.cpp b/Source/EbsdLib/Core/EbsdDataArray.cpp index 3a44e90..7a5485f 100644 --- a/Source/EbsdLib/Core/EbsdDataArray.cpp +++ b/Source/EbsdLib/Core/EbsdDataArray.cpp @@ -1530,8 +1530,6 @@ T* EbsdDataArray::resizeAndExtend(size_t size) return m_Array; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- #if !defined(__APPLE__) && !defined(_MSC_VER) #undef EbsdLib_EXPORT diff --git a/Source/EbsdLib/Core/EbsdSetGetMacros.h b/Source/EbsdLib/Core/EbsdSetGetMacros.h index 2a80424..f2561da 100644 --- a/Source/EbsdLib/Core/EbsdSetGetMacros.h +++ b/Source/EbsdLib/Core/EbsdSetGetMacros.h @@ -337,8 +337,6 @@ private: public: \ virtual EBSD_SET_STRING_PROPERTY(prpty, m_##prpty) virtual EBSD_GET_STRING_PROPERTY(prpty, m_##prpty) -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- /** * @brief Creates a "setter" method to set the property. @@ -422,8 +420,6 @@ public: } \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- // These are simple over-rides from the boost distribution because we don't want the entire boost distribution just // for a few boost headers diff --git a/Source/EbsdLib/Core/EbsdTransform.cpp b/Source/EbsdLib/Core/EbsdTransform.cpp index c10802e..5712c09 100644 --- a/Source/EbsdLib/Core/EbsdTransform.cpp +++ b/Source/EbsdLib/Core/EbsdTransform.cpp @@ -35,8 +35,6 @@ #include "EbsdTransform.h" -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EbsdTransform::EbsdTransform() @@ -75,8 +73,6 @@ ebsdlib::EbsdToSampleCoordinateMapping EbsdTransform::IdentifyStandardTransforma return ebsdlib::UnknownCoordinateMapping; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EbsdTransform::~EbsdTransform() = default; diff --git a/Source/EbsdLib/Core/OrientationMath.cpp b/Source/EbsdLib/Core/OrientationMath.cpp index 463116e..af7597b 100644 --- a/Source/EbsdLib/Core/OrientationMath.cpp +++ b/Source/EbsdLib/Core/OrientationMath.cpp @@ -38,18 +38,12 @@ #include using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- OrientationMath::OrientationMath() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- OrientationMath::~OrientationMath() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void OrientationMath::MetricTensorFromLatticeParameters(float a, float b, float c, float alpha, float beta, float gamma, float mt[3][3]) { @@ -64,8 +58,6 @@ void OrientationMath::MetricTensorFromLatticeParameters(float a, float b, float mt[2][2] = c * c; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void OrientationMath::RootTensorFromLatticeParameters(float a, float b, float c, float alpha, float beta, float gamma, float rt[3][3]) { @@ -80,8 +72,6 @@ void OrientationMath::RootTensorFromLatticeParameters(float a, float b, float c, rt[2][2] = c; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void OrientationMath::MillerBravaisToMillerDirection(const int32_t millerBravais[4], int32_t miller[3]) { @@ -90,8 +80,6 @@ void OrientationMath::MillerBravaisToMillerDirection(const int32_t millerBravais miller[2] = millerBravais[3]; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- void OrientationMath::MillerToMillerBravaisDirection(const int32_t miller[3], int32_t millerBravais[4]) { millerBravais[0] = static_cast(0.33333f * (2 * miller[0] - miller[1])); @@ -100,8 +88,6 @@ void OrientationMath::MillerToMillerBravaisDirection(const int32_t miller[3], in millerBravais[3] = miller[2]; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- void OrientationMath::MillerBravaisToMillerPlane(const int32_t millerBravais[4], int32_t miller[3]) { miller[0] = millerBravais[0]; @@ -109,8 +95,6 @@ void OrientationMath::MillerBravaisToMillerPlane(const int32_t millerBravais[4], miller[2] = millerBravais[3]; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- void OrientationMath::MillerToMillerBravaisPlane(const int32_t miller[3], int32_t millerBravais[4]) { millerBravais[0] = miller[0]; diff --git a/Source/EbsdLib/Core/OrientationTransformation.hpp b/Source/EbsdLib/Core/OrientationTransformation.hpp index db50bfc..220a6c1 100644 --- a/Source/EbsdLib/Core/OrientationTransformation.hpp +++ b/Source/EbsdLib/Core/OrientationTransformation.hpp @@ -493,8 +493,6 @@ ResultType st_check(const InputType& st) return res; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_OM(const T& om) diff --git a/Source/EbsdLib/IO/AngleFileLoader.cpp b/Source/EbsdLib/IO/AngleFileLoader.cpp index 866987e..b8d6c95 100644 --- a/Source/EbsdLib/IO/AngleFileLoader.cpp +++ b/Source/EbsdLib/IO/AngleFileLoader.cpp @@ -52,8 +52,6 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AngleFileLoader::AngleFileLoader() : m_ErrorMessage("") @@ -63,13 +61,9 @@ AngleFileLoader::AngleFileLoader() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AngleFileLoader::~AngleFileLoader() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::FloatArrayType::Pointer AngleFileLoader::loadData() { diff --git a/Source/EbsdLib/IO/BrukerNano/EspritPhase.cpp b/Source/EbsdLib/IO/BrukerNano/EspritPhase.cpp index 39cb254..84bcb1e 100644 --- a/Source/EbsdLib/IO/BrukerNano/EspritPhase.cpp +++ b/Source/EbsdLib/IO/BrukerNano/EspritPhase.cpp @@ -36,29 +36,21 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EspritPhase::EspritPhase() : m_PhaseIndex(-1) { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EspritPhase::~EspritPhase() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string EspritPhase::getMaterialName() { return m_Name; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- unsigned int EspritPhase::determineOrientationOpsIndex() { @@ -118,8 +110,6 @@ unsigned int EspritPhase::determineOrientationOpsIndex() return ebsdlib::CrystalStructure::UnknownCrystalStructure; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void EspritPhase::parseFormula(std::vector& tokens) { @@ -130,8 +120,6 @@ void EspritPhase::parseFormula(std::vector& tokens) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void EspritPhase::parseName(std::vector& tokens) { @@ -142,8 +130,6 @@ void EspritPhase::parseName(std::vector& tokens) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void EspritPhase::parseSpaceGroup(std::vector& tokens) { diff --git a/Source/EbsdLib/IO/BrukerNano/H5EspritFields.cpp b/Source/EbsdLib/IO/BrukerNano/H5EspritFields.cpp index de37fc2..63867fb 100644 --- a/Source/EbsdLib/IO/BrukerNano/H5EspritFields.cpp +++ b/Source/EbsdLib/IO/BrukerNano/H5EspritFields.cpp @@ -36,18 +36,12 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5EspritFields::H5EspritFields() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5EspritFields::~H5EspritFields() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector H5EspritFields::getFieldNames() { diff --git a/Source/EbsdLib/IO/BrukerNano/H5EspritReader.cpp b/Source/EbsdLib/IO/BrukerNano/H5EspritReader.cpp index 77028f7..e8b17cf 100644 --- a/Source/EbsdLib/IO/BrukerNano/H5EspritReader.cpp +++ b/Source/EbsdLib/IO/BrukerNano/H5EspritReader.cpp @@ -275,8 +275,6 @@ int H5EspritReader::readFile() return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EspritReader::readHeaderOnly() { @@ -335,8 +333,6 @@ int H5EspritReader::readHeaderOnly() return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EspritReader::readScanNames(std::list& names) { @@ -368,8 +364,6 @@ int H5EspritReader::readScanNames(std::list& names) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EspritReader::readHeader(hid_t parId) { @@ -507,8 +501,6 @@ int H5EspritReader::readHeader(hid_t parId) return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EspritReader::readData(hid_t parId) { @@ -616,8 +608,6 @@ int H5EspritReader::readData(hid_t parId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EspritReader::setArraysToRead(const std::set& names) { @@ -625,40 +615,30 @@ void H5EspritReader::setArraysToRead(const std::set& names) m_ReadAllArrays = m_ArrayNames.empty(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EspritReader::readAllArrays(bool b) { m_ReadAllArrays = b; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EspritReader::getXDimension() { return getNumColumns(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EspritReader::setXDimension(int xdim) { setNumColumns(xdim); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EspritReader::getYDimension() { return getNumRows(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EspritReader::setYDimension(int ydim) { @@ -755,8 +735,6 @@ void H5EspritReader::releaseOwnership(const std::string& name) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void* H5EspritReader::getPointerByName(const std::string& featureName) { @@ -832,8 +810,6 @@ void* H5EspritReader::getPointerByName(const std::string& featureName) return nullptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::NumericTypes::Type H5EspritReader::getPointerType(const std::string& featureName) { diff --git a/Source/EbsdLib/IO/EbsdReader.cpp b/Source/EbsdLib/IO/EbsdReader.cpp index ff5af5c..5f981ac 100644 --- a/Source/EbsdLib/IO/EbsdReader.cpp +++ b/Source/EbsdLib/IO/EbsdReader.cpp @@ -37,8 +37,6 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EbsdReader::EbsdReader() : m_ErrorCode(0) @@ -55,13 +53,9 @@ EbsdReader::EbsdReader() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EbsdReader::~EbsdReader() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void EbsdReader::appendOriginalHeader(const std::string& more) { diff --git a/Source/EbsdLib/IO/H5EbsdVolumeInfo.cpp b/Source/EbsdLib/IO/H5EbsdVolumeInfo.cpp index 129d4d1..06ba956 100644 --- a/Source/EbsdLib/IO/H5EbsdVolumeInfo.cpp +++ b/Source/EbsdLib/IO/H5EbsdVolumeInfo.cpp @@ -84,8 +84,6 @@ using namespace H5Support; using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5EbsdVolumeInfo::H5EbsdVolumeInfo() : m_ErrorCode(0) @@ -93,13 +91,9 @@ H5EbsdVolumeInfo::H5EbsdVolumeInfo() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5EbsdVolumeInfo::~H5EbsdVolumeInfo() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EbsdVolumeInfo::invalidateCache() { @@ -116,8 +110,6 @@ void H5EbsdVolumeInfo::invalidateCache() m_Manufacturer = ""; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::updateToLatestVersion() { @@ -138,8 +130,6 @@ int H5EbsdVolumeInfo::updateToLatestVersion() return 0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::readVolumeInfo() { @@ -265,8 +255,6 @@ int H5EbsdVolumeInfo::readVolumeInfo() return retErr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- uint32_t H5EbsdVolumeInfo::getFileVersion() { @@ -282,8 +270,6 @@ uint32_t H5EbsdVolumeInfo::getFileVersion() return m_FileVersion; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::getDimsAndResolution(int64_t& xDim, int64_t& yDim, int64_t& zDim, float& xRes, float& yRes, float& zRes) { @@ -309,8 +295,6 @@ int H5EbsdVolumeInfo::getDimsAndResolution(int64_t& xDim, int64_t& yDim, int64_t return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::getDims(int64_t& xDim, int64_t& yDim, int64_t& zDim) { @@ -333,8 +317,6 @@ int H5EbsdVolumeInfo::getDims(int64_t& xDim, int64_t& yDim, int64_t& zDim) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::getSpacing(float& xRes, float& yRes, float& zRes) { @@ -357,8 +339,6 @@ int H5EbsdVolumeInfo::getSpacing(float& xRes, float& yRes, float& zRes) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string H5EbsdVolumeInfo::getManufacturer() { @@ -374,8 +354,6 @@ std::string H5EbsdVolumeInfo::getManufacturer() return m_Manufacturer; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::getNumSlices() { @@ -391,8 +369,6 @@ int H5EbsdVolumeInfo::getNumSlices() return m_ZDim; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::getZStart() { @@ -408,8 +384,6 @@ int H5EbsdVolumeInfo::getZStart() return m_ZStart; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::getZEnd() { @@ -425,8 +399,6 @@ int H5EbsdVolumeInfo::getZEnd() return m_ZEnd; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeInfo::getNumPhases() { @@ -442,8 +414,6 @@ int H5EbsdVolumeInfo::getNumPhases() return m_NumPhases; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- uint32_t H5EbsdVolumeInfo::getStackingOrder() { @@ -459,8 +429,6 @@ uint32_t H5EbsdVolumeInfo::getStackingOrder() return m_StackingOrder; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- float H5EbsdVolumeInfo::getSampleTransformationAngle() { @@ -476,8 +444,6 @@ float H5EbsdVolumeInfo::getSampleTransformationAngle() return m_SampleTransformationAngle; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array H5EbsdVolumeInfo::getSampleTransformationAxis() { @@ -494,8 +460,6 @@ std::array H5EbsdVolumeInfo::getSampleTransformationAxis() return m_SampleTransformationAxis; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- float H5EbsdVolumeInfo::getEulerTransformationAngle() { int err = -1; @@ -510,8 +474,6 @@ float H5EbsdVolumeInfo::getEulerTransformationAngle() return m_EulerTransformationAngle; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- std::array H5EbsdVolumeInfo::getEulerTransformationAxis() { int err = -1; @@ -527,8 +489,6 @@ std::array H5EbsdVolumeInfo::getEulerTransformationAxis() return m_EulerTransformationAxis; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::set H5EbsdVolumeInfo::getDataArrayNames() { diff --git a/Source/EbsdLib/IO/H5EbsdVolumeReader.cpp b/Source/EbsdLib/IO/H5EbsdVolumeReader.cpp index 2a28fb3..6e825db 100644 --- a/Source/EbsdLib/IO/H5EbsdVolumeReader.cpp +++ b/Source/EbsdLib/IO/H5EbsdVolumeReader.cpp @@ -37,8 +37,6 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5EbsdVolumeReader::H5EbsdVolumeReader() : m_Cancel(false) @@ -50,43 +48,31 @@ H5EbsdVolumeReader::H5EbsdVolumeReader() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5EbsdVolumeReader::~H5EbsdVolumeReader() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EbsdVolumeReader::initPointers(size_t numElements) { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EbsdVolumeReader::deletePointers() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void* H5EbsdVolumeReader::getPointerByName(const std::string& featureName) { return nullptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::NumericTypes::Type H5EbsdVolumeReader::getPointerType(const std::string& featureName) { return ebsdlib::NumericTypes::Type::UnknownNumType; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5EbsdVolumeReader::loadData(int64_t xpoints, int64_t ypoints, int64_t zpoints, uint32_t ZDir) { @@ -94,32 +80,24 @@ int H5EbsdVolumeReader::loadData(int64_t xpoints, int64_t ypoints, int64_t zpoin return -1; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EbsdVolumeReader::setArraysToRead(std::set names) { m_ArrayNames = names; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::set H5EbsdVolumeReader::getArraysToRead() { return m_ArrayNames; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool H5EbsdVolumeReader::getReadAllArrays() { return m_ReadAllArrays; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5EbsdVolumeReader::readAllArrays(bool b) { diff --git a/Source/EbsdLib/IO/HKL/CtfFields.cpp b/Source/EbsdLib/IO/HKL/CtfFields.cpp index b041caf..4c9f8e9 100644 --- a/Source/EbsdLib/IO/HKL/CtfFields.cpp +++ b/Source/EbsdLib/IO/HKL/CtfFields.cpp @@ -36,18 +36,12 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CtfFields::CtfFields() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CtfFields::~CtfFields() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector CtfFields::getFieldNames() { diff --git a/Source/EbsdLib/IO/HKL/CtfPhase.cpp b/Source/EbsdLib/IO/HKL/CtfPhase.cpp index 193ab81..79f4182 100644 --- a/Source/EbsdLib/IO/HKL/CtfPhase.cpp +++ b/Source/EbsdLib/IO/HKL/CtfPhase.cpp @@ -40,8 +40,6 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CtfPhase::CtfPhase() : m_PhaseIndex(-1) @@ -51,13 +49,9 @@ CtfPhase::CtfPhase() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CtfPhase::~CtfPhase() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CtfPhase::convertEuropeanDecimals(std::string& line) { @@ -71,8 +65,6 @@ void CtfPhase::convertEuropeanDecimals(std::string& line) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CtfPhase::parsePhase(const std::string& line) { @@ -113,8 +105,6 @@ void CtfPhase::parsePhase(const std::string& line) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CtfPhase::printSelf(std::ostream& stream) { @@ -128,8 +118,6 @@ void CtfPhase::printSelf(std::ostream& stream) stream << ebsdlib::Ctf::Comment << " " << m_Comment << std::endl; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- unsigned int CtfPhase::determineOrientationOpsIndex() { @@ -167,8 +155,6 @@ unsigned int CtfPhase::determineOrientationOpsIndex() return ebsdlib::CrystalStructure::UnknownCrystalStructure; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string CtfPhase::getMaterialName() { diff --git a/Source/EbsdLib/IO/HKL/CtfReader.cpp b/Source/EbsdLib/IO/HKL/CtfReader.cpp index d4ecb8c..c95626a 100644 --- a/Source/EbsdLib/IO/HKL/CtfReader.cpp +++ b/Source/EbsdLib/IO/HKL/CtfReader.cpp @@ -91,8 +91,6 @@ std::istream& safeGetline(std::istream& is, std::string& t) } // namespace -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CtfReader::CtfReader() { @@ -125,8 +123,6 @@ CtfReader::CtfReader() setZCells(1); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CtfReader::~CtfReader() = default; @@ -153,8 +149,6 @@ CtfReader::~CtfReader() = default; // } //} -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void* CtfReader::getPointerByName(const std::string& featureName) { @@ -166,8 +160,6 @@ void* CtfReader::getPointerByName(const std::string& featureName) return ptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::NumericTypes::Type CtfReader::getPointerType(const std::string& featureName) { @@ -240,8 +232,6 @@ ebsdlib::NumericTypes::Type CtfReader::getPointerType(const std::string& feature return ebsdlib::NumericTypes::Type::UnknownNumType; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::getTypeSize(const std::string& featureName) { @@ -312,8 +302,6 @@ int CtfReader::getTypeSize(const std::string& featureName) return 0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- DataParser::Pointer CtfReader::getParser(const std::string& featureName, void* ptr, size_t size) { @@ -385,8 +373,6 @@ DataParser::Pointer CtfReader::getParser(const std::string& featureName, void* p return DataParser::NullPointer(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::readHeaderOnly() { @@ -413,8 +399,6 @@ int CtfReader::readHeaderOnly() return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::readFile() { @@ -465,16 +449,12 @@ int CtfReader::readFile() return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CtfReader::readOnlySliceIndex(int slice) { m_SingleSliceRead = slice; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::readData(std::ifstream& in) { @@ -643,8 +623,6 @@ int CtfReader::readData(std::ifstream& in) #define PRINT_HTML_TABLE_ROW(p) #endif -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::parseHeaderLines(std::vector& headerLines) { @@ -806,8 +784,6 @@ int CtfReader::parseDataLine(std::string& line, size_t row, size_t col, size_t o #if 0 // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- std::vector CtfReader::tokenize(char* buf, char delimiter) { std::vector output; @@ -829,8 +805,6 @@ std::vector CtfReader::tokenize(char* buf, char delimiter) } #endif -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::getHeaderLines(std::ifstream& reader, std::vector& headerLines) { @@ -866,8 +840,6 @@ int CtfReader::getHeaderLines(std::ifstream& reader, std::vector& h return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool CtfReader::isDataHeaderLine(const std::vector& columns) const { @@ -887,32 +859,24 @@ bool CtfReader::isDataHeaderLine(const std::vector& columns) const return true; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::getXDimension() { return getXCells(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CtfReader::setXDimension(int xdim) { setXCells(xdim); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::getYDimension() { return getYCells(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CtfReader::setYDimension(int ydim) { @@ -928,8 +892,6 @@ void CtfReader::setYDimension(int ydim) /* Copy the values back into the array over writing the original values*/ \ ::memcpy(var, tempPtr, numRows * sizeof(m_msgType)); -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector CtfReader::getColumnNames() { @@ -947,8 +909,6 @@ std::vector CtfReader::getColumnNames() #define CTF_PRINT_HEADER_VALUE(var, out) out << #var << ": " << get##var() << std::endl; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CtfReader::printHeader(std::ostream& out) { @@ -982,8 +942,6 @@ void CtfReader::printHeader(std::ostream& out) std::cout << "----------------------------------------" << std::endl; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CtfReader::writeFile(const std::string& filepath) { diff --git a/Source/EbsdLib/IO/HKL/DataParser.hpp b/Source/EbsdLib/IO/HKL/DataParser.hpp index a304f90..4402993 100644 --- a/Source/EbsdLib/IO/HKL/DataParser.hpp +++ b/Source/EbsdLib/IO/HKL/DataParser.hpp @@ -121,8 +121,6 @@ class DataParser DataParser& operator=(DataParser&&) = delete; // Move Assignment Not Implemented }; // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- class UInt8Parser : public DataParser { public: @@ -231,8 +229,6 @@ class UInt8Parser : public DataParser UInt8Parser& operator=(UInt8Parser&&) = delete; // Move Assignment Not Implemented }; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- class Int32Parser : public DataParser { diff --git a/Source/EbsdLib/IO/HKL/H5CtfImporter.cpp b/Source/EbsdLib/IO/HKL/H5CtfImporter.cpp index 38aaec7..5001c1c 100644 --- a/Source/EbsdLib/IO/HKL/H5CtfImporter.cpp +++ b/Source/EbsdLib/IO/HKL/H5CtfImporter.cpp @@ -103,18 +103,12 @@ using namespace ebsdlib; } \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5CtfImporter::H5CtfImporter() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5CtfImporter::~H5CtfImporter() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5CtfImporter::getDims(int64_t& x, int64_t& y) { @@ -122,8 +116,6 @@ void H5CtfImporter::getDims(int64_t& x, int64_t& y) y = yDim; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5CtfImporter::getSpacing(float& x, float& y) { @@ -131,16 +123,12 @@ void H5CtfImporter::getSpacing(float& x, float& y) y = yRes; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfImporter::numberOfSlicesImported() { return m_NumSlicesImported; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfImporter::importFile(hid_t fileId, int64_t z, const std::string& ctfFile) { @@ -231,8 +219,6 @@ int H5CtfImporter::importFile(hid_t fileId, int64_t z, const std::string& ctfFil return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfImporter::writeSliceData(hid_t fileId, CtfReader& reader, int z, int actualSlice) { @@ -375,8 +361,6 @@ int H5CtfImporter::writeSliceData(hid_t fileId, CtfReader& reader, int z, int ac return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- #define WRITE_PHASE_HEADER_DATA(reader, m_msgType, prpty, key) \ { \ @@ -425,8 +409,6 @@ int H5CtfImporter::writeSliceData(hid_t fileId, CtfReader& reader, int z, int ac } \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfImporter::writePhaseData(CtfReader& reader, hid_t phasesGid) { @@ -465,8 +447,6 @@ int H5CtfImporter::writePhaseData(CtfReader& reader, hid_t phasesGid) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5CtfImporter::setFileVersion(uint32_t version) { diff --git a/Source/EbsdLib/IO/HKL/H5CtfReader.cpp b/Source/EbsdLib/IO/HKL/H5CtfReader.cpp index a2f0a79..c896799 100644 --- a/Source/EbsdLib/IO/HKL/H5CtfReader.cpp +++ b/Source/EbsdLib/IO/HKL/H5CtfReader.cpp @@ -47,16 +47,12 @@ using namespace H5Support; using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5CtfReader::H5CtfReader() : m_ReadAllArrays(true) { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5CtfReader::~H5CtfReader() { @@ -142,8 +138,6 @@ H5CtfReader::~H5CtfReader() } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfReader::readHeaderOnly() { @@ -177,8 +171,6 @@ int H5CtfReader::readHeaderOnly() return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfReader::readFile() { @@ -216,8 +208,6 @@ int H5CtfReader::readFile() return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfReader::readHeader(hid_t parId) { @@ -304,8 +294,6 @@ int H5CtfReader::readHeader(hid_t parId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfReader::readData(hid_t parId) { @@ -367,16 +355,12 @@ int H5CtfReader::readData(hid_t parId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5CtfReader::setArraysToRead(const std::set& names) { m_ArrayNames = names; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5CtfReader::readAllArrays(bool b) { diff --git a/Source/EbsdLib/IO/HKL/H5CtfVolumeReader.cpp b/Source/EbsdLib/IO/HKL/H5CtfVolumeReader.cpp index caf6ef5..acb323a 100644 --- a/Source/EbsdLib/IO/HKL/H5CtfVolumeReader.cpp +++ b/Source/EbsdLib/IO/HKL/H5CtfVolumeReader.cpp @@ -48,13 +48,9 @@ using namespace H5Support; using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5CtfVolumeReader::H5CtfVolumeReader() = default; // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- H5CtfVolumeReader::~H5CtfVolumeReader() { deletePointers(); @@ -71,8 +67,6 @@ H5CtfVolumeReader::~H5CtfVolumeReader() set##name##Pointer(_##name); \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5CtfVolumeReader::initPointers(size_t numElements) { @@ -95,8 +89,6 @@ void H5CtfVolumeReader::initPointers(size_t numElements) H5CTFREADER_ALLOCATE_ARRAY(BS, int) } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5CtfVolumeReader::deletePointers() { @@ -113,8 +105,6 @@ void H5CtfVolumeReader::deletePointers() this->deallocateArrayData(m_BS); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void* H5CtfVolumeReader::getPointerByName(const std::string& featureName) { @@ -165,8 +155,6 @@ void* H5CtfVolumeReader::getPointerByName(const std::string& featureName) return nullptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::NumericTypes::Type H5CtfVolumeReader::getPointerType(const std::string& featureName) { @@ -217,8 +205,6 @@ ebsdlib::NumericTypes::Type H5CtfVolumeReader::getPointerType(const std::string& return ebsdlib::NumericTypes::Type::UnknownNumType; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector H5CtfVolumeReader::getPhases() { @@ -295,8 +281,6 @@ float H5CtfVolumeReader::getYStep() return y; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5CtfVolumeReader::loadData(int64_t xpoints, int64_t ypoints, int64_t zpoints, uint32_t ZDir) { diff --git a/Source/EbsdLib/IO/HKL/H5OINAReader.cpp b/Source/EbsdLib/IO/HKL/H5OINAReader.cpp index 6e1c99b..72ec00b 100644 --- a/Source/EbsdLib/IO/HKL/H5OINAReader.cpp +++ b/Source/EbsdLib/IO/HKL/H5OINAReader.cpp @@ -77,8 +77,6 @@ H5OINAReader::H5OINAReader() m_HeaderMap[ebsdlib::Ctf::YStep] = CtfHeaderEntry::NewEbsdHeaderEntry(ebsdlib::Ctf::YStep); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5OINAReader::~H5OINAReader() { @@ -157,8 +155,6 @@ void* H5OINAReader::getPointerByName(const std::string& featureName) return nullptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::NumericTypes::Type H5OINAReader::getPointerType(const std::string& featureName) { @@ -218,8 +214,6 @@ void H5OINAReader::getPatternDims(std::array dims) ; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OINAReader::readFile() { @@ -330,8 +324,6 @@ int H5OINAReader::readFile() return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OINAReader::readHeaderOnly() { @@ -408,8 +400,6 @@ int H5OINAReader::readHeaderOnly() return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OINAReader::readScanNames(std::list& names) { @@ -713,16 +703,12 @@ int H5OINAReader::readData(hid_t parId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5OINAReader::setArraysToRead(const std::set& names) { m_ArrayNames = names; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5OINAReader::readAllArrays(bool b) { diff --git a/Source/EbsdLib/IO/TSL/AngFields.cpp b/Source/EbsdLib/IO/TSL/AngFields.cpp index 202e2f2..b7ddfb0 100644 --- a/Source/EbsdLib/IO/TSL/AngFields.cpp +++ b/Source/EbsdLib/IO/TSL/AngFields.cpp @@ -37,18 +37,12 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AngFields::AngFields() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AngFields::~AngFields() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector AngFields::getFieldNames() { diff --git a/Source/EbsdLib/IO/TSL/AngPhase.cpp b/Source/EbsdLib/IO/TSL/AngPhase.cpp index e7d11f1..04c79b1 100644 --- a/Source/EbsdLib/IO/TSL/AngPhase.cpp +++ b/Source/EbsdLib/IO/TSL/AngPhase.cpp @@ -93,8 +93,6 @@ std::string HKLFamily::ClassName() return std::string("HKLFamily"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AngPhase::AngPhase() : m_PhaseIndex(-1) @@ -103,13 +101,9 @@ AngPhase::AngPhase() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AngPhase::~AngPhase() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::parseMaterialName(std::vector& tokens) { @@ -121,8 +115,6 @@ void AngPhase::parseMaterialName(std::vector& tokens) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::parseFormula(std::vector& tokens) { @@ -134,8 +126,6 @@ void AngPhase::parseFormula(std::vector& tokens) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- // void AngPhase::parseInfo(std::vector& tokens) //{ @@ -146,8 +136,6 @@ void AngPhase::parseFormula(std::vector& tokens) // } //} -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- // void AngPhase::parseSymmetry(char* value, size_t start, size_t length) //{ @@ -160,8 +148,6 @@ void AngPhase::parseFormula(std::vector& tokens) // m_Symmetry = data.toUInt(&ok, 10); //} -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::parseLatticeConstants(std::vector& tokens) { @@ -175,8 +161,6 @@ void AngPhase::parseLatticeConstants(std::vector& tokens) m_LatticeConstants.push_back(std::stof(tokens[6])); // Gamma } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- // void AngPhase::parseNumberFamilies(char* value, size_t start, size_t length) //{ @@ -189,8 +173,6 @@ void AngPhase::parseLatticeConstants(std::vector& tokens) // m_NumberFamilies = data); //} -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::parseHKLFamilies(std::vector& tokens) { @@ -226,8 +208,6 @@ void AngPhase::parseHKLFamilies(std::vector& tokens) m_HKLFamilies.push_back(family); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::parseCategories(std::vector& tokens) { @@ -253,8 +233,6 @@ void AngPhase::parseCategories(std::vector& tokens) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::printSelf(std::stringstream& stream) { @@ -287,8 +265,6 @@ void AngPhase::printSelf(std::stringstream& stream) stream << std::string("\n"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- unsigned int AngPhase::determineOrientationOpsIndex() { @@ -377,48 +353,36 @@ unsigned int AngPhase::determineOrientationOpsIndex() return crystal_structure; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::setLatticeConstantA(float a) { m_LatticeConstants[0] = a; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::setLatticeConstantB(float a) { m_LatticeConstants[1] = a; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::setLatticeConstantC(float a) { m_LatticeConstants[2] = a; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::setLatticeConstantAlpha(float a) { m_LatticeConstants[3] = a; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::setLatticeConstantBeta(float a) { m_LatticeConstants[4] = a; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngPhase::setLatticeConstantGamma(float a) { diff --git a/Source/EbsdLib/IO/TSL/AngReader.cpp b/Source/EbsdLib/IO/TSL/AngReader.cpp index 9e05fb5..bfd6640 100644 --- a/Source/EbsdLib/IO/TSL/AngReader.cpp +++ b/Source/EbsdLib/IO/TSL/AngReader.cpp @@ -93,8 +93,6 @@ std::optional GetGridIndex(Vec3Type& coords, Vec3Type& m_Origin, Vec3Typ } } // namespace -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AngReader::AngReader() { @@ -201,8 +199,6 @@ AngReader::~AngReader() } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void* AngReader::getPointerByName(const std::string& featureName) { @@ -249,8 +245,6 @@ void* AngReader::getPointerByName(const std::string& featureName) return nullptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::NumericTypes::Type AngReader::getPointerType(const std::string& featureName) { @@ -297,8 +291,6 @@ ebsdlib::NumericTypes::Type AngReader::getPointerType(const std::string& feature return ebsdlib::NumericTypes::Type::UnknownNumType; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int AngReader::readHeaderOnly() { @@ -333,8 +325,6 @@ int AngReader::readHeaderOnly() return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int AngReader::readFile() { @@ -431,8 +421,6 @@ int AngReader::readFile() return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngReader::readData(std::ifstream& in, std::string& buf) { @@ -958,8 +946,6 @@ void AngReader::parseDataLine(std::string& line, size_t i) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::pair AngReader::fixOrderOfData(std::vector& indexMap) { @@ -1037,16 +1023,12 @@ std::pair AngReader::fixOrderOfData(std::vector& inde return {0, ""}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int AngReader::getXDimension() { return getNumEvenCols(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngReader::setXDimension(int xdim) { @@ -1054,16 +1036,12 @@ void AngReader::setXDimension(int xdim) setNumOddCols(xdim); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int AngReader::getYDimension() { return getNumRows(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void AngReader::setYDimension(int ydim) { diff --git a/Source/EbsdLib/IO/TSL/H5AngImporter.cpp b/Source/EbsdLib/IO/TSL/H5AngImporter.cpp index b0c331f..8103d33 100644 --- a/Source/EbsdLib/IO/TSL/H5AngImporter.cpp +++ b/Source/EbsdLib/IO/TSL/H5AngImporter.cpp @@ -53,8 +53,6 @@ using namespace ebsdlib; break; \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5AngImporter::H5AngImporter() : xDim(0) @@ -65,8 +63,6 @@ H5AngImporter::H5AngImporter() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5AngImporter::~H5AngImporter() = default; @@ -118,8 +114,6 @@ H5AngImporter::~H5AngImporter() = default; } \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5AngImporter::getDims(int64_t& x, int64_t& y) { @@ -127,8 +121,6 @@ void H5AngImporter::getDims(int64_t& x, int64_t& y) y = yDim; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5AngImporter::getSpacing(float& x, float& y) { @@ -136,16 +128,12 @@ void H5AngImporter::getSpacing(float& x, float& y) y = yRes; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngImporter::numberOfSlicesImported() { return 1; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngImporter::importFile(hid_t fileId, int64_t z, const std::string& angFile) { @@ -369,8 +357,6 @@ int H5AngImporter::importFile(hid_t fileId, int64_t z, const std::string& angFil } \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngImporter::writePhaseData(AngReader& reader, hid_t phasesGid) { @@ -413,8 +399,6 @@ int H5AngImporter::writePhaseData(AngReader& reader, hid_t phasesGid) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngImporter::writeHKLFamilies(AngPhase* p, hid_t hklGid) { @@ -463,8 +447,6 @@ int H5AngImporter::writeHKLFamilies(AngPhase* p, hid_t hklGid) return status; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5AngImporter::setFileVersion(uint32_t version) { diff --git a/Source/EbsdLib/IO/TSL/H5AngReader.cpp b/Source/EbsdLib/IO/TSL/H5AngReader.cpp index 849809b..a38227f 100644 --- a/Source/EbsdLib/IO/TSL/H5AngReader.cpp +++ b/Source/EbsdLib/IO/TSL/H5AngReader.cpp @@ -54,21 +54,15 @@ using namespace H5Support; using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5AngReader::H5AngReader() : m_ReadAllArrays(true) { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5AngReader::~H5AngReader() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngReader::readFile() { @@ -131,8 +125,6 @@ int H5AngReader::readFile() return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngReader::readHeaderOnly() { @@ -166,8 +158,6 @@ int H5AngReader::readHeaderOnly() return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngReader::readHeader(hid_t parId) { @@ -267,8 +257,6 @@ int H5AngReader::readHeader(hid_t parId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngReader::readHKLFamilies(hid_t hklGid, const AngPhase::Pointer& phase) { @@ -311,8 +299,6 @@ int H5AngReader::readHKLFamilies(hid_t hklGid, const AngPhase::Pointer& phase) return status; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngReader::readData(hid_t parId) { @@ -409,16 +395,12 @@ int H5AngReader::readData(hid_t parId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5AngReader::setArraysToRead(const std::set& names) { m_ArrayNames = names; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5AngReader::readAllArrays(bool b) { diff --git a/Source/EbsdLib/IO/TSL/H5AngVolumeReader.cpp b/Source/EbsdLib/IO/TSL/H5AngVolumeReader.cpp index fd2c303..37ce23b 100644 --- a/Source/EbsdLib/IO/TSL/H5AngVolumeReader.cpp +++ b/Source/EbsdLib/IO/TSL/H5AngVolumeReader.cpp @@ -48,8 +48,6 @@ using namespace H5Support; using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5AngVolumeReader::H5AngVolumeReader() { @@ -66,8 +64,6 @@ H5AngVolumeReader::H5AngVolumeReader() m_Fit = nullptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5AngVolumeReader::~H5AngVolumeReader() { @@ -85,8 +81,6 @@ H5AngVolumeReader::~H5AngVolumeReader() set##name##Pointer(_##name); \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5AngVolumeReader::initPointers(size_t numElements) { @@ -107,8 +101,6 @@ void H5AngVolumeReader::initPointers(size_t numElements) H5ANGREADER_ALLOCATE_ARRAY(Fit, float) } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5AngVolumeReader::deletePointers() { @@ -124,8 +116,6 @@ void H5AngVolumeReader::deletePointers() this->deallocateArrayData(m_Fit); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void* H5AngVolumeReader::getPointerByName(const std::string& featureName) { @@ -172,8 +162,6 @@ void* H5AngVolumeReader::getPointerByName(const std::string& featureName) return nullptr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::NumericTypes::Type H5AngVolumeReader::getPointerType(const std::string& featureName) { @@ -220,8 +208,6 @@ ebsdlib::NumericTypes::Type H5AngVolumeReader::getPointerType(const std::string& return ebsdlib::NumericTypes::Type::UnknownNumType; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector H5AngVolumeReader::getPhases() { @@ -299,8 +285,6 @@ float H5AngVolumeReader::getYStep() return y; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5AngVolumeReader::loadData(int64_t xpoints, int64_t ypoints, int64_t zpoints, uint32_t ZDir) { diff --git a/Source/EbsdLib/IO/TSL/H5OIMReader.cpp b/Source/EbsdLib/IO/TSL/H5OIMReader.cpp index 5e37814..232ac99 100644 --- a/Source/EbsdLib/IO/TSL/H5OIMReader.cpp +++ b/Source/EbsdLib/IO/TSL/H5OIMReader.cpp @@ -56,8 +56,6 @@ using namespace H5Support; using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5OIMReader::H5OIMReader() { @@ -86,16 +84,12 @@ H5OIMReader::H5OIMReader() m_PatternDims[1] = 0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- H5OIMReader::~H5OIMReader() { this->deallocateArrayData(m_PatternData); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OIMReader::readFile() { @@ -204,8 +198,6 @@ int H5OIMReader::readFile() return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OIMReader::readHeaderOnly() { @@ -286,8 +278,6 @@ int H5OIMReader::readHeaderOnly() return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OIMReader::readScanNames(std::list& names) { @@ -310,8 +300,6 @@ int H5OIMReader::readScanNames(std::list& names) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OIMReader::readHeader(hid_t parId) { @@ -475,8 +463,6 @@ int H5OIMReader::readHeader(hid_t parId) return getErrorCode(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OIMReader::readHKLFamilies(hid_t hklGid, const AngPhase::Pointer& phase) { @@ -535,8 +521,6 @@ int H5OIMReader::readHKLFamilies(hid_t hklGid, const AngPhase::Pointer& phase) return status; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int H5OIMReader::readData(hid_t parId) { @@ -657,16 +641,12 @@ int H5OIMReader::readData(hid_t parId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5OIMReader::setArraysToRead(const std::set& names) { m_ArrayNames = names; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void H5OIMReader::readAllArrays(bool b) { diff --git a/Source/EbsdLib/LaueOps/CubicLowOps.cpp b/Source/EbsdLib/LaueOps/CubicLowOps.cpp index ccdd5c0..c2b158f 100644 --- a/Source/EbsdLib/LaueOps/CubicLowOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicLowOps.cpp @@ -58,25 +58,28 @@ using namespace ebsdlib; namespace CubicLow { -constexpr std::array OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0]) / 2.0, OdfDimInitValue[1] / static_cast(OdfNumBins[1]) / 2.0, - OdfDimInitValue[2] / static_cast(OdfNumBins[2]) / 2.0}; - -constexpr int symSize0 = 6; -constexpr int symSize1 = 12; -constexpr int symSize2 = 8; - -constexpr int k_OdfSize = 46656; -constexpr int k_MdfSize = 46656; -constexpr int k_SymOpsCount = 12; +constexpr std::array k_OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin +static const std::array k_OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0]) / 2.0, k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1]) / 2.0, + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2]) / 2.0}; + +constexpr int k_SymSize0 = 6; +constexpr int k_SymSize1 = 12; +constexpr int k_SymSize2 = 8; + +constexpr size_t k_OdfSize = 46656; +constexpr size_t k_MdfSize = 46656; +constexpr size_t k_SymOpsCount = 12; constexpr int k_NumMdfBins = 18; +static const double sqrtOneThird = std::sqrt(0.3333333333333333333); +static const double sqrtThree = std::sqrt(3.0); + // Rotation Point Group: 23 /* clang-format off */ -static const std::vector QuatSym ={ +static const std::vector k_QuatSym ={ QuatD(0.0, 0.0, 0.0, 1.0), QuatD(1.0, 0.0, 0.0, 0.0), QuatD(0.0, 1.0, 0.0, 0.0), @@ -91,88 +94,83 @@ static const std::vector QuatSym ={ QuatD(0.5, 0.5, -0.5, 0.5), }; -static const std::vector RodSym = { +static const std::vector k_RodSym = { {0.0, 0.0, 1.0, 0.0}, {1.0, 0.0, 0.0, 10000000000000.0}, {0.0, 1.0, 0.0, 10000000000000.0}, {0.0, 0.0, 1.0, 10000000000000.0}, - {0.5773502691896258, 0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, -0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, - {0.5773502691896258, -0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, 0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, 0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {0.5773502691896258, -0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, -0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {0.5773502691896258, 0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, + {sqrtOneThird, sqrtOneThird, sqrtOneThird, sqrtThree}, + {-sqrtOneThird, -sqrtOneThird, -sqrtOneThird, sqrtThree}, + {sqrtOneThird, -sqrtOneThird, sqrtOneThird, sqrtThree}, + {-sqrtOneThird, sqrtOneThird, -sqrtOneThird, sqrtThree}, + {-sqrtOneThird, sqrtOneThird, sqrtOneThird, sqrtThree}, + {sqrtOneThird, -sqrtOneThird, -sqrtOneThird, sqrtThree}, + {-sqrtOneThird, -sqrtOneThird, sqrtOneThird, sqrtThree}, + {sqrtOneThird, sqrtOneThird, -sqrtOneThird, sqrtThree}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.0, 0.0, 1.0}, - {1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}}, - - {{0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}, - {1.0, 0.0, 0.0}}, - - {{0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}, - {1.0, 0.0, 0.0}}, - - {{0.0, 0.0, 1.0}, - {-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}}, - - {{0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {-1.0, 0.0, 0.0}}, - - {{0.0, 0.0, -1.0}, - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}}, - - {{0.0, 0.0, -1.0}, - {1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}}, - - {{0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}, - {-1.0, 0.0, 0.0}}, +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0}, + + {0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0}, + + {0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0}, + + {0.0, -1.0, 0.0, + 0.0, 0.0, -1.0, + 1.0, 0.0, 0.0}, + + {0.0, 0.0, 1.0, + -1.0, 0.0, 0.0, + 0.0, -1.0, 0.0}, + + {0.0, -1.0, 0.0, + 0.0, 0.0, 1.0, + -1.0, 0.0, 0.0}, + + {0.0, 0.0, -1.0, + -1.0, 0.0, 0.0, + 0.0, 1.0, 0.0}, + + {0.0, 0.0, -1.0, + 1.0, 0.0, 0.0, + 0.0, -1.0, 0.0}, + + {0.0, 1.0, 0.0, + 0.0, 0.0, -1.0, + -1.0, 0.0, 0.0}, }; /* clang-format on */ + constexpr double k_EtaMin = 0.0; constexpr double k_EtaMax = 90.0; } // namespace CubicLow -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CubicLowOps::CubicLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CubicLowOps::~CubicLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool CubicLowOps::getHasInversion() const { @@ -180,9 +178,7 @@ bool CubicLowOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int CubicLowOps::getODFSize() const +size_t CubicLowOps::getODFSize() const { return CubicLow::k_OdfSize; } @@ -190,13 +186,11 @@ int CubicLowOps::getODFSize() const // ----------------------------------------------------------------------------- std::array CubicLowOps::getNumSymmetry() const { - return {CubicLow::symSize0, CubicLow::symSize1, CubicLow::symSize2}; + return {CubicLow::k_SymSize0, CubicLow::k_SymSize1, CubicLow::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int CubicLowOps::getMDFSize() const +size_t CubicLowOps::getMDFSize() const { return CubicLow::k_MdfSize; } @@ -208,9 +202,7 @@ int CubicLowOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int CubicLowOps::getNumSymOps() const +size_t CubicLowOps::getNumSymOps() const { return CubicLow::k_SymOpsCount; } @@ -218,19 +210,15 @@ int CubicLowOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array CubicLowOps::getOdfNumBins() const { - return CubicLow::OdfNumBins; + return CubicLow::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string CubicLowOps::getSymmetryName() const { return "Cubic m-3 (Th)"; /* Group 23*/ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string CubicLowOps::getRotationPointGroup() const { @@ -258,47 +246,42 @@ bool CubicLowOps::isInsideFZ(const RodriguesDType& rod) const // ----------------------------------------------------------------------------- AxisAngleDType CubicLowOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(CubicLow::QuatSym, q1, q2); + return calculateMisorientationInternal(CubicLow::k_QuatSym, q1, q2); } -QuatD CubicLowOps::getQuatSymOp(int32_t i) const +QuatD CubicLowOps::getQuatSymOp(size_t i) const { - return CubicLow::QuatSym[i]; + return CubicLow::k_QuatSym[i]; } -int32_t CubicLowOps::getNumRodriguesSymOps() const +size_t CubicLowOps::getNumRodriguesSymOps() const { - return CubicLow::RodSym.size(); + return CubicLow::k_RodSym.size(); } RodriguesDType CubicLowOps::getRodSymOp(size_t i) const { - return CubicLow::RodSym[i]; + return CubicLow::k_RodSym[i]; } -Matrix3X3D CubicLowOps::getMatSymOpD(int i) const +Matrix3X3D CubicLowOps::getMatSymOpD(size_t i) const { - return {CubicLow::MatSym[i][0][0], CubicLow::MatSym[i][0][1], CubicLow::MatSym[i][0][2], CubicLow::MatSym[i][1][0], CubicLow::MatSym[i][1][1], - CubicLow::MatSym[i][1][2], CubicLow::MatSym[i][2][0], CubicLow::MatSym[i][2][1], CubicLow::MatSym[i][2][2]}; + return CubicLow::k_MatSym[i]; } -Matrix3X3F CubicLowOps::getMatSymOpF(int i) const +Matrix3X3F CubicLowOps::getMatSymOpF(size_t i) const { - return {static_cast(CubicLow::MatSym[i][0][0]), static_cast(CubicLow::MatSym[i][0][1]), static_cast(CubicLow::MatSym[i][0][2]), - static_cast(CubicLow::MatSym[i][1][0]), static_cast(CubicLow::MatSym[i][1][1]), static_cast(CubicLow::MatSym[i][1][2]), - static_cast(CubicLow::MatSym[i][2][0]), static_cast(CubicLow::MatSym[i][2][1]), static_cast(CubicLow::MatSym[i][2][2])}; + return {static_cast(CubicLow::k_MatSym[i](0, 0)), static_cast(CubicLow::k_MatSym[i](0, 1)), static_cast(CubicLow::k_MatSym[i](0, 2)), + static_cast(CubicLow::k_MatSym[i](1, 0)), static_cast(CubicLow::k_MatSym[i](1, 1)), static_cast(CubicLow::k_MatSym[i](1, 2)), + static_cast(CubicLow::k_MatSym[i](2, 0)), static_cast(CubicLow::k_MatSym[i](2, 1)), static_cast(CubicLow::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType CubicLowOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType CubicLowOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -357,23 +340,21 @@ RodriguesDType CubicLowOps::getMDFFZRod(const RodriguesDType& inRod) const QuatD CubicLowOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(CubicLow::QuatSym, q1, q2); + return _calcNearestQuat(CubicLow::k_QuatSym, q1, q2); } QuatF CubicLowOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(CubicLow::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(CubicLow::k_QuatSym, q1f.to(), q2f.to()).to(); } QuatD CubicLowOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(CubicLow::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(CubicLow::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CubicLowOps::getMisoBin(const RodriguesDType& rod) const { @@ -383,21 +364,19 @@ int CubicLowOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = CubicLow::OdfDimInitValue[0]; - dim[1] = CubicLow::OdfDimInitValue[1]; - dim[2] = CubicLow::OdfDimInitValue[2]; - step[0] = CubicLow::OdfDimStepValue[0]; - step[1] = CubicLow::OdfDimStepValue[1]; - step[2] = CubicLow::OdfDimStepValue[2]; - bins[0] = static_cast(CubicLow::OdfNumBins[0]); - bins[1] = static_cast(CubicLow::OdfNumBins[1]); - bins[2] = static_cast(CubicLow::OdfNumBins[2]); + dim[0] = CubicLow::k_OdfDimInitValue[0]; + dim[1] = CubicLow::k_OdfDimInitValue[1]; + dim[2] = CubicLow::k_OdfDimInitValue[2]; + step[0] = CubicLow::k_OdfDimStepValue[0]; + step[1] = CubicLow::k_OdfDimStepValue[1]; + step[2] = CubicLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(CubicLow::k_OdfNumBins[0]); + bins[1] = static_cast(CubicLow::k_OdfNumBins[1]); + bins[2] = static_cast(CubicLow::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType CubicLowOps::determineEulerAngles(double random[3], int choose) const { @@ -406,15 +385,15 @@ EulerDType CubicLowOps::determineEulerAngles(double random[3], int choose) const int32_t phi[3]; double h1, h2, h3; - init[0] = CubicLow::OdfDimInitValue[0]; - init[1] = CubicLow::OdfDimInitValue[1]; - init[2] = CubicLow::OdfDimInitValue[2]; - step[0] = CubicLow::OdfDimStepValue[0]; - step[1] = CubicLow::OdfDimStepValue[1]; - step[2] = CubicLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % CubicLow::OdfNumBins[0]); - phi[1] = static_cast((choose / CubicLow::OdfNumBins[0]) % CubicLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (CubicLow::OdfNumBins[0] * CubicLow::OdfNumBins[1])); + init[0] = CubicLow::k_OdfDimInitValue[0]; + init[1] = CubicLow::k_OdfDimInitValue[1]; + init[2] = CubicLow::k_OdfDimInitValue[2]; + step[0] = CubicLow::k_OdfDimStepValue[0]; + step[1] = CubicLow::k_OdfDimStepValue[1]; + step[2] = CubicLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % CubicLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / CubicLow::k_OdfNumBins[0]) % CubicLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (CubicLow::k_OdfNumBins[0] * CubicLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -423,19 +402,15 @@ EulerDType CubicLowOps::determineEulerAngles(double random[3], int choose) const return ro.toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType CubicLowOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(CubicLow::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = CubicLow::QuatSym[symOp] * quat; + QuatD qc = CubicLow::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType CubicLowOps::determineRodriguesVector(double random[3], int choose) const { @@ -444,15 +419,15 @@ RodriguesDType CubicLowOps::determineRodriguesVector(double random[3], int choos int32_t phi[3]; double h1, h2, h3; - init[0] = CubicLow::OdfDimInitValue[0]; - init[1] = CubicLow::OdfDimInitValue[1]; - init[2] = CubicLow::OdfDimInitValue[2]; - step[0] = CubicLow::OdfDimStepValue[0]; - step[1] = CubicLow::OdfDimStepValue[1]; - step[2] = CubicLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % CubicLow::OdfNumBins[0]); - phi[1] = static_cast((choose / CubicLow::OdfNumBins[0]) % CubicLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (CubicLow::OdfNumBins[0] * CubicLow::OdfNumBins[1])); + init[0] = CubicLow::k_OdfDimInitValue[0]; + init[1] = CubicLow::k_OdfDimInitValue[1]; + init[2] = CubicLow::k_OdfDimInitValue[2]; + step[0] = CubicLow::k_OdfDimStepValue[0]; + step[1] = CubicLow::k_OdfDimStepValue[1]; + step[2] = CubicLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % CubicLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / CubicLow::k_OdfNumBins[0]) % CubicLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (CubicLow::k_OdfNumBins[0] * CubicLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -460,8 +435,6 @@ RodriguesDType CubicLowOps::determineRodriguesVector(double random[3], int choos return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CubicLowOps::getOdfBin(const RodriguesDType& rod) const { @@ -471,15 +444,15 @@ int CubicLowOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = CubicLow::OdfDimInitValue[0]; - dim[1] = CubicLow::OdfDimInitValue[1]; - dim[2] = CubicLow::OdfDimInitValue[2]; - step[0] = CubicLow::OdfDimStepValue[0]; - step[1] = CubicLow::OdfDimStepValue[1]; - step[2] = CubicLow::OdfDimStepValue[2]; - bins[0] = static_cast(CubicLow::OdfNumBins[0]); - bins[1] = static_cast(CubicLow::OdfNumBins[1]); - bins[2] = static_cast(CubicLow::OdfNumBins[2]); + dim[0] = CubicLow::k_OdfDimInitValue[0]; + dim[1] = CubicLow::k_OdfDimInitValue[1]; + dim[2] = CubicLow::k_OdfDimInitValue[2]; + step[0] = CubicLow::k_OdfDimStepValue[0]; + step[1] = CubicLow::k_OdfDimStepValue[1]; + step[2] = CubicLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(CubicLow::k_OdfNumBins[0]); + bins[1] = static_cast(CubicLow::k_OdfNumBins[1]); + bins[2] = static_cast(CubicLow::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -511,21 +484,21 @@ void CubicLowOps::getSchmidFactorAndSS(double load[3], double plane[3], double d { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = CubicLow::MatSym[i][2][0] * plane[0] + CubicLow::MatSym[i][2][1] * plane[1] + CubicLow::MatSym[i][2][2] * plane[2]; + slipPlane[2] = CubicLow::k_MatSym[i](2, 0) * plane[0] + CubicLow::k_MatSym[i](2, 1) * plane[1] + CubicLow::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = CubicLow::MatSym[i][0][0] * plane[0] + CubicLow::MatSym[i][0][1] * plane[1] + CubicLow::MatSym[i][0][2] * plane[2]; - slipPlane[1] = CubicLow::MatSym[i][1][0] * plane[0] + CubicLow::MatSym[i][1][1] * plane[1] + CubicLow::MatSym[i][1][2] * plane[2]; + slipPlane[0] = CubicLow::k_MatSym[i](0, 0) * plane[0] + CubicLow::k_MatSym[i](0, 1) * plane[1] + CubicLow::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = CubicLow::k_MatSym[i](1, 0) * plane[0] + CubicLow::k_MatSym[i](1, 1) * plane[1] + CubicLow::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = CubicLow::MatSym[i][0][0] * direction[0] + CubicLow::MatSym[i][0][1] * direction[1] + CubicLow::MatSym[i][0][2] * direction[2]; - slipDirection[1] = CubicLow::MatSym[i][1][0] * direction[0] + CubicLow::MatSym[i][1][1] * direction[1] + CubicLow::MatSym[i][1][2] * direction[2]; - slipDirection[2] = CubicLow::MatSym[i][2][0] * direction[0] + CubicLow::MatSym[i][2][1] * direction[1] + CubicLow::MatSym[i][2][2] * direction[2]; + slipDirection[0] = CubicLow::k_MatSym[i](0, 0) * direction[0] + CubicLow::k_MatSym[i](0, 1) * direction[1] + CubicLow::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = CubicLow::k_MatSym[i](1, 0) * direction[0] + CubicLow::k_MatSym[i](1, 1) * direction[1] + CubicLow::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = CubicLow::k_MatSym[i](2, 0) * direction[0] + CubicLow::k_MatSym[i](2, 1) * direction[1] + CubicLow::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -559,8 +532,6 @@ double CubicLowOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool m return 0.0; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace CubicLow { @@ -703,25 +674,23 @@ class GenerateSphereCoordsImpl }; } // namespace CubicLow -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CubicLowOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * CubicLow::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * CubicLow::k_SymSize0) { - xyz001->resizeTuples(nOrientations * CubicLow::symSize0 * 3); + xyz001->resizeTuples(nOrientations * CubicLow::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * CubicLow::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * CubicLow::k_SymSize1) { - xyz011->resizeTuples(nOrientations * CubicLow::symSize1 * 3); + xyz011->resizeTuples(nOrientations * CubicLow::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * CubicLow::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * CubicLow::k_SymSize2) { - xyz111->resizeTuples(nOrientations * CubicLow::symSize2 * 3); + xyz111->resizeTuples(nOrientations * CubicLow::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -756,8 +725,6 @@ std::array CubicLowOps::getIpfColorAngleLimits(double eta) const return {CubicLow::k_EtaMin * ebsdlib::constants::k_DegToRadD, CubicLow::k_EtaMax * ebsdlib::constants::k_DegToRadD, chiMax}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool CubicLowOps::inUnitTriangle(double eta, double chi) const { @@ -790,14 +757,12 @@ ebsdlib::Rgb CubicLowOps::generateIPFColor(double phi1, double phi, double phi2, return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb CubicLowOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * CubicLow::OdfDimInitValue[0]; - double range2 = 2.0f * CubicLow::OdfDimInitValue[1]; - double range3 = 2.0f * CubicLow::OdfDimInitValue[2]; + double range1 = 2.0f * CubicLow::k_OdfDimInitValue[0]; + double range2 = 2.0f * CubicLow::k_OdfDimInitValue[1]; + double range3 = 2.0f * CubicLow::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -813,16 +778,12 @@ ebsdlib::Rgb CubicLowOps::generateRodriguesColor(double r1, double r2, double r3 return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array CubicLowOps::getDefaultPoleFigureNames() const { return {"<001>", "<011>", "<111>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector CubicLowOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -848,11 +809,11 @@ std::vector CubicLowOps::generatePoleFigure(Po // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicLow::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicLow::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicLow::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicLow::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicLow::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicLow::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -860,7 +821,7 @@ std::vector CubicLowOps::generatePoleFigure(Po generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -1060,7 +1021,7 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float for(size_t idx = 0; idx < angles.size(); idx++) { - float radius = 1.0; // Work with a Unit Circle. + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); diff --git a/Source/EbsdLib/LaueOps/CubicLowOps.h b/Source/EbsdLib/LaueOps/CubicLowOps.h index 5d7a6a7..d87deea 100644 --- a/Source/EbsdLib/LaueOps/CubicLowOps.h +++ b/Source/EbsdLib/LaueOps/CubicLowOps.h @@ -86,10 +86,10 @@ class EbsdLib_EXPORT CubicLowOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -98,7 +98,7 @@ class EbsdLib_EXPORT CubicLowOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -110,7 +110,7 @@ class EbsdLib_EXPORT CubicLowOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -156,7 +156,7 @@ class EbsdLib_EXPORT CubicLowOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -169,15 +169,15 @@ class EbsdLib_EXPORT CubicLowOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/CubicOps.cpp b/Source/EbsdLib/LaueOps/CubicOps.cpp index 8d19cf8..aeee673 100644 --- a/Source/EbsdLib/LaueOps/CubicOps.cpp +++ b/Source/EbsdLib/LaueOps/CubicOps.cpp @@ -39,8 +39,6 @@ // to expose some of the constants needed below #include "EbsdLib/Core/EbsdMacros.h" #include "EbsdLib/Math/EbsdLibMath.h" -#include "EbsdLib/Math/EbsdMatrixMath.h" -#include "EbsdLib/Math/GeometryMath.h" #include "EbsdLib/Orientation/Euler.hpp" #include "EbsdLib/Orientation/OrientationFwd.hpp" #include "EbsdLib/Orientation/OrientationMatrix.hpp" @@ -62,21 +60,21 @@ using namespace ebsdlib; namespace CubicHigh { -constexpr std::array OdfNumBins = {18, 18, 18}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0))}; +constexpr std::array k_OdfNumBins = {18, 18, 18}; // Represents a 5Deg bin +static const std::array k_OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiOver4D - std::sin(ebsdlib::constants::k_PiOver4D))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 6; -constexpr int symSize1 = 12; -constexpr int symSize2 = 8; +constexpr int k_SymSize0 = 6; +constexpr int k_SymSize1 = 12; +constexpr int k_SymSize2 = 8; -constexpr int k_OdfSize = 5832; -constexpr int k_MdfSize = 5832; -constexpr int k_SymOpsCount = 24; +constexpr size_t k_OdfSize = 5832; +constexpr size_t k_MdfSize = 5832; +constexpr size_t k_SymOpsCount = 24; constexpr int k_NumMdfBins = 13; static const double SlipDirections[12][3] = {{0.0, 1.0, -1.0}, {1.0, 0.0, -1.0}, {1.0, -1.0, 0.0}, {1.0, -1.0, 0.0}, {1.0, 0.0, 1.0}, {0.0, 1.0, 1.0}, @@ -85,25 +83,29 @@ static const double SlipDirections[12][3] = {{0.0, 1.0, -1.0}, {1.0, 0.0, -1.0}, static const double SlipPlanes[12][3] = {{1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, 1.0, -1.0}, {1.0, 1.0, -1.0}, {1.0, 1.0, -1.0}, {1.0, -1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, -1.0, 1.0}, {-1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0}}; +static const double sqrtHalf = std::sqrt(0.5); +static const double sqrtOneThird = std::sqrt(0.3333333333333333333); +static const double sqrtThree = std::sqrt(3.0); + // Rotation Point Group: 432 /* clang-format off */ -static const std::vector QuatSym ={ +static const std::vector k_QuatSym ={ QuatD(0.0, 0.0, 0.0, 1.0), QuatD(1.0, 0.0, 0.0, 0.0), QuatD(0.0, 1.0, 0.0, 0.0), QuatD(0.0, 0.0, 1.0, 0.0), - QuatD(0.7071067811865476, 0.0, 0.0, 0.7071067811865476), - QuatD(0.0, 0.7071067811865476, 0.0, 0.7071067811865476), - QuatD(0.0, 0.0, 0.7071067811865476, 0.7071067811865476), - QuatD(-0.7071067811865476, 0.0, 0.0, 0.7071067811865476), - QuatD(0.0, -0.7071067811865476, 0.0, 0.7071067811865476), - QuatD(0.0, 0.0, -0.7071067811865476, 0.7071067811865476), - QuatD(0.7071067811865476, 0.7071067811865476, 0.0, 0.0), - QuatD(-0.7071067811865476, 0.7071067811865476, 0.0, 0.0), - QuatD(0.0, 0.7071067811865476, 0.7071067811865476, 0.0), - QuatD(0.0, -0.7071067811865476, 0.7071067811865476, 0.0), - QuatD(0.7071067811865476, 0.0, 0.7071067811865476, 0.0), - QuatD(-0.7071067811865476, 0.0, 0.7071067811865476, 0.0), + QuatD(sqrtHalf, 0.0, 0.0, sqrtHalf), + QuatD(0.0, sqrtHalf, 0.0, sqrtHalf), + QuatD(0.0, 0.0, sqrtHalf, sqrtHalf), + QuatD(-sqrtHalf, 0.0, 0.0, sqrtHalf), + QuatD(0.0, -sqrtHalf, 0.0, sqrtHalf), + QuatD(0.0, 0.0, -sqrtHalf, sqrtHalf), + QuatD(sqrtHalf, sqrtHalf, 0.0, 0.0), + QuatD(-sqrtHalf, sqrtHalf, 0.0, 0.0), + QuatD(0.0, sqrtHalf, sqrtHalf, 0.0), + QuatD(0.0, -sqrtHalf, sqrtHalf, 0.0), + QuatD(sqrtHalf, 0.0, sqrtHalf, 0.0), + QuatD(-sqrtHalf, 0.0, sqrtHalf, 0.0), QuatD(0.5, 0.5, 0.5, 0.5), QuatD(-0.5, -0.5, -0.5, 0.5), QuatD(0.5, -0.5, 0.5, 0.5), @@ -114,7 +116,7 @@ static const std::vector QuatSym ={ QuatD(0.5, 0.5, -0.5, 0.5), }; -static const std::vector RodSym = { +static const std::vector k_RodSym = { {0.0, 0.0, 1.0, 0.0}, {1.0, 0.0, 0.0, 10000000000000.0}, {0.0, 1.0, 0.0, 10000000000000.0}, @@ -125,138 +127,133 @@ static const std::vector RodSym = { {-1.0, 0.0, 0.0, 1.0}, {0.0, -1.0, 0.0, 1.0}, {0.0, 0.0, -1.0, 1.0}, - {0.7071067811865476, 0.7071067811865476, 0.0, 10000000000000.0}, - {-0.7071067811865476, 0.7071067811865476, 0.0, 10000000000000.0}, - {0.0, 0.7071067811865476, 0.7071067811865476, 10000000000000.0}, - {0.0, -0.7071067811865476, 0.7071067811865476, 10000000000000.0}, - {0.7071067811865476, 0.0, 0.7071067811865476, 10000000000000.0}, - {-0.7071067811865476, 0.0, 0.7071067811865476, 10000000000000.0}, - {0.5773502691896258, 0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, -0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, - {0.5773502691896258, -0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, 0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, 0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {0.5773502691896258, -0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, - {-0.5773502691896258, -0.5773502691896258, 0.5773502691896258, 1.7320508075688767}, - {0.5773502691896258, 0.5773502691896258, -0.5773502691896258, 1.7320508075688767}, + {sqrtHalf, sqrtHalf, 0.0, 10000000000000.0}, + {-sqrtHalf, sqrtHalf, 0.0, 10000000000000.0}, + {0.0, sqrtHalf, sqrtHalf, 10000000000000.0}, + {0.0, -sqrtHalf, sqrtHalf, 10000000000000.0}, + {sqrtHalf, 0.0, sqrtHalf, 10000000000000.0}, + {-sqrtHalf, 0.0, sqrtHalf, 10000000000000.0}, + {sqrtOneThird, sqrtOneThird, sqrtOneThird, sqrtThree}, + {-sqrtOneThird, -sqrtOneThird, -sqrtOneThird, sqrtThree}, + {sqrtOneThird, -sqrtOneThird, sqrtOneThird, sqrtThree}, + {-sqrtOneThird, sqrtOneThird, -sqrtOneThird, sqrtThree}, + {-sqrtOneThird, sqrtOneThird, sqrtOneThird, sqrtThree}, + {sqrtOneThird, -sqrtOneThird, -sqrtOneThird, sqrtThree}, + {-sqrtOneThird, -sqrtOneThird, sqrtOneThird, sqrtThree}, + {sqrtOneThird, sqrtOneThird, -sqrtOneThird, sqrtThree}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{1.0, 0.0, 0.0}, - {0.0, 0.0, -1.0}, - {0.0, 1.0, 0.0}}, - - {{0.0, 0.0, 1.0}, - {0.0, 1.0, 0.0}, - {-1.0, 0.0, 0.0}}, - - {{0.0, -1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{1.0, -0.0, 0.0}, - {0.0, 0.0, 1.0}, - {-0.0, -1.0, 0.0}}, - - {{0.0, -0.0, -1.0}, - {0.0, 1.0, -0.0}, - {1.0, 0.0, 0.0}}, - - {{0.0, 1.0, 0.0}, - {-1.0, 0.0, -0.0}, - {-0.0, 0.0, 1.0}}, - - {{0.0, 1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{0.0, -1.0, 0.0}, - {-1.0, 0.0, 0.0}, - {-0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, 0.0, 1.0}, - {0.0, 1.0, 0.0}}, - - {{-1.0, -0.0, 0.0}, - {0.0, 0.0, -1.0}, - {0.0, -1.0, 0.0}}, - - {{0.0, 0.0, 1.0}, - {0.0, -1.0, 0.0}, - {1.0, 0.0, 0.0}}, - - {{0.0, -0.0, -1.0}, - {0.0, -1.0, 0.0}, - {-1.0, 0.0, 0.0}}, - - {{0.0, 0.0, 1.0}, - {1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}}, - - {{0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}, - {1.0, 0.0, 0.0}}, - - {{0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}, - {1.0, 0.0, 0.0}}, - - {{0.0, 0.0, 1.0}, - {-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}}, - - {{0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {-1.0, 0.0, 0.0}}, - - {{0.0, 0.0, -1.0}, - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}}, - - {{0.0, 0.0, -1.0}, - {1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}}, - - {{0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}, - {-1.0, 0.0, 0.0}}, +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0}, + + {1.0, 0.0, 0.0, + 0.0, 0.0, -1.0, + 0.0, 1.0, 0.0}, + + {0.0, 0.0, 1.0, + 0.0, 1.0, 0.0, + -1.0, 0.0, 0.0}, + + {0.0, -1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0}, + + {1.0, -0.0, 0.0, + 0.0, 0.0, 1.0, + -0.0, -1.0, 0.0}, + + {0.0, -0.0, -1.0, + 0.0, 1.0, -0.0, + 1.0, 0.0, 0.0}, + + {0.0, 1.0, 0.0, + -1.0, 0.0, -0.0, + -0.0, 0.0, 1.0}, + + {0.0, 1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, -1.0}, + + {0.0, -1.0, 0.0, + -1.0, 0.0, 0.0, + -0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, + 0.0, 1.0, 0.0}, + + {-1.0, -0.0, 0.0, + 0.0, 0.0, -1.0, + 0.0, -1.0, 0.0}, + + {0.0, 0.0, 1.0, + 0.0, -1.0, 0.0, + 1.0, 0.0, 0.0}, + + {0.0, -0.0, -1.0, + 0.0, -1.0, 0.0, + -1.0, 0.0, 0.0}, + + {0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0}, + + {0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0}, + + {0.0, -1.0, 0.0, + 0.0, 0.0, -1.0, + 1.0, 0.0, 0.0}, + + {0.0, 0.0, 1.0, + -1.0, 0.0, 0.0, + 0.0, -1.0, 0.0}, + + {0.0, -1.0, 0.0, + 0.0, 0.0, 1.0, + -1.0, 0.0, 0.0}, + + {0.0, 0.0, -1.0, + -1.0, 0.0, 0.0, + 0.0, 1.0, 0.0}, + + {0.0, 0.0, -1.0, + 1.0, 0.0, 0.0, + 0.0, -1.0, 0.0}, + + {0.0, 1.0, 0.0, + 0.0, 0.0, -1.0, + -1.0, 0.0, 0.0}, }; /* clang-format on */ + constexpr double k_EtaMin = 0.0; constexpr double k_EtaMax = 45.0; } // namespace CubicHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CubicOps::CubicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- CubicOps::~CubicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool CubicOps::getHasInversion() const { @@ -264,9 +261,7 @@ bool CubicOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int CubicOps::getODFSize() const +size_t CubicOps::getODFSize() const { return CubicHigh::k_OdfSize; } @@ -274,13 +269,11 @@ int CubicOps::getODFSize() const // ----------------------------------------------------------------------------- std::array CubicOps::getNumSymmetry() const { - return {CubicHigh::symSize0, CubicHigh::symSize1, CubicHigh::symSize2}; + return {CubicHigh::k_SymSize0, CubicHigh::k_SymSize1, CubicHigh::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int CubicOps::getMDFSize() const +size_t CubicOps::getMDFSize() const { return CubicHigh::k_MdfSize; } @@ -292,9 +285,7 @@ int CubicOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int CubicOps::getNumSymOps() const +size_t CubicOps::getNumSymOps() const { return CubicHigh::k_SymOpsCount; } @@ -302,19 +293,15 @@ int CubicOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array CubicOps::getOdfNumBins() const { - return CubicHigh::OdfNumBins; + return CubicHigh::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string CubicOps::getSymmetryName() const { return "Cubic m-3m (Oh)"; /* Group 432 */ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string CubicOps::getRotationPointGroup() const { @@ -339,16 +326,12 @@ bool CubicOps::isInsideFZ(const RodriguesDType& rod) const return IsInsideFZ(rod, getFZType(), getAxisOrderingType()); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AxisAngleDType CubicOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(CubicHigh::QuatSym, q1, q2); + return calculateMisorientationInternal(CubicHigh::k_QuatSym, q1, q2); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AxisAngleDType CubicOps::calculateMisorientationInternal(const std::vector& quatsym, const QuatD& q1, const QuatD& q2) const { @@ -604,44 +587,39 @@ AxisAngleDType CubicOps::calculateMisorientationInternal(const std::vector(CubicHigh::MatSym[i][0][0]), static_cast(CubicHigh::MatSym[i][0][1]), static_cast(CubicHigh::MatSym[i][0][2]), - static_cast(CubicHigh::MatSym[i][1][0]), static_cast(CubicHigh::MatSym[i][1][1]), static_cast(CubicHigh::MatSym[i][1][2]), - static_cast(CubicHigh::MatSym[i][2][0]), static_cast(CubicHigh::MatSym[i][2][1]), static_cast(CubicHigh::MatSym[i][2][2])}; + return {static_cast(CubicHigh::k_MatSym[i](0, 0)), static_cast(CubicHigh::k_MatSym[i](0, 1)), static_cast(CubicHigh::k_MatSym[i](0, 2)), + static_cast(CubicHigh::k_MatSym[i](1, 0)), static_cast(CubicHigh::k_MatSym[i](1, 1)), static_cast(CubicHigh::k_MatSym[i](1, 2)), + static_cast(CubicHigh::k_MatSym[i](2, 0)), static_cast(CubicHigh::k_MatSym[i](2, 1)), static_cast(CubicHigh::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType CubicOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType CubicOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -702,23 +680,21 @@ RodriguesDType CubicOps::getMDFFZRod(const RodriguesDType& inRod) const QuatD CubicOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(CubicHigh::QuatSym, q1, q2); + return _calcNearestQuat(CubicHigh::k_QuatSym, q1, q2); } QuatF CubicOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(CubicHigh::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(CubicHigh::k_QuatSym, q1f.to(), q2f.to()).to(); } QuatD CubicOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(CubicHigh::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(CubicHigh::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CubicOps::getMisoBin(const RodriguesDType& rod) const { @@ -728,21 +704,19 @@ int CubicOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = CubicHigh::OdfDimInitValue[0]; - dim[1] = CubicHigh::OdfDimInitValue[1]; - dim[2] = CubicHigh::OdfDimInitValue[2]; - step[0] = CubicHigh::OdfDimStepValue[0]; - step[1] = CubicHigh::OdfDimStepValue[1]; - step[2] = CubicHigh::OdfDimStepValue[2]; - bins[0] = static_cast(CubicHigh::OdfNumBins[0]); - bins[1] = static_cast(CubicHigh::OdfNumBins[1]); - bins[2] = static_cast(CubicHigh::OdfNumBins[2]); + dim[0] = CubicHigh::k_OdfDimInitValue[0]; + dim[1] = CubicHigh::k_OdfDimInitValue[1]; + dim[2] = CubicHigh::k_OdfDimInitValue[2]; + step[0] = CubicHigh::k_OdfDimStepValue[0]; + step[1] = CubicHigh::k_OdfDimStepValue[1]; + step[2] = CubicHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(CubicHigh::k_OdfNumBins[0]); + bins[1] = static_cast(CubicHigh::k_OdfNumBins[1]); + bins[2] = static_cast(CubicHigh::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType CubicOps::determineEulerAngles(double random[3], int choose) const { @@ -751,15 +725,15 @@ EulerDType CubicOps::determineEulerAngles(double random[3], int choose) const int32_t phi[3]; double h1, h2, h3; - init[0] = CubicHigh::OdfDimInitValue[0]; - init[1] = CubicHigh::OdfDimInitValue[1]; - init[2] = CubicHigh::OdfDimInitValue[2]; - step[0] = CubicHigh::OdfDimStepValue[0]; - step[1] = CubicHigh::OdfDimStepValue[1]; - step[2] = CubicHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % CubicHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / CubicHigh::OdfNumBins[0]) % CubicHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (CubicHigh::OdfNumBins[0] * CubicHigh::OdfNumBins[1])); + init[0] = CubicHigh::k_OdfDimInitValue[0]; + init[1] = CubicHigh::k_OdfDimInitValue[1]; + init[2] = CubicHigh::k_OdfDimInitValue[2]; + step[0] = CubicHigh::k_OdfDimStepValue[0]; + step[1] = CubicHigh::k_OdfDimStepValue[1]; + step[2] = CubicHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % CubicHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / CubicHigh::k_OdfNumBins[0]) % CubicHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (CubicHigh::k_OdfNumBins[0] * CubicHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -769,19 +743,15 @@ EulerDType CubicOps::determineEulerAngles(double random[3], int choose) const return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType CubicOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(CubicHigh::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = CubicHigh::QuatSym[symOp] * quat; + QuatD qc = CubicHigh::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType CubicOps::determineRodriguesVector(double random[3], int choose) const { @@ -790,15 +760,15 @@ RodriguesDType CubicOps::determineRodriguesVector(double random[3], int choose) int32_t phi[3]; double h1, h2, h3; - init[0] = CubicHigh::OdfDimInitValue[0]; - init[1] = CubicHigh::OdfDimInitValue[1]; - init[2] = CubicHigh::OdfDimInitValue[2]; - step[0] = CubicHigh::OdfDimStepValue[0]; - step[1] = CubicHigh::OdfDimStepValue[1]; - step[2] = CubicHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % CubicHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / CubicHigh::OdfNumBins[0]) % CubicHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (CubicHigh::OdfNumBins[0] * CubicHigh::OdfNumBins[1])); + init[0] = CubicHigh::k_OdfDimInitValue[0]; + init[1] = CubicHigh::k_OdfDimInitValue[1]; + init[2] = CubicHigh::k_OdfDimInitValue[2]; + step[0] = CubicHigh::k_OdfDimStepValue[0]; + step[1] = CubicHigh::k_OdfDimStepValue[1]; + step[2] = CubicHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % CubicHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / CubicHigh::k_OdfNumBins[0]) % CubicHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (CubicHigh::k_OdfNumBins[0] * CubicHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -806,8 +776,6 @@ RodriguesDType CubicOps::determineRodriguesVector(double random[3], int choose) return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int CubicOps::getOdfBin(const RodriguesDType& rod) const { @@ -817,15 +785,15 @@ int CubicOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = CubicHigh::OdfDimInitValue[0]; - dim[1] = CubicHigh::OdfDimInitValue[1]; - dim[2] = CubicHigh::OdfDimInitValue[2]; - step[0] = CubicHigh::OdfDimStepValue[0]; - step[1] = CubicHigh::OdfDimStepValue[1]; - step[2] = CubicHigh::OdfDimStepValue[2]; - bins[0] = static_cast(CubicHigh::OdfNumBins[0]); - bins[1] = static_cast(CubicHigh::OdfNumBins[1]); - bins[2] = static_cast(CubicHigh::OdfNumBins[2]); + dim[0] = CubicHigh::k_OdfDimInitValue[0]; + dim[1] = CubicHigh::k_OdfDimInitValue[1]; + dim[2] = CubicHigh::k_OdfDimInitValue[2]; + step[0] = CubicHigh::k_OdfDimStepValue[0]; + step[1] = CubicHigh::k_OdfDimStepValue[1]; + step[2] = CubicHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(CubicHigh::k_OdfNumBins[0]); + bins[1] = static_cast(CubicHigh::k_OdfNumBins[1]); + bins[2] = static_cast(CubicHigh::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -978,18 +946,18 @@ void CubicOps::getSchmidFactorAndSS(double load[3], double plane[3], double dire { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = CubicHigh::MatSym[i][2][0] * plane[0] + CubicHigh::MatSym[i][2][1] * plane[1] + CubicHigh::MatSym[i][2][2] * plane[2]; + slipPlane[2] = CubicHigh::k_MatSym[i](2, 0) * plane[0] + CubicHigh::k_MatSym[i](2, 1) * plane[1] + CubicHigh::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = CubicHigh::MatSym[i][0][0] * plane[0] + CubicHigh::MatSym[i][0][1] * plane[1] + CubicHigh::MatSym[i][0][2] * plane[2]; - slipPlane[1] = CubicHigh::MatSym[i][1][0] * plane[0] + CubicHigh::MatSym[i][1][1] * plane[1] + CubicHigh::MatSym[i][1][2] * plane[2]; + slipPlane[0] = CubicHigh::k_MatSym[i](0, 0) * plane[0] + CubicHigh::k_MatSym[i](0, 1) * plane[1] + CubicHigh::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = CubicHigh::k_MatSym[i](1, 0) * plane[0] + CubicHigh::k_MatSym[i](1, 1) * plane[1] + CubicHigh::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = CubicHigh::MatSym[i][0][0] * direction[0] + CubicHigh::MatSym[i][0][1] * direction[1] + CubicHigh::MatSym[i][0][2] * direction[2]; - slipDirection[1] = CubicHigh::MatSym[i][1][0] * direction[0] + CubicHigh::MatSym[i][1][1] * direction[1] + CubicHigh::MatSym[i][1][2] * direction[2]; - slipDirection[2] = CubicHigh::MatSym[i][2][0] * direction[0] + CubicHigh::MatSym[i][2][1] * direction[1] + CubicHigh::MatSym[i][2][2] * direction[2]; + slipDirection[0] = CubicHigh::k_MatSym[i](0, 0) * direction[0] + CubicHigh::k_MatSym[i](0, 1) * direction[1] + CubicHigh::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = CubicHigh::k_MatSym[i](1, 0) * direction[0] + CubicHigh::k_MatSym[i](1, 1) * direction[1] + CubicHigh::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = CubicHigh::k_MatSym[i](2, 0) * direction[0] + CubicHigh::k_MatSym[i](2, 1) * direction[1] + CubicHigh::k_MatSym[i](2, 2) * direction[2]; double cosPhi = std::fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; double cosLambda = std::fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; @@ -1006,14 +974,15 @@ void CubicOps::getSchmidFactorAndSS(double load[3], double plane[3], double dire } } -double CubicOps::getmPrime(const QuatD& q1, const QuatD& q2, double LD[3]) const +double CubicOps::getmPrime(const QuatD& q1, const QuatD& q2, double LDPtr[3]) const { - ebsdlib::Matrix3X1D hkl1; - ebsdlib::Matrix3X1D uvw1; - ebsdlib::Matrix3X1D hkl2; - ebsdlib::Matrix3X1D uvw2; - ebsdlib::Matrix3X1D slipDirection; - ebsdlib::Matrix3X1D slipPlane; + Matrix3X1D hkl1; + Matrix3X1D uvw1; + Matrix3X1D hkl2; + Matrix3X1D uvw2; + Matrix3X1D slipDirection; + Matrix3X1D slipPlane; + Matrix3X1D LD(LDPtr); double schmidFactor1 = 0, schmidFactor2 = 0, maxSchmidFactor = 0; double directionComponent1 = 0, planeComponent1 = 0; @@ -1021,8 +990,8 @@ double CubicOps::getmPrime(const QuatD& q1, const QuatD& q2, double LD[3]) const double planeMisalignment = 0, directionMisalignment = 0; int ss1 = 0, ss2 = 0; - ebsdlib::Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); - ebsdlib::Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); + Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); + Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); for(int i = 0; i < 12; i++) { @@ -1036,8 +1005,8 @@ double CubicOps::getmPrime(const QuatD& q1, const QuatD& q2, double LD[3]) const uvw1 = g1 * slipDirection; hkl1 = hkl1.normalize(); uvw1 = uvw1.normalize(); - directionComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, uvw1.data())); - planeComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, hkl1.data())); + directionComponent1 = std::fabs(LD.cosTheta(uvw1)); + planeComponent1 = std::fabs(LD.cosTheta(hkl1)); schmidFactor1 = directionComponent1 * planeComponent1; if(schmidFactor1 > maxSchmidFactor) { @@ -1073,8 +1042,8 @@ double CubicOps::getmPrime(const QuatD& q1, const QuatD& q2, double LD[3]) const hkl2 = hkl2.normalize(); uvw2 = uvw2.normalize(); - directionComponent2 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, uvw2.data())); - planeComponent2 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, hkl2.data())); + directionComponent2 = std::fabs(LD.cosTheta(uvw2)); + planeComponent2 = std::fabs(LD.cosTheta(hkl2)); schmidFactor2 = directionComponent2 * planeComponent2; if(schmidFactor2 > maxSchmidFactor) { @@ -1094,19 +1063,20 @@ double CubicOps::getmPrime(const QuatD& q1, const QuatD& q2, double LD[3]) const hkl2 = hkl2.normalize(); uvw2 = uvw2.normalize(); - planeMisalignment = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(hkl1.data(), hkl2.data())); - directionMisalignment = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(uvw1.data(), uvw2.data())); + planeMisalignment = std::fabs(hkl1.cosTheta(hkl2)); + directionMisalignment = std::fabs(uvw1.cosTheta(uvw2)); return planeMisalignment * directionMisalignment; } -double CubicOps::getF1(const QuatD& q1, const QuatD& q2, double LD[3], bool maxSF) const +double CubicOps::getF1(const QuatD& q1, const QuatD& q2, double LDPtr[3], bool maxSF) const { - ebsdlib::Matrix3X1D hkl1; - ebsdlib::Matrix3X1D uvw1; - ebsdlib::Matrix3X1D hkl2; - ebsdlib::Matrix3X1D uvw2; - ebsdlib::Matrix3X1D slipDirection; - ebsdlib::Matrix3X1D slipPlane; + Matrix3X1D hkl1; + Matrix3X1D uvw1; + Matrix3X1D hkl2; + Matrix3X1D uvw2; + Matrix3X1D slipDirection; + Matrix3X1D slipPlane; + Matrix3X1D LD(LDPtr); double directionMisalignment = 0, totalDirectionMisalignment = 0; double schmidFactor1 = 0, maxSchmidFactor = 0; @@ -1115,10 +1085,9 @@ double CubicOps::getF1(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS double maxF1 = 0.0; double F1 = 0.0; - ebsdlib::Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); - ebsdlib::Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); - - ebsdlib::EbsdMatrixMath::Normalize3x1(LD); + Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); + Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); + LD = LD.normalize(); if(maxSF) { @@ -1136,8 +1105,8 @@ double CubicOps::getF1(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS uvw1 = g1 * slipDirection; hkl1 = hkl1.normalize(); uvw1 = uvw1.normalize(); - directionComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, uvw1.data())); - planeComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, hkl1.data())); + directionComponent1 = std::fabs(LD.cosTheta(uvw1)); + planeComponent1 = std::fabs(LD.cosTheta(hkl1)); schmidFactor1 = directionComponent1 * planeComponent1; if(schmidFactor1 > maxSchmidFactor || !maxSF) { @@ -1159,7 +1128,7 @@ double CubicOps::getF1(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS hkl2 = hkl2.normalize(); uvw2 = uvw2.normalize(); - directionMisalignment = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(uvw1.data(), uvw2.data())); + directionMisalignment = std::fabs(uvw1.cosTheta(uvw2)); totalDirectionMisalignment = totalDirectionMisalignment + directionMisalignment; } F1 = schmidFactor1 * directionComponent1 * totalDirectionMisalignment; @@ -1179,14 +1148,15 @@ double CubicOps::getF1(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS return F1; } -double CubicOps::getF1spt(const QuatD& q1, const QuatD& q2, double LD[3], bool maxSF) const +double CubicOps::getF1spt(const QuatD& q1, const QuatD& q2, double LDPtr[3], bool maxSF) const { - ebsdlib::Matrix3X1D hkl1; - ebsdlib::Matrix3X1D uvw1; - ebsdlib::Matrix3X1D hkl2; - ebsdlib::Matrix3X1D uvw2; - ebsdlib::Matrix3X1D slipDirection; - ebsdlib::Matrix3X1D slipPlane; + Matrix3X1D hkl1; + Matrix3X1D uvw1; + Matrix3X1D hkl2; + Matrix3X1D uvw2; + Matrix3X1D slipDirection; + Matrix3X1D slipPlane; + Matrix3X1D LD(LDPtr); double directionMisalignment = 0, totalDirectionMisalignment = 0; double planeMisalignment = 0, totalPlaneMisalignment = 0; @@ -1195,10 +1165,10 @@ double CubicOps::getF1spt(const QuatD& q1, const QuatD& q2, double LD[3], bool m double maxF1spt = 0.0; double F1spt = 0.0f; - ebsdlib::Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); - ebsdlib::Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); + Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); + Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); - ebsdlib::EbsdMatrixMath::Normalize3x1(LD); + LD = LD.normalize(); if(maxSF) { @@ -1218,8 +1188,8 @@ double CubicOps::getF1spt(const QuatD& q1, const QuatD& q2, double LD[3], bool m hkl1 = hkl1.normalize(); uvw1 = uvw1.normalize(); - directionComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, uvw1.data())); - planeComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, hkl1.data())); + directionComponent1 = std::fabs(LD.cosTheta(uvw1)); + planeComponent1 = std::fabs(LD.cosTheta(hkl1)); schmidFactor1 = directionComponent1 * planeComponent1; if(schmidFactor1 > maxSchmidFactor || !maxSF) { @@ -1243,8 +1213,8 @@ double CubicOps::getF1spt(const QuatD& q1, const QuatD& q2, double LD[3], bool m hkl2 = hkl2.normalize(); uvw2 = uvw2.normalize(); - directionMisalignment = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(uvw1.data(), uvw2.data())); - planeMisalignment = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(hkl1.data(), hkl2.data())); + directionMisalignment = std::fabs(uvw1.cosTheta(uvw2)); + planeMisalignment = std::fabs(hkl1.cosTheta(hkl2)); totalDirectionMisalignment = totalDirectionMisalignment + directionMisalignment; totalPlaneMisalignment = totalPlaneMisalignment + planeMisalignment; } @@ -1265,14 +1235,15 @@ double CubicOps::getF1spt(const QuatD& q1, const QuatD& q2, double LD[3], bool m return F1spt; } -double CubicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool maxSF) const +double CubicOps::getF7(const QuatD& q1, const QuatD& q2, double LDPtr[3], bool maxSF) const { - ebsdlib::Matrix3X1D hkl1; - ebsdlib::Matrix3X1D uvw1; - ebsdlib::Matrix3X1D hkl2; - ebsdlib::Matrix3X1D uvw2; - ebsdlib::Matrix3X1D slipDirection; - ebsdlib::Matrix3X1D slipPlane; + Matrix3X1D hkl1; + Matrix3X1D uvw1; + Matrix3X1D hkl2; + Matrix3X1D uvw2; + Matrix3X1D slipDirection; + Matrix3X1D slipPlane; + Matrix3X1D LD(LDPtr); double directionMisalignment = 0, totalDirectionMisalignment = 0; double schmidFactor1 = 0.0, maxSchmidFactor = 0.0; @@ -1283,10 +1254,10 @@ double CubicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS double maxF7 = 0.0; double F7 = 0.0f; - ebsdlib::Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); - ebsdlib::Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); + Matrix3X3D g1 = QuaternionDType(q1).toOrientationMatrix().toGMatrix().transpose(); + Matrix3X3D g2 = QuaternionDType(q2).toOrientationMatrix().toGMatrix().transpose(); - ebsdlib::EbsdMatrixMath::Normalize3x1(LD); + LD = LD.normalize(); for(int i = 0; i < 12; i++) { @@ -1300,8 +1271,8 @@ double CubicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS uvw1 = g1 * slipDirection; hkl1 = hkl1.normalize(); uvw1 = uvw1.normalize(); - directionComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, uvw1.data())); - planeComponent1 = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(LD, hkl1.data())); + directionComponent1 = std::fabs(LD.cosTheta(uvw1)); + planeComponent1 = std::fabs(LD.cosTheta(hkl1)); schmidFactor1 = directionComponent1 * planeComponent1; if(schmidFactor1 > maxSchmidFactor || !maxSF) { @@ -1323,7 +1294,7 @@ double CubicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS hkl2 = hkl2.normalize(); uvw2 = uvw2.normalize(); - directionMisalignment = std::fabs(ebsdlib::GeometryMath::CosThetaBetweenVectors(uvw1.data(), uvw2.data())); + directionMisalignment = std::fabs(uvw1.cosTheta(uvw2)); totalDirectionMisalignment = totalDirectionMisalignment + directionMisalignment; } F7 = directionComponent1 * directionComponent1 * totalDirectionMisalignment; @@ -1343,8 +1314,6 @@ double CubicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool maxS return F7; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- namespace CubicHigh { @@ -1367,13 +1336,13 @@ class GenerateSphereCoordsImpl void generate(size_t start, size_t end) const { - ebsdlib::Matrix3X3D gTranspose; - ebsdlib::Matrix3X1D direction(0.0, 0.0, 0.0); + Matrix3X3D gTranspose; + Matrix3X1D direction(0.0, 0.0, 0.0); for(size_t i = start; i < end; ++i) { - ebsdlib::Matrix3X3D g(EulerDType(m_Eulers->getValue(i * 3), m_Eulers->getValue(i * 3 + 1), m_Eulers->getValue(i * 3 + 2)).toOrientationMatrix().data()); + Matrix3X3D g(EulerDType(m_Eulers->getValue(i * 3), m_Eulers->getValue(i * 3 + 1), m_Eulers->getValue(i * 3 + 2)).toOrientationMatrix().data()); gTranspose = g.transpose(); // ----------------------------------------------------------------------------- @@ -1487,25 +1456,23 @@ class GenerateSphereCoordsImpl }; } // namespace CubicHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void CubicOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * CubicHigh::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * CubicHigh::k_SymSize0) { - xyz001->resizeTuples(nOrientations * CubicHigh::symSize0 * 3); + xyz001->resizeTuples(nOrientations * CubicHigh::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * CubicHigh::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * CubicHigh::k_SymSize1) { - xyz011->resizeTuples(nOrientations * CubicHigh::symSize1 * 3); + xyz011->resizeTuples(nOrientations * CubicHigh::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * CubicHigh::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * CubicHigh::k_SymSize2) { - xyz111->resizeTuples(nOrientations * CubicHigh::symSize2 * 3); + xyz111->resizeTuples(nOrientations * CubicHigh::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -1678,8 +1645,6 @@ std::array CubicOps::getIpfColorAngleLimits(double eta) const return {CubicHigh::k_EtaMin * ebsdlib::constants::k_DegToRadD, CubicHigh::k_EtaMax * ebsdlib::constants::k_DegToRadD, chiMax}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool CubicOps::inUnitTriangle(double eta, double chi) const { @@ -1698,16 +1663,12 @@ bool CubicOps::inUnitTriangle(double eta, double chi) const return !(eta < CubicHigh::k_EtaMin || eta > (CubicHigh::k_EtaMax * ebsdlib::constants::k_PiOver180D) || chi < 0.0 || chi > chiMax); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb CubicOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb CubicOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -1716,14 +1677,12 @@ ebsdlib::Rgb CubicOps::generateIPFColor(double phi1, double phi, double phi2, do return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb CubicOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * CubicHigh::OdfDimInitValue[0]; - double range2 = 2.0f * CubicHigh::OdfDimInitValue[1]; - double range3 = 2.0f * CubicHigh::OdfDimInitValue[2]; + double range1 = 2.0f * CubicHigh::k_OdfDimInitValue[0]; + double range2 = 2.0f * CubicHigh::k_OdfDimInitValue[1]; + double range3 = 2.0f * CubicHigh::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -1734,16 +1693,12 @@ ebsdlib::Rgb CubicOps::generateRodriguesColor(double r1, double r2, double r3) c return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array CubicOps::getDefaultPoleFigureNames() const { return {"<001>", "<011>", "<111>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector CubicOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -1770,11 +1725,11 @@ std::vector CubicOps::generatePoleFigure(PoleF // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicHigh::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicHigh::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicHigh::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicHigh::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicHigh::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * CubicHigh::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -1782,7 +1737,7 @@ std::vector CubicOps::generatePoleFigure(PoleF generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -1935,7 +1890,7 @@ ebsdlib::UInt8ArrayType::Pointer CreateIPFLegend(const CubicOps* ops, int imageD double theta = 0.0f; double k_RootOfHalf = sqrtf(0.5f); - ebsdlib::Matrix3X1D orientation(0.0, 0.0, 0.0); + Matrix3X1D orientation(0.0, 0.0, 0.0); ebsdlib::Rgb color; size_t idx = 0; size_t yScanLineIndex = 0; // We use this to control where the data is drawn. Otherwise, the image will come out flipped vertically @@ -2026,10 +1981,9 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float }; std::vector drawAngle = {false, false, false, false, false, false, false, false}; - float radius = 1.0; // Work with a Unit Circle. for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -2270,13 +2224,13 @@ CubicOps::Pointer CubicOps::NullPointer() // ----------------------------------------------------------------------------- std::string CubicOps::getNameOfClass() const { - return std::string("CubicOps"); + return {"CubicOps"}; } // ----------------------------------------------------------------------------- std::string CubicOps::ClassName() { - return std::string("CubicOps"); + return {"CubicOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/CubicOps.h b/Source/EbsdLib/LaueOps/CubicOps.h index f19c861..742bdbf 100644 --- a/Source/EbsdLib/LaueOps/CubicOps.h +++ b/Source/EbsdLib/LaueOps/CubicOps.h @@ -85,10 +85,10 @@ class EbsdLib_EXPORT CubicOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -97,7 +97,7 @@ class EbsdLib_EXPORT CubicOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -109,7 +109,7 @@ class EbsdLib_EXPORT CubicOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -155,7 +155,7 @@ class EbsdLib_EXPORT CubicOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -168,15 +168,15 @@ class EbsdLib_EXPORT CubicOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp index 9999d73..21c716a 100644 --- a/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalLowOps.cpp @@ -57,70 +57,72 @@ using namespace ebsdlib; namespace HexagonalLow { -constexpr std::array OdfNumBins = {72, 72, 12}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiD / 6.0) - std::sin(ebsdlib::constants::k_PiD / 6.0))), (1.0 / 3.0))}; +constexpr std::array k_OdfNumBins = {72, 72, 12}; // Represents a 5Deg bin +static const std::array k_OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiD / 6.0) - std::sin(ebsdlib::constants::k_PiD / 6.0))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 2; -constexpr int symSize2 = 2; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 2; +constexpr int k_SymSize2 = 2; -constexpr int k_OdfSize = 62208; -constexpr int k_MdfSize = 62208; -constexpr int k_SymOpsCount = 6; +constexpr size_t k_OdfSize = 62208; +constexpr size_t k_MdfSize = 62208; +constexpr size_t k_SymOpsCount = 6; constexpr int k_NumMdfBins = 36; static double sq32 = std::sqrt(3.0) / 2.0; +static const double sqrtOneThird = std::sqrt(0.3333333333333333333); +static const double sqrtThree = std::sqrt(3.0); // Rotation Point Group: 6 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(0.0, 0.0, 0.5, sq32), - QuatD(0.0, 0.0, sq32, 0.5), - QuatD(0.0, 0.0, 1.0, 0.0), - QuatD(0.0, 0.0, sq32, -0.5), - QuatD(0.0, 0.0, 0.5, -sq32), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(0.0, 0.0, 0.5, sq32), + QuatD(0.0, 0.0, sq32, 0.5), + QuatD(0.0, 0.0, 1.0, 0.0), + QuatD(0.0, 0.0, sq32, -0.5), + QuatD(0.0, 0.0, 0.5, -sq32), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0, 0.5773502691896258}, - {0.0, 0.0, 1.0, 1.7320508075688767}, - {0.0, 0.0, 1.0, 10000000000000.0}, - {0.0, 0.0, sq32, 10000000000000.0}, - {0.0, 0.0, 0.5, 10000000000000.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0, sqrtOneThird}, + {0.0, 0.0, 1.0, sqrtThree}, + {0.0, 0.0, 1.0, 10000000000000.0}, + {0.0, 0.0, sq32, 10000000000000.0}, + {0.0, 0.0, 0.5, 10000000000000.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.5, -sq32, 0.0}, - {sq32, 0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, -sq32, 0.0}, - {sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, sq32, 0.0}, - {-sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.5, sq32, 0.0}, - {-sq32, 0.5, 0.0}, - {0.0, 0.0, 1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {0.5, -sq32, 0.0, + sq32, 0.5, 0.0, + 0.0, 0.0, 1.0}, + + {-0.5, -sq32, 0.0, + sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + + {-1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0}, + + {-0.5, sq32, 0.0, + -sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + + {0.5, sq32, 0.0, + -sq32, 0.5, 0.0, + 0.0, 0.0, 1.0}, + }; /* clang-format on */ @@ -129,18 +131,12 @@ constexpr double k_EtaMax = 60.0; constexpr double k_ChiMax = 90.0; } // namespace HexagonalLow -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- HexagonalLowOps::HexagonalLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- HexagonalLowOps::~HexagonalLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool HexagonalLowOps::getHasInversion() const { @@ -148,9 +144,7 @@ bool HexagonalLowOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int HexagonalLowOps::getODFSize() const +size_t HexagonalLowOps::getODFSize() const { return HexagonalLow::k_OdfSize; } @@ -158,13 +152,11 @@ int HexagonalLowOps::getODFSize() const // ----------------------------------------------------------------------------- std::array HexagonalLowOps::getNumSymmetry() const { - return {HexagonalLow::symSize0, HexagonalLow::symSize1, HexagonalLow::symSize2}; + return {HexagonalLow::k_SymSize0, HexagonalLow::k_SymSize1, HexagonalLow::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int HexagonalLowOps::getMDFSize() const +size_t HexagonalLowOps::getMDFSize() const { return HexagonalLow::k_MdfSize; } @@ -176,9 +168,7 @@ int HexagonalLowOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int HexagonalLowOps::getNumSymOps() const +size_t HexagonalLowOps::getNumSymOps() const { return HexagonalLow::k_SymOpsCount; } @@ -186,19 +176,15 @@ int HexagonalLowOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array HexagonalLowOps::getOdfNumBins() const { - return HexagonalLow::OdfNumBins; + return HexagonalLow::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string HexagonalLowOps::getSymmetryName() const { return "Hexagonal 6/m (C6h)"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string HexagonalLowOps::getRotationPointGroup() const { @@ -225,47 +211,42 @@ bool HexagonalLowOps::isInsideFZ(const RodriguesDType& rod) const AxisAngleDType HexagonalLowOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(HexagonalLow::QuatSym, q1, q2); + return calculateMisorientationInternal(HexagonalLow::k_QuatSym, q1, q2); } -QuatD HexagonalLowOps::getQuatSymOp(int32_t i) const +QuatD HexagonalLowOps::getQuatSymOp(size_t i) const { - return HexagonalLow::QuatSym[i]; + return HexagonalLow::k_QuatSym[i]; } -int32_t HexagonalLowOps::getNumRodriguesSymOps() const +size_t HexagonalLowOps::getNumRodriguesSymOps() const { - return HexagonalLow::RodSym.size(); + return HexagonalLow::k_RodSym.size(); } RodriguesDType HexagonalLowOps::getRodSymOp(size_t i) const { - return HexagonalLow::RodSym[i]; + return HexagonalLow::k_RodSym[i]; } -Matrix3X3D HexagonalLowOps::getMatSymOpD(int i) const +Matrix3X3D HexagonalLowOps::getMatSymOpD(size_t i) const { - return {HexagonalLow::MatSym[i][0][0], HexagonalLow::MatSym[i][0][1], HexagonalLow::MatSym[i][0][2], HexagonalLow::MatSym[i][1][0], HexagonalLow::MatSym[i][1][1], - HexagonalLow::MatSym[i][1][2], HexagonalLow::MatSym[i][2][0], HexagonalLow::MatSym[i][2][1], HexagonalLow::MatSym[i][2][2]}; + return HexagonalLow::k_MatSym[i]; } -Matrix3X3F HexagonalLowOps::getMatSymOpF(int i) const +Matrix3X3F HexagonalLowOps::getMatSymOpF(size_t i) const { - return {static_cast(HexagonalLow::MatSym[i][0][0]), static_cast(HexagonalLow::MatSym[i][0][1]), static_cast(HexagonalLow::MatSym[i][0][2]), - static_cast(HexagonalLow::MatSym[i][1][0]), static_cast(HexagonalLow::MatSym[i][1][1]), static_cast(HexagonalLow::MatSym[i][1][2]), - static_cast(HexagonalLow::MatSym[i][2][0]), static_cast(HexagonalLow::MatSym[i][2][1]), static_cast(HexagonalLow::MatSym[i][2][2])}; + return {static_cast(HexagonalLow::k_MatSym[i](0, 0)), static_cast(HexagonalLow::k_MatSym[i](0, 1)), static_cast(HexagonalLow::k_MatSym[i](0, 2)), + static_cast(HexagonalLow::k_MatSym[i](1, 0)), static_cast(HexagonalLow::k_MatSym[i](1, 1)), static_cast(HexagonalLow::k_MatSym[i](1, 2)), + static_cast(HexagonalLow::k_MatSym[i](2, 0)), static_cast(HexagonalLow::k_MatSym[i](2, 1)), static_cast(HexagonalLow::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType HexagonalLowOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType HexagonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -321,26 +302,22 @@ RodriguesDType HexagonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const QuatD HexagonalLowOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(HexagonalLow::QuatSym, q1, q2); + return _calcNearestQuat(HexagonalLow::k_QuatSym, q1, q2); } QuatF HexagonalLowOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(HexagonalLow::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(HexagonalLow::k_QuatSym, q1f.to(), q2f.to()).to(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD HexagonalLowOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(HexagonalLow::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(HexagonalLow::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int HexagonalLowOps::getMisoBin(const RodriguesDType& rod) const { @@ -350,21 +327,19 @@ int HexagonalLowOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = HexagonalLow::OdfDimInitValue[0]; - dim[1] = HexagonalLow::OdfDimInitValue[1]; - dim[2] = HexagonalLow::OdfDimInitValue[2]; - step[0] = HexagonalLow::OdfDimStepValue[0]; - step[1] = HexagonalLow::OdfDimStepValue[1]; - step[2] = HexagonalLow::OdfDimStepValue[2]; - bins[0] = static_cast(HexagonalLow::OdfNumBins[0]); - bins[1] = static_cast(HexagonalLow::OdfNumBins[1]); - bins[2] = static_cast(HexagonalLow::OdfNumBins[2]); + dim[0] = HexagonalLow::k_OdfDimInitValue[0]; + dim[1] = HexagonalLow::k_OdfDimInitValue[1]; + dim[2] = HexagonalLow::k_OdfDimInitValue[2]; + step[0] = HexagonalLow::k_OdfDimStepValue[0]; + step[1] = HexagonalLow::k_OdfDimStepValue[1]; + step[2] = HexagonalLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(HexagonalLow::k_OdfNumBins[0]); + bins[1] = static_cast(HexagonalLow::k_OdfNumBins[1]); + bins[2] = static_cast(HexagonalLow::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType HexagonalLowOps::determineEulerAngles(double random[3], int choose) const { @@ -373,15 +348,15 @@ EulerDType HexagonalLowOps::determineEulerAngles(double random[3], int choose) c int32_t phi[3]; double h1, h2, h3; - init[0] = HexagonalLow::OdfDimInitValue[0]; - init[1] = HexagonalLow::OdfDimInitValue[1]; - init[2] = HexagonalLow::OdfDimInitValue[2]; - step[0] = HexagonalLow::OdfDimStepValue[0]; - step[1] = HexagonalLow::OdfDimStepValue[1]; - step[2] = HexagonalLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % HexagonalLow::OdfNumBins[0]); - phi[1] = static_cast((choose / HexagonalLow::OdfNumBins[0]) % HexagonalLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (HexagonalLow::OdfNumBins[0] * HexagonalLow::OdfNumBins[1])); + init[0] = HexagonalLow::k_OdfDimInitValue[0]; + init[1] = HexagonalLow::k_OdfDimInitValue[1]; + init[2] = HexagonalLow::k_OdfDimInitValue[2]; + step[0] = HexagonalLow::k_OdfDimStepValue[0]; + step[1] = HexagonalLow::k_OdfDimStepValue[1]; + step[2] = HexagonalLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % HexagonalLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / HexagonalLow::k_OdfNumBins[0]) % HexagonalLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (HexagonalLow::k_OdfNumBins[0] * HexagonalLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -391,19 +366,15 @@ EulerDType HexagonalLowOps::determineEulerAngles(double random[3], int choose) c return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType HexagonalLowOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(HexagonalLow::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = HexagonalLow::QuatSym[symOp] * quat; + QuatD qc = HexagonalLow::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType HexagonalLowOps::determineRodriguesVector(double random[3], int choose) const { @@ -412,15 +383,15 @@ RodriguesDType HexagonalLowOps::determineRodriguesVector(double random[3], int c int32_t phi[3]; double h1, h2, h3; - init[0] = HexagonalLow::OdfDimInitValue[0]; - init[1] = HexagonalLow::OdfDimInitValue[1]; - init[2] = HexagonalLow::OdfDimInitValue[2]; - step[0] = HexagonalLow::OdfDimStepValue[0]; - step[1] = HexagonalLow::OdfDimStepValue[1]; - step[2] = HexagonalLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % HexagonalLow::OdfNumBins[0]); - phi[1] = static_cast((choose / HexagonalLow::OdfNumBins[0]) % HexagonalLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (HexagonalLow::OdfNumBins[0] * HexagonalLow::OdfNumBins[1])); + init[0] = HexagonalLow::k_OdfDimInitValue[0]; + init[1] = HexagonalLow::k_OdfDimInitValue[1]; + init[2] = HexagonalLow::k_OdfDimInitValue[2]; + step[0] = HexagonalLow::k_OdfDimStepValue[0]; + step[1] = HexagonalLow::k_OdfDimStepValue[1]; + step[2] = HexagonalLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % HexagonalLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / HexagonalLow::k_OdfNumBins[0]) % HexagonalLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (HexagonalLow::k_OdfNumBins[0] * HexagonalLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -428,8 +399,6 @@ RodriguesDType HexagonalLowOps::determineRodriguesVector(double random[3], int c return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int HexagonalLowOps::getOdfBin(const RodriguesDType& rod) const { @@ -439,15 +408,15 @@ int HexagonalLowOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = HexagonalLow::OdfDimInitValue[0]; - dim[1] = HexagonalLow::OdfDimInitValue[1]; - dim[2] = HexagonalLow::OdfDimInitValue[2]; - step[0] = HexagonalLow::OdfDimStepValue[0]; - step[1] = HexagonalLow::OdfDimStepValue[1]; - step[2] = HexagonalLow::OdfDimStepValue[2]; - bins[0] = static_cast(HexagonalLow::OdfNumBins[0]); - bins[1] = static_cast(HexagonalLow::OdfNumBins[1]); - bins[2] = static_cast(HexagonalLow::OdfNumBins[2]); + dim[0] = HexagonalLow::k_OdfDimInitValue[0]; + dim[1] = HexagonalLow::k_OdfDimInitValue[1]; + dim[2] = HexagonalLow::k_OdfDimInitValue[2]; + step[0] = HexagonalLow::k_OdfDimStepValue[0]; + step[1] = HexagonalLow::k_OdfDimStepValue[1]; + step[2] = HexagonalLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(HexagonalLow::k_OdfNumBins[0]); + bins[1] = static_cast(HexagonalLow::k_OdfNumBins[1]); + bins[2] = static_cast(HexagonalLow::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -778,21 +747,21 @@ void HexagonalLowOps::getSchmidFactorAndSS(double load[3], double plane[3], doub { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = HexagonalLow::MatSym[i][2][0] * plane[0] + HexagonalLow::MatSym[i][2][1] * plane[1] + HexagonalLow::MatSym[i][2][2] * plane[2]; + slipPlane[2] = HexagonalLow::k_MatSym[i](2, 0) * plane[0] + HexagonalLow::k_MatSym[i](2, 1) * plane[1] + HexagonalLow::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = HexagonalLow::MatSym[i][0][0] * plane[0] + HexagonalLow::MatSym[i][0][1] * plane[1] + HexagonalLow::MatSym[i][0][2] * plane[2]; - slipPlane[1] = HexagonalLow::MatSym[i][1][0] * plane[0] + HexagonalLow::MatSym[i][1][1] * plane[1] + HexagonalLow::MatSym[i][1][2] * plane[2]; + slipPlane[0] = HexagonalLow::k_MatSym[i](0, 0) * plane[0] + HexagonalLow::k_MatSym[i](0, 1) * plane[1] + HexagonalLow::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = HexagonalLow::k_MatSym[i](1, 0) * plane[0] + HexagonalLow::k_MatSym[i](1, 1) * plane[1] + HexagonalLow::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = HexagonalLow::MatSym[i][0][0] * direction[0] + HexagonalLow::MatSym[i][0][1] * direction[1] + HexagonalLow::MatSym[i][0][2] * direction[2]; - slipDirection[1] = HexagonalLow::MatSym[i][1][0] * direction[0] + HexagonalLow::MatSym[i][1][1] * direction[1] + HexagonalLow::MatSym[i][1][2] * direction[2]; - slipDirection[2] = HexagonalLow::MatSym[i][2][0] * direction[0] + HexagonalLow::MatSym[i][2][1] * direction[1] + HexagonalLow::MatSym[i][2][2] * direction[2]; + slipDirection[0] = HexagonalLow::k_MatSym[i](0, 0) * direction[0] + HexagonalLow::k_MatSym[i](0, 1) * direction[1] + HexagonalLow::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = HexagonalLow::k_MatSym[i](1, 0) * direction[0] + HexagonalLow::k_MatSym[i](1, 1) * direction[1] + HexagonalLow::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = HexagonalLow::k_MatSym[i](2, 0) * direction[0] + HexagonalLow::k_MatSym[i](2, 1) * direction[1] + HexagonalLow::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -1066,8 +1035,6 @@ double HexagonalLowOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bo #endif } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace HexagonalLow { @@ -1161,17 +1128,17 @@ void HexagonalLowOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eu size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz0001->getNumberOfTuples() < nOrientations * HexagonalLow::symSize0) + if(xyz0001->getNumberOfTuples() < nOrientations * HexagonalLow::k_SymSize0) { - xyz0001->resizeTuples(nOrientations * HexagonalLow::symSize0 * 3); + xyz0001->resizeTuples(nOrientations * HexagonalLow::k_SymSize0 * 3); } - if(xyz1010->getNumberOfTuples() < nOrientations * HexagonalLow::symSize1) + if(xyz1010->getNumberOfTuples() < nOrientations * HexagonalLow::k_SymSize1) { - xyz1010->resizeTuples(nOrientations * HexagonalLow::symSize1 * 3); + xyz1010->resizeTuples(nOrientations * HexagonalLow::k_SymSize1 * 3); } - if(xyz1120->getNumberOfTuples() < nOrientations * HexagonalLow::symSize2) + if(xyz1120->getNumberOfTuples() < nOrientations * HexagonalLow::k_SymSize2) { - xyz1120->resizeTuples(nOrientations * HexagonalLow::symSize2 * 3); + xyz1120->resizeTuples(nOrientations * HexagonalLow::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -1194,8 +1161,6 @@ std::array HexagonalLowOps::getIpfColorAngleLimits(double eta) const return {HexagonalLow::k_EtaMin * ebsdlib::constants::k_DegToRadD, HexagonalLow::k_EtaMax * ebsdlib::constants::k_DegToRadD, HexagonalLow::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool HexagonalLowOps::inUnitTriangle(double eta, double chi) const { @@ -1203,16 +1168,12 @@ bool HexagonalLowOps::inUnitTriangle(double eta, double chi) const chi > (HexagonalLow::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb HexagonalLowOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb HexagonalLowOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -1221,14 +1182,12 @@ ebsdlib::Rgb HexagonalLowOps::generateIPFColor(double phi1, double phi, double p return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb HexagonalLowOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0 * HexagonalLow::OdfDimInitValue[0]; - double range2 = 2.0 * HexagonalLow::OdfDimInitValue[1]; - double range3 = 2.0 * HexagonalLow::OdfDimInitValue[2]; + double range1 = 2.0 * HexagonalLow::k_OdfDimInitValue[0]; + double range2 = 2.0 * HexagonalLow::k_OdfDimInitValue[1]; + double range3 = 2.0 * HexagonalLow::k_OdfDimInitValue[2]; double max1 = range1 / 2.0; double max2 = range2 / 2.0; double max3 = range3 / 2.0; @@ -1244,16 +1203,12 @@ ebsdlib::Rgb HexagonalLowOps::generateRodriguesColor(double r1, double r2, doubl return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array HexagonalLowOps::getDefaultPoleFigureNames() const { return {"<0001>", "<11-20>", "<2-1-10>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector HexagonalLowOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -1279,11 +1234,11 @@ std::vector HexagonalLowOps::generatePoleFigur // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalLow::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalLow::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalLow::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalLow::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalLow::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalLow::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0; @@ -1291,7 +1246,7 @@ std::vector HexagonalLowOps::generatePoleFigur generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -1508,10 +1463,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float +0.25F, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.25F, 0.5F, 1.0F, 1.1F, 1.0F, 1.0F, }; std::vector drawAngle = {true, true, true, false, false, false, false, false, false, false, false, false}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -1667,13 +1622,13 @@ HexagonalLowOps::Pointer HexagonalLowOps::NullPointer() // ----------------------------------------------------------------------------- std::string HexagonalLowOps::getNameOfClass() const { - return std::string("HexagonalLowOps"); + return {"HexagonalLowOps"}; } // ----------------------------------------------------------------------------- std::string HexagonalLowOps::ClassName() { - return std::string("HexagonalLowOps"); + return {"HexagonalLowOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/HexagonalLowOps.h b/Source/EbsdLib/LaueOps/HexagonalLowOps.h index b81279f..8a54952 100644 --- a/Source/EbsdLib/LaueOps/HexagonalLowOps.h +++ b/Source/EbsdLib/LaueOps/HexagonalLowOps.h @@ -86,10 +86,10 @@ class EbsdLib_EXPORT HexagonalLowOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -98,7 +98,7 @@ class EbsdLib_EXPORT HexagonalLowOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -110,7 +110,7 @@ class EbsdLib_EXPORT HexagonalLowOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -156,7 +156,7 @@ class EbsdLib_EXPORT HexagonalLowOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -169,15 +169,15 @@ class EbsdLib_EXPORT HexagonalLowOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/HexagonalOps.cpp b/Source/EbsdLib/LaueOps/HexagonalOps.cpp index 6314083..86b8f7e 100644 --- a/Source/EbsdLib/LaueOps/HexagonalOps.cpp +++ b/Source/EbsdLib/LaueOps/HexagonalOps.cpp @@ -59,128 +59,123 @@ using namespace ebsdlib; namespace HexagonalHigh { -constexpr std::array OdfNumBins = {36, 36, 12}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {36, 36, 12}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * (((ebsdlib::constants::k_PiOver2D)) - std::sin(((ebsdlib::constants::k_PiOver2D))))), (1.0 / 3.0)), - std::pow((0.75 * (((ebsdlib::constants::k_PiOver2D)) - std::sin(((ebsdlib::constants::k_PiOver2D))))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiD / 6.0) - std::sin(ebsdlib::constants::k_PiD / 6.0))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimInitValue = {std::pow((0.75 * (((ebsdlib::constants::k_PiOver2D)) - std::sin(((ebsdlib::constants::k_PiOver2D))))), (1.0 / 3.0)), + std::pow((0.75 * (((ebsdlib::constants::k_PiOver2D)) - std::sin(((ebsdlib::constants::k_PiOver2D))))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiD / 6.0) - std::sin(ebsdlib::constants::k_PiD / 6.0))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 6; -constexpr int symSize2 = 6; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 6; +constexpr int k_SymSize2 = 6; -constexpr int k_OdfSize = 15552; -constexpr int k_MdfSize = 15552; -constexpr int k_SymOpsCount = 12; +constexpr size_t k_OdfSize = 15552; +constexpr size_t k_MdfSize = 15552; +constexpr size_t k_SymOpsCount = 12; constexpr int k_NumMdfBins = 20; static double sq32 = std::sqrt(3.0) / 2.0; +static const double sqrtOneThird = std::sqrt(0.3333333333333333333); +static const double sqrtThree = std::sqrt(3.0); + // Rotation Point Group: 622 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(0.0, 0.0, 0.5, sq32), - QuatD(0.0, 0.0, sq32, 0.5), - QuatD(0.0, 0.0, 1.0, 0.0), - QuatD(0.0, 0.0, sq32, -0.5), - QuatD(0.0, 0.0, 0.5, -sq32), - QuatD(1.0, 0.0, 0.0, 0.0), - QuatD(sq32, 0.5, 0.0, 0.0), - QuatD(0.5, sq32, 0.0, 0.0), - QuatD(0.0, 1.0, 0.0, 0.0), - QuatD(-0.5, sq32, 0.0, 0.0), - QuatD(-sq32, 0.5, 0.0, 0.0), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(0.0, 0.0, 0.5, sq32), + QuatD(0.0, 0.0, sq32, 0.5), + QuatD(0.0, 0.0, 1.0, 0.0), + QuatD(0.0, 0.0, sq32, -0.5), + QuatD(0.0, 0.0, 0.5, -sq32), + QuatD(1.0, 0.0, 0.0, 0.0), + QuatD(sq32, 0.5, 0.0, 0.0), + QuatD(0.5, sq32, 0.0, 0.0), + QuatD(0.0, 1.0, 0.0, 0.0), + QuatD(-0.5, sq32, 0.0, 0.0), + QuatD(-sq32, 0.5, 0.0, 0.0), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0, 0.5773502691896258}, - {0.0, 0.0, 1.0, 1.7320508075688767}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0, sqrtOneThird}, + {0.0, 0.0, 1.0, sqrtThree}, + {0.0, 0.0, 1.0, 10000000000000.0}, + {0.0, 0.0, sq32, 10000000000000.0}, + {0.0, 0.0, 0.5, 10000000000000.0}, + {1.0, 0.0, 0.0, 10000000000000.0}, + {sq32, 0.5, 0.0, 10000000000000.0}, + {0.5, sq32, 0.0, 10000000000000.0}, + {0.0, 1.0, 0.0, 10000000000000.0}, + {-0.5, sq32, 0.0, 10000000000000.0}, + {-sq32, 0.5, 0.0, 10000000000000.0}, +}; - {0.0, 0.0, 1.0, 10000000000000.0}, - {0.0, 0.0, sq32, 10000000000000.0}, - {0.0, 0.0, 0.5, 10000000000000.0}, +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, - {1.0, 0.0, 0.0, 10000000000000.0}, - {sq32, 0.5, 0.0, 10000000000000.0}, - {0.5, sq32, 0.0, 10000000000000.0}, + {0.5, -sq32, 0.0, + sq32, 0.5, 0.0, + 0.0, 0.0, 1.0}, - {0.0, 1.0, 0.0, 10000000000000.0}, - {-0.5, sq32, 0.0, 10000000000000.0}, - {-sq32, 0.5, 0.0, 10000000000000.0}, -}; + {-0.5, -sq32, 0.0, + sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + + {-1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0}, + + {-0.5, sq32, 0.0, + -sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + + {0.5, sq32, 0.0, + -sq32, 0.5, 0.0, + 0.0, 0.0, 1.0}, + + {1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0}, + + {0.5, sq32, 0.0, + sq32, -0.5, 0.0, + 0.0, 0.0, -1.0}, + + {-0.5, sq32, 0.0, + sq32, 0.5, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-0.5, -sq32, 0.0, + -sq32, 0.5, 0.0, + -0.0, 0.0, -1.0}, + + {0.5, -sq32, 0.0, + -sq32, -0.5, 0.0, + -0.0, 0.0, -1.0}, -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.5, -sq32, 0.0}, - {sq32, 0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, -sq32, 0.0}, - {sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, sq32, 0.0}, - {-sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.5, sq32, 0.0}, - {-sq32, 0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{0.5, sq32, 0.0}, - {sq32, -0.5, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-0.5, sq32, 0.0}, - {sq32, 0.5, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-0.5, -sq32, 0.0}, - {-sq32, 0.5, 0.0}, - {-0.0, 0.0, -1.0}}, - - {{0.5, -sq32, 0.0}, - {-sq32, -0.5, 0.0}, - {-0.0, 0.0, -1.0}}, - }; /* clang-format on */ + constexpr double k_EtaMin = 0.0; constexpr double k_EtaMax = 30.0; constexpr double k_ChiMax = 90.0; // Use a namespace for some detail that only this class needs } // namespace HexagonalHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- HexagonalOps::HexagonalOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- HexagonalOps::~HexagonalOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool HexagonalOps::getHasInversion() const { @@ -188,9 +183,7 @@ bool HexagonalOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int HexagonalOps::getODFSize() const +size_t HexagonalOps::getODFSize() const { return HexagonalHigh::k_OdfSize; } @@ -198,13 +191,11 @@ int HexagonalOps::getODFSize() const // ----------------------------------------------------------------------------- std::array HexagonalOps::getNumSymmetry() const { - return {HexagonalHigh::symSize0, HexagonalHigh::symSize1, HexagonalHigh::symSize2}; + return {HexagonalHigh::k_SymSize0, HexagonalHigh::k_SymSize1, HexagonalHigh::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int HexagonalOps::getMDFSize() const +size_t HexagonalOps::getMDFSize() const { return HexagonalHigh::k_MdfSize; } @@ -216,9 +207,7 @@ int HexagonalOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int HexagonalOps::getNumSymOps() const +size_t HexagonalOps::getNumSymOps() const { return HexagonalHigh::k_SymOpsCount; } @@ -226,19 +215,15 @@ int HexagonalOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array HexagonalOps::getOdfNumBins() const { - return HexagonalHigh::OdfNumBins; + return HexagonalHigh::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string HexagonalOps::getSymmetryName() const { return "Hexagonal 6/mmm (D6h)"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string HexagonalOps::getRotationPointGroup() const { @@ -266,51 +251,46 @@ bool HexagonalOps::isInsideFZ(const RodriguesDType& rod) const // ----------------------------------------------------------------------------- AxisAngleDType HexagonalOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(HexagonalHigh::QuatSym, q1, q2); + return calculateMisorientationInternal(HexagonalHigh::k_QuatSym, q1, q2); } -QuatD HexagonalOps::getQuatSymOp(int32_t i) const +QuatD HexagonalOps::getQuatSymOp(size_t i) const { - return HexagonalHigh::QuatSym[i]; - // q.x = HexagonalHigh::QuatSym[i][0]; - // q.y = HexagonalHigh::QuatSym[i][1]; - // q.z = HexagonalHigh::QuatSym[i][2]; - // q.w = HexagonalHigh::QuatSym[i][3]; + return HexagonalHigh::k_QuatSym[i]; + // q.x = HexagonalHigh::k_QuatSym[i][0]; + // q.y = HexagonalHigh::k_QuatSym[i][1]; + // q.z = HexagonalHigh::k_QuatSym[i][2]; + // q.w = HexagonalHigh::k_QuatSym[i][3]; } -int32_t HexagonalOps::getNumRodriguesSymOps() const +size_t HexagonalOps::getNumRodriguesSymOps() const { - return HexagonalHigh::RodSym.size(); + return HexagonalHigh::k_RodSym.size(); } RodriguesDType HexagonalOps::getRodSymOp(size_t i) const { - return HexagonalHigh::RodSym[i]; + return HexagonalHigh::k_RodSym[i]; } -Matrix3X3D HexagonalOps::getMatSymOpD(int i) const +Matrix3X3D HexagonalOps::getMatSymOpD(size_t i) const { - return {HexagonalHigh::MatSym[i][0][0], HexagonalHigh::MatSym[i][0][1], HexagonalHigh::MatSym[i][0][2], HexagonalHigh::MatSym[i][1][0], HexagonalHigh::MatSym[i][1][1], - HexagonalHigh::MatSym[i][1][2], HexagonalHigh::MatSym[i][2][0], HexagonalHigh::MatSym[i][2][1], HexagonalHigh::MatSym[i][2][2]}; + return HexagonalHigh::k_MatSym[i]; } -Matrix3X3F HexagonalOps::getMatSymOpF(int i) const +Matrix3X3F HexagonalOps::getMatSymOpF(size_t i) const { - return {static_cast(HexagonalHigh::MatSym[i][0][0]), static_cast(HexagonalHigh::MatSym[i][0][1]), static_cast(HexagonalHigh::MatSym[i][0][2]), - static_cast(HexagonalHigh::MatSym[i][1][0]), static_cast(HexagonalHigh::MatSym[i][1][1]), static_cast(HexagonalHigh::MatSym[i][1][2]), - static_cast(HexagonalHigh::MatSym[i][2][0]), static_cast(HexagonalHigh::MatSym[i][2][1]), static_cast(HexagonalHigh::MatSym[i][2][2])}; + return {static_cast(HexagonalHigh::k_MatSym[i](0, 0)), static_cast(HexagonalHigh::k_MatSym[i](0, 1)), static_cast(HexagonalHigh::k_MatSym[i](0, 2)), + static_cast(HexagonalHigh::k_MatSym[i](1, 0)), static_cast(HexagonalHigh::k_MatSym[i](1, 1)), static_cast(HexagonalHigh::k_MatSym[i](1, 2)), + static_cast(HexagonalHigh::k_MatSym[i](2, 0)), static_cast(HexagonalHigh::k_MatSym[i](2, 1)), static_cast(HexagonalHigh::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType HexagonalOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType HexagonalOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -367,26 +347,22 @@ RodriguesDType HexagonalOps::getMDFFZRod(const RodriguesDType& inRod) const QuatD HexagonalOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(HexagonalHigh::QuatSym, q1, q2); + return _calcNearestQuat(HexagonalHigh::k_QuatSym, q1, q2); } QuatF HexagonalOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(HexagonalHigh::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(HexagonalHigh::k_QuatSym, q1f.to(), q2f.to()).to(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD HexagonalOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(HexagonalHigh::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(HexagonalHigh::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int HexagonalOps::getMisoBin(const RodriguesDType& rod) const { @@ -396,21 +372,19 @@ int HexagonalOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = HexagonalHigh::OdfDimInitValue[0]; - dim[1] = HexagonalHigh::OdfDimInitValue[1]; - dim[2] = HexagonalHigh::OdfDimInitValue[2]; - step[0] = HexagonalHigh::OdfDimStepValue[0]; - step[1] = HexagonalHigh::OdfDimStepValue[1]; - step[2] = HexagonalHigh::OdfDimStepValue[2]; - bins[0] = static_cast(HexagonalHigh::OdfNumBins[0]); - bins[1] = static_cast(HexagonalHigh::OdfNumBins[1]); - bins[2] = static_cast(HexagonalHigh::OdfNumBins[2]); + dim[0] = HexagonalHigh::k_OdfDimInitValue[0]; + dim[1] = HexagonalHigh::k_OdfDimInitValue[1]; + dim[2] = HexagonalHigh::k_OdfDimInitValue[2]; + step[0] = HexagonalHigh::k_OdfDimStepValue[0]; + step[1] = HexagonalHigh::k_OdfDimStepValue[1]; + step[2] = HexagonalHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(HexagonalHigh::k_OdfNumBins[0]); + bins[1] = static_cast(HexagonalHigh::k_OdfNumBins[1]); + bins[2] = static_cast(HexagonalHigh::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType HexagonalOps::determineEulerAngles(double random[3], int choose) const { @@ -419,15 +393,15 @@ EulerDType HexagonalOps::determineEulerAngles(double random[3], int choose) cons int32_t phi[3]; double h1, h2, h3; - init[0] = HexagonalHigh::OdfDimInitValue[0]; - init[1] = HexagonalHigh::OdfDimInitValue[1]; - init[2] = HexagonalHigh::OdfDimInitValue[2]; - step[0] = HexagonalHigh::OdfDimStepValue[0]; - step[1] = HexagonalHigh::OdfDimStepValue[1]; - step[2] = HexagonalHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % HexagonalHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / HexagonalHigh::OdfNumBins[0]) % HexagonalHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (HexagonalHigh::OdfNumBins[0] * HexagonalHigh::OdfNumBins[1])); + init[0] = HexagonalHigh::k_OdfDimInitValue[0]; + init[1] = HexagonalHigh::k_OdfDimInitValue[1]; + init[2] = HexagonalHigh::k_OdfDimInitValue[2]; + step[0] = HexagonalHigh::k_OdfDimStepValue[0]; + step[1] = HexagonalHigh::k_OdfDimStepValue[1]; + step[2] = HexagonalHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % HexagonalHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / HexagonalHigh::k_OdfNumBins[0]) % HexagonalHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (HexagonalHigh::k_OdfNumBins[0] * HexagonalHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -437,19 +411,15 @@ EulerDType HexagonalOps::determineEulerAngles(double random[3], int choose) cons return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType HexagonalOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(HexagonalHigh::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = HexagonalHigh::QuatSym[symOp] * quat; + QuatD qc = HexagonalHigh::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType HexagonalOps::determineRodriguesVector(double random[3], int choose) const { @@ -458,15 +428,15 @@ RodriguesDType HexagonalOps::determineRodriguesVector(double random[3], int choo int32_t phi[3]; double h1, h2, h3; - init[0] = HexagonalHigh::OdfDimInitValue[0]; - init[1] = HexagonalHigh::OdfDimInitValue[1]; - init[2] = HexagonalHigh::OdfDimInitValue[2]; - step[0] = HexagonalHigh::OdfDimStepValue[0]; - step[1] = HexagonalHigh::OdfDimStepValue[1]; - step[2] = HexagonalHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % HexagonalHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / HexagonalHigh::OdfNumBins[0]) % HexagonalHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (HexagonalHigh::OdfNumBins[0] * HexagonalHigh::OdfNumBins[1])); + init[0] = HexagonalHigh::k_OdfDimInitValue[0]; + init[1] = HexagonalHigh::k_OdfDimInitValue[1]; + init[2] = HexagonalHigh::k_OdfDimInitValue[2]; + step[0] = HexagonalHigh::k_OdfDimStepValue[0]; + step[1] = HexagonalHigh::k_OdfDimStepValue[1]; + step[2] = HexagonalHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % HexagonalHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / HexagonalHigh::k_OdfNumBins[0]) % HexagonalHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (HexagonalHigh::k_OdfNumBins[0] * HexagonalHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -474,8 +444,6 @@ RodriguesDType HexagonalOps::determineRodriguesVector(double random[3], int choo return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int HexagonalOps::getOdfBin(const RodriguesDType& rod) const { @@ -485,15 +453,15 @@ int HexagonalOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = HexagonalHigh::OdfDimInitValue[0]; - dim[1] = HexagonalHigh::OdfDimInitValue[1]; - dim[2] = HexagonalHigh::OdfDimInitValue[2]; - step[0] = HexagonalHigh::OdfDimStepValue[0]; - step[1] = HexagonalHigh::OdfDimStepValue[1]; - step[2] = HexagonalHigh::OdfDimStepValue[2]; - bins[0] = static_cast(HexagonalHigh::OdfNumBins[0]); - bins[1] = static_cast(HexagonalHigh::OdfNumBins[1]); - bins[2] = static_cast(HexagonalHigh::OdfNumBins[2]); + dim[0] = HexagonalHigh::k_OdfDimInitValue[0]; + dim[1] = HexagonalHigh::k_OdfDimInitValue[1]; + dim[2] = HexagonalHigh::k_OdfDimInitValue[2]; + step[0] = HexagonalHigh::k_OdfDimStepValue[0]; + step[1] = HexagonalHigh::k_OdfDimStepValue[1]; + step[2] = HexagonalHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(HexagonalHigh::k_OdfNumBins[0]); + bins[1] = static_cast(HexagonalHigh::k_OdfNumBins[1]); + bins[2] = static_cast(HexagonalHigh::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -825,21 +793,21 @@ void HexagonalOps::getSchmidFactorAndSS(double load[3], double plane[3], double { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = HexagonalHigh::MatSym[i][2][0] * plane[0] + HexagonalHigh::MatSym[i][2][1] * plane[1] + HexagonalHigh::MatSym[i][2][2] * plane[2]; + slipPlane[2] = HexagonalHigh::k_MatSym[i](2, 0) * plane[0] + HexagonalHigh::k_MatSym[i](2, 1) * plane[1] + HexagonalHigh::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = HexagonalHigh::MatSym[i][0][0] * plane[0] + HexagonalHigh::MatSym[i][0][1] * plane[1] + HexagonalHigh::MatSym[i][0][2] * plane[2]; - slipPlane[1] = HexagonalHigh::MatSym[i][1][0] * plane[0] + HexagonalHigh::MatSym[i][1][1] * plane[1] + HexagonalHigh::MatSym[i][1][2] * plane[2]; + slipPlane[0] = HexagonalHigh::k_MatSym[i](0, 0) * plane[0] + HexagonalHigh::k_MatSym[i](0, 1) * plane[1] + HexagonalHigh::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = HexagonalHigh::k_MatSym[i](1, 0) * plane[0] + HexagonalHigh::k_MatSym[i](1, 1) * plane[1] + HexagonalHigh::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = HexagonalHigh::MatSym[i][0][0] * direction[0] + HexagonalHigh::MatSym[i][0][1] * direction[1] + HexagonalHigh::MatSym[i][0][2] * direction[2]; - slipDirection[1] = HexagonalHigh::MatSym[i][1][0] * direction[0] + HexagonalHigh::MatSym[i][1][1] * direction[1] + HexagonalHigh::MatSym[i][1][2] * direction[2]; - slipDirection[2] = HexagonalHigh::MatSym[i][2][0] * direction[0] + HexagonalHigh::MatSym[i][2][1] * direction[1] + HexagonalHigh::MatSym[i][2][2] * direction[2]; + slipDirection[0] = HexagonalHigh::k_MatSym[i](0, 0) * direction[0] + HexagonalHigh::k_MatSym[i](0, 1) * direction[1] + HexagonalHigh::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = HexagonalHigh::k_MatSym[i](1, 0) * direction[0] + HexagonalHigh::k_MatSym[i](1, 1) * direction[1] + HexagonalHigh::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = HexagonalHigh::k_MatSym[i](2, 0) * direction[0] + HexagonalHigh::k_MatSym[i](2, 1) * direction[1] + HexagonalHigh::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -1112,8 +1080,6 @@ double HexagonalOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool #endif } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace HexagonalHigh { class GenerateSphereCoordsImpl @@ -1214,25 +1180,23 @@ class GenerateSphereCoordsImpl }; } // namespace HexagonalHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void HexagonalOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz0001, ebsdlib::FloatArrayType* xyz1010, ebsdlib::FloatArrayType* xyz1120) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz0001->getNumberOfTuples() < nOrientations * HexagonalHigh::symSize0) + if(xyz0001->getNumberOfTuples() < nOrientations * HexagonalHigh::k_SymSize0) { - xyz0001->resizeTuples(nOrientations * HexagonalHigh::symSize0 * 3); + xyz0001->resizeTuples(nOrientations * HexagonalHigh::k_SymSize0 * 3); } - if(xyz1010->getNumberOfTuples() < nOrientations * HexagonalHigh::symSize1) + if(xyz1010->getNumberOfTuples() < nOrientations * HexagonalHigh::k_SymSize1) { - xyz1010->resizeTuples(nOrientations * HexagonalHigh::symSize1 * 3); + xyz1010->resizeTuples(nOrientations * HexagonalHigh::k_SymSize1 * 3); } - if(xyz1120->getNumberOfTuples() < nOrientations * HexagonalHigh::symSize2) + if(xyz1120->getNumberOfTuples() < nOrientations * HexagonalHigh::k_SymSize2) { - xyz1120->resizeTuples(nOrientations * HexagonalHigh::symSize2 * 3); + xyz1120->resizeTuples(nOrientations * HexagonalHigh::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -1255,8 +1219,6 @@ std::array HexagonalOps::getIpfColorAngleLimits(double eta) const return {HexagonalHigh::k_EtaMin * ebsdlib::constants::k_DegToRadD, HexagonalHigh::k_EtaMax * ebsdlib::constants::k_DegToRadD, HexagonalHigh::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool HexagonalOps::inUnitTriangle(double eta, double chi) const { @@ -1264,16 +1226,12 @@ bool HexagonalOps::inUnitTriangle(double eta, double chi) const chi > (HexagonalHigh::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb HexagonalOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb HexagonalOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -1282,14 +1240,12 @@ ebsdlib::Rgb HexagonalOps::generateIPFColor(double phi1, double phi, double phi2 return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb HexagonalOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * HexagonalHigh::OdfDimInitValue[0]; - double range2 = 2.0f * HexagonalHigh::OdfDimInitValue[1]; - double range3 = 2.0f * HexagonalHigh::OdfDimInitValue[2]; + double range1 = 2.0f * HexagonalHigh::k_OdfDimInitValue[0]; + double range2 = 2.0f * HexagonalHigh::k_OdfDimInitValue[1]; + double range3 = 2.0f * HexagonalHigh::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -1305,16 +1261,12 @@ ebsdlib::Rgb HexagonalOps::generateRodriguesColor(double r1, double r2, double r return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array HexagonalOps::getDefaultPoleFigureNames() const { return {"<0001>", "<10-10>", "<2-1-10>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector HexagonalOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -1341,11 +1293,11 @@ std::vector HexagonalOps::generatePoleFigure(P // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalHigh::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalHigh::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalHigh::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalHigh::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalHigh::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * HexagonalHigh::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -1564,10 +1516,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float +0.25F, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.25F, 0.5F, 1.0F, 1.1F, 1.0F, 1.0F, }; std::vector drawAngle = {true, false, false, false, false, false, false, false, false, false, false, true}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -1712,13 +1664,13 @@ HexagonalOps::Pointer HexagonalOps::NullPointer() // ----------------------------------------------------------------------------- std::string HexagonalOps::getNameOfClass() const { - return std::string("HexagonalOps"); + return {"HexagonalOps"}; } // ----------------------------------------------------------------------------- std::string HexagonalOps::ClassName() { - return std::string("HexagonalOps"); + return {"HexagonalOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/HexagonalOps.h b/Source/EbsdLib/LaueOps/HexagonalOps.h index 65ca4b1..6b52e38 100644 --- a/Source/EbsdLib/LaueOps/HexagonalOps.h +++ b/Source/EbsdLib/LaueOps/HexagonalOps.h @@ -86,10 +86,10 @@ class EbsdLib_EXPORT HexagonalOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -98,7 +98,7 @@ class EbsdLib_EXPORT HexagonalOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -110,7 +110,7 @@ class EbsdLib_EXPORT HexagonalOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -156,7 +156,7 @@ class EbsdLib_EXPORT HexagonalOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -169,15 +169,15 @@ class EbsdLib_EXPORT HexagonalOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/LaueOps.cpp b/Source/EbsdLib/LaueOps/LaueOps.cpp index 9199e6b..6f9b942 100644 --- a/Source/EbsdLib/LaueOps/LaueOps.cpp +++ b/Source/EbsdLib/LaueOps/LaueOps.cpp @@ -91,13 +91,9 @@ constexpr std::underlying_type_t to_underlying(Enum e) noexcept } // namespace -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- LaueOps::LaueOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- LaueOps::~LaueOps() = default; @@ -542,8 +538,6 @@ AxisAngleDType LaueOps::calculateMisorientationInternal(const std::vector return axisAngleMin; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType LaueOps::_calcRodNearestOrigin(const RodriguesDType& inRod) const { @@ -592,8 +586,6 @@ RodriguesDType LaueOps::_calcRodNearestOrigin(const RodriguesDType& inRod) const return outRod; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD LaueOps::_calcNearestQuat(const std::vector& quatsym, const QuatD& q1, const QuatD& q2) const { @@ -690,8 +682,6 @@ void LaueOps::_calcDetermineHomochoricValues(double random[3], double init[3], d r3 = (step[2] * phi[2]) + (step[2] * random[2]) - (init[2]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int LaueOps::_calcODFBin(double dim[3], double bins[3], double step[3], const HomochoricDType& ho) const { @@ -726,8 +716,6 @@ int LaueOps::_calcODFBin(double dim[3], double bins[3], double step[3], const Ho return g1odfbin; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector LaueOps::GetAllOrientationOps() { @@ -809,8 +797,6 @@ LaueOps::Pointer LaueOps::GetOrientationOpsFromSpaceGroupNumber(const size_t sgN } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector LaueOps::GetLaueNames() { @@ -826,8 +812,6 @@ std::vector LaueOps::GetLaueNames() return names; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- size_t LaueOps::getRandomSymmetryOperatorIndex(const int numSymOps) const { @@ -856,13 +840,13 @@ LaueOps::Pointer LaueOps::NullPointer() // ----------------------------------------------------------------------------- std::string LaueOps::getNameOfClass() const { - return std::string("LaueOps"); + return {"LaueOps"}; } // ----------------------------------------------------------------------------- std::string LaueOps::ClassName() { - return std::string("LaueOps"); + return {"LaueOps"}; } //----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/LaueOps.h b/Source/EbsdLib/LaueOps/LaueOps.h index 9616607..451d183 100644 --- a/Source/EbsdLib/LaueOps/LaueOps.h +++ b/Source/EbsdLib/LaueOps/LaueOps.h @@ -77,7 +77,7 @@ class EbsdLib_EXPORT LaueOps /** * @brief GetAllOrientationOps This method returns a vector of each type of LaueOps placed such that the - * index into the vector is the value of the constant at ebsdlib::CrystalStructure::*** + * index into the vector is the value of the constant at CrystalStructure::*** * @return Vector of LaueOps subclasses. */ static std::vector GetAllOrientationOps(); @@ -99,10 +99,10 @@ class EbsdLib_EXPORT LaueOps * @brief getODFSize Returns the number of elements in the ODF array * @return */ - virtual int getODFSize() const = 0; + virtual size_t getODFSize() const = 0; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ virtual std::array getNumSymmetry() const = 0; @@ -123,19 +123,19 @@ class EbsdLib_EXPORT LaueOps * @brief getMDFSize Returns the number of elements in the MDF Array * @return */ - virtual int getMDFSize() const = 0; + virtual size_t getMDFSize() const = 0; /** * @brief getNumSymOps Returns the number of symmetry operators * @return */ - virtual int getNumSymOps() const = 0; + virtual size_t getNumSymOps() const = 0; /** * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - virtual int getNumRodriguesSymOps() const = 0; + virtual size_t getNumRodriguesSymOps() const = 0; /** * @brief getSymmetryName Returns the name of the symmetry @@ -182,7 +182,7 @@ class EbsdLib_EXPORT LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - virtual QuatD getQuatSymOp(int i) const = 0; + virtual QuatD getQuatSymOp(size_t i) const = 0; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -197,8 +197,8 @@ class EbsdLib_EXPORT LaueOps * @param g The g matrix * @return void or a Matrix3X3 object. */ - virtual Matrix3X3F getMatSymOpF(int i) const = 0; - virtual Matrix3X3D getMatSymOpD(int i) const = 0; + virtual Matrix3X3F getMatSymOpF(size_t i) const = 0; + virtual Matrix3X3D getMatSymOpD(size_t i) const = 0; /** * @brief getODFFZRod @@ -255,7 +255,7 @@ class EbsdLib_EXPORT LaueOps virtual double getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool maxSF) const = 0; - virtual void generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* c1, ebsdlib::FloatArrayType* c2, ebsdlib::FloatArrayType* c3) const = 0; + virtual void generateSphereCoordsFromEulers(FloatArrayType* eulers, FloatArrayType* c1, FloatArrayType* c2, FloatArrayType* c3) const = 0; static void RodriguesComposition(RodriguesDType sigma, RodriguesDType& rod); @@ -273,7 +273,7 @@ class EbsdLib_EXPORT LaueOps * @param convertDegrees Are the input angles in Degrees * @return rgb [output] The pointer to store the RGB value */ - virtual ebsdlib::Rgb generateIPFColor(double* eulers, double* refDir, bool convertDegrees) const = 0; + virtual Rgb generateIPFColor(double* eulers, double* refDir, bool convertDegrees) const = 0; /** * @brief generateIPFColor Generates an ARGB Color from an Euler Angle and Reference Direction @@ -286,7 +286,7 @@ class EbsdLib_EXPORT LaueOps * @param convertDegrees Are the input angles in Degrees * @return rgb [output] The pointer to store the RGB value */ - virtual ebsdlib::Rgb generateIPFColor(double e0, double e1, double e2, double dir0, double dir1, double dir2, bool convertDegrees) const = 0; + virtual Rgb generateIPFColor(double e0, double e1, double e2, double dir0, double dir1, double dir2, bool convertDegrees) const = 0; /** * @brief generateRodriguesColor Generates an RGB Color from a Rodrigues Vector @@ -295,24 +295,24 @@ class EbsdLib_EXPORT LaueOps * @param r3 Third component of the Rodrigues Vector * @return rgb [output] The pointer to store the RGB value */ - virtual ebsdlib::Rgb generateRodriguesColor(double r1, double r2, double r3) const = 0; + virtual Rgb generateRodriguesColor(double r1, double r2, double r3) const = 0; /** * @brief generateMisorientationColor Generates a color based on the method developed by C. Schuh and S. Patala. * @param q A Quaternion representing the crystal direction * @param refFrame A Quaternion representing the sample reference direction - * @return A ebsdlib::Rgb value + * @return A Rgb value */ - virtual ebsdlib::Rgb generateMisorientationColor(const QuatD& q, const QuatD& refFrame) const; + virtual Rgb generateMisorientationColor(const QuatD& q, const QuatD& refFrame) const; /** * @brief generatePoleFigure This method will generate a number of pole figures for this crystal symmetry and the Euler * angles that are passed in. * @param config The Pole Figure configuration struct - * @return A std::vector of ebsdlib::UInt8ArrayType pointers where each one represents a 2D RGB array that can be used to initialize + * @return A std::vector of UInt8ArrayType pointers where each one represents a 2D RGB array that can be used to initialize * an image object from other libraries and written out to disk. */ - virtual std::vector generatePoleFigure(PoleFigureConfiguration_t& config) const = 0; + virtual std::vector generatePoleFigure(PoleFigureConfiguration_t& config) const = 0; /** * @brief Returns the names for each of the three standard pole figures that are generated. For example @@ -324,7 +324,7 @@ class EbsdLib_EXPORT LaueOps * @brief generateStandardTriangle Generates an RGBA array that is a color "Standard" IPF Triangle Legend used for IPF Color Maps. * @return */ - virtual ebsdlib::UInt8ArrayType::Pointer generateIPFTriangleLegend(int imageDim, bool generateEntirePlane) const = 0; + virtual UInt8ArrayType::Pointer generateIPFTriangleLegend(int imageDim, bool generateEntirePlane) const = 0; enum class FZType : int32_t { @@ -505,7 +505,7 @@ class EbsdLib_EXPORT LaueOps * @param deg2Rad * @return */ - ebsdlib::Rgb computeIPFColor(double* eulers, double* refDir, bool degToRad) const; + Rgb computeIPFColor(double* eulers, double* refDir, bool degToRad) const; /** * @brief Converts in input Quaternion into a version that is inside the fundamental zone. diff --git a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp index a61ec4e..4362272 100644 --- a/Source/EbsdLib/LaueOps/MonoclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/MonoclinicOps.cpp @@ -57,43 +57,43 @@ using namespace ebsdlib; namespace Monoclinic { -constexpr std::array OdfNumBins = {72, 36, 72}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {72, 36, 72}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.7f * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0]) / 2.0, OdfDimInitValue[1] / static_cast(OdfNumBins[1]) / 2.0, - OdfDimInitValue[2] / static_cast(OdfNumBins[2]) / 2.0}; +static const std::array k_OdfDimInitValue = {std::pow((0.7f * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0]) / 2.0, k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1]) / 2.0, + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2]) / 2.0}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 2; -constexpr int symSize2 = 2; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 2; +constexpr int k_SymSize2 = 2; -constexpr int k_OdfSize = 186624; -constexpr int k_MdfSize = 186624; -constexpr int k_SymOpsCount = 2; +constexpr size_t k_OdfSize = 186624; +constexpr size_t k_MdfSize = 186624; +constexpr size_t k_SymOpsCount = 2; constexpr int k_NumMdfBins = 36; // Rotation Point Group: 2 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(0.0, 1.0, 0.0, 0.0), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(0.0, 1.0, 0.0, 0.0), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {0.0, 1.0, 0.0, 10000000000000.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {0.0, 1.0, 0.0, 10000000000000.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {-1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0}, + }; /* clang-format on */ @@ -102,18 +102,12 @@ constexpr double k_EtaMax = 180.0; constexpr double k_ChiMax = 90.0; } // namespace Monoclinic -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- MonoclinicOps::MonoclinicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- MonoclinicOps::~MonoclinicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool MonoclinicOps::getHasInversion() const { @@ -121,9 +115,7 @@ bool MonoclinicOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int MonoclinicOps::getODFSize() const +size_t MonoclinicOps::getODFSize() const { return Monoclinic::k_OdfSize; } @@ -131,13 +123,11 @@ int MonoclinicOps::getODFSize() const // ----------------------------------------------------------------------------- std::array MonoclinicOps::getNumSymmetry() const { - return {Monoclinic::symSize0, Monoclinic::symSize1, Monoclinic::symSize2}; + return {Monoclinic::k_SymSize0, Monoclinic::k_SymSize1, Monoclinic::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int MonoclinicOps::getMDFSize() const +size_t MonoclinicOps::getMDFSize() const { return Monoclinic::k_MdfSize; } @@ -149,9 +139,7 @@ int MonoclinicOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int MonoclinicOps::getNumSymOps() const +size_t MonoclinicOps::getNumSymOps() const { return Monoclinic::k_SymOpsCount; } @@ -159,19 +147,15 @@ int MonoclinicOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array MonoclinicOps::getOdfNumBins() const { - return Monoclinic::OdfNumBins; + return Monoclinic::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string MonoclinicOps::getSymmetryName() const { return "Monoclinic 2/m (C2h)"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string MonoclinicOps::getRotationPointGroup() const { @@ -196,52 +180,45 @@ bool MonoclinicOps::isInsideFZ(const RodriguesDType& rod) const return IsInsideFZ(rod, getFZType(), getAxisOrderingType()); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AxisAngleDType MonoclinicOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(Monoclinic::QuatSym, q1, q2); + return calculateMisorientationInternal(Monoclinic::k_QuatSym, q1, q2); } -QuatD MonoclinicOps::getQuatSymOp(int32_t i) const +QuatD MonoclinicOps::getQuatSymOp(size_t i) const { - return Monoclinic::QuatSym[i]; + return Monoclinic::k_QuatSym[i]; } -int32_t MonoclinicOps::getNumRodriguesSymOps() const +size_t MonoclinicOps::getNumRodriguesSymOps() const { - return Monoclinic::RodSym.size(); + return Monoclinic::k_RodSym.size(); } RodriguesDType MonoclinicOps::getRodSymOp(size_t i) const { - return Monoclinic::RodSym[i]; + return Monoclinic::k_RodSym[i]; } -Matrix3X3D MonoclinicOps::getMatSymOpD(int i) const +Matrix3X3D MonoclinicOps::getMatSymOpD(size_t i) const { - return {Monoclinic::MatSym[i][0][0], Monoclinic::MatSym[i][0][1], Monoclinic::MatSym[i][0][2], Monoclinic::MatSym[i][1][0], Monoclinic::MatSym[i][1][1], - Monoclinic::MatSym[i][1][2], Monoclinic::MatSym[i][2][0], Monoclinic::MatSym[i][2][1], Monoclinic::MatSym[i][2][2]}; + return Monoclinic::k_MatSym[i]; } -Matrix3X3F MonoclinicOps::getMatSymOpF(int i) const +Matrix3X3F MonoclinicOps::getMatSymOpF(size_t i) const { - return {static_cast(Monoclinic::MatSym[i][0][0]), static_cast(Monoclinic::MatSym[i][0][1]), static_cast(Monoclinic::MatSym[i][0][2]), - static_cast(Monoclinic::MatSym[i][1][0]), static_cast(Monoclinic::MatSym[i][1][1]), static_cast(Monoclinic::MatSym[i][1][2]), - static_cast(Monoclinic::MatSym[i][2][0]), static_cast(Monoclinic::MatSym[i][2][1]), static_cast(Monoclinic::MatSym[i][2][2])}; + return {static_cast(Monoclinic::k_MatSym[i](0, 0)), static_cast(Monoclinic::k_MatSym[i](0, 1)), static_cast(Monoclinic::k_MatSym[i](0, 2)), + static_cast(Monoclinic::k_MatSym[i](1, 0)), static_cast(Monoclinic::k_MatSym[i](1, 1)), static_cast(Monoclinic::k_MatSym[i](1, 2)), + static_cast(Monoclinic::k_MatSym[i](2, 0)), static_cast(Monoclinic::k_MatSym[i](2, 1)), static_cast(Monoclinic::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType MonoclinicOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType MonoclinicOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -260,17 +237,15 @@ RodriguesDType MonoclinicOps::getMDFFZRod(const RodriguesDType& inRod) const // return AxisAngleDType(FZn1, FZn2, FZn3, FZw).toRodrigues(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD MonoclinicOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(Monoclinic::QuatSym, q1, q2); + return _calcNearestQuat(Monoclinic::k_QuatSym, q1, q2); } QuatF MonoclinicOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(Monoclinic::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(Monoclinic::k_QuatSym, q1f.to(), q2f.to()).to(); } // ----------------------------------------------------------------------------- @@ -278,11 +253,9 @@ QuatD MonoclinicOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(Monoclinic::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(Monoclinic::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int MonoclinicOps::getMisoBin(const RodriguesDType& rod) const { @@ -292,21 +265,19 @@ int MonoclinicOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = Monoclinic::OdfDimInitValue[0]; - dim[1] = Monoclinic::OdfDimInitValue[1]; - dim[2] = Monoclinic::OdfDimInitValue[2]; - step[0] = Monoclinic::OdfDimStepValue[0]; - step[1] = Monoclinic::OdfDimStepValue[1]; - step[2] = Monoclinic::OdfDimStepValue[2]; - bins[0] = static_cast(Monoclinic::OdfNumBins[0]); - bins[1] = static_cast(Monoclinic::OdfNumBins[1]); - bins[2] = static_cast(Monoclinic::OdfNumBins[2]); + dim[0] = Monoclinic::k_OdfDimInitValue[0]; + dim[1] = Monoclinic::k_OdfDimInitValue[1]; + dim[2] = Monoclinic::k_OdfDimInitValue[2]; + step[0] = Monoclinic::k_OdfDimStepValue[0]; + step[1] = Monoclinic::k_OdfDimStepValue[1]; + step[2] = Monoclinic::k_OdfDimStepValue[2]; + bins[0] = static_cast(Monoclinic::k_OdfNumBins[0]); + bins[1] = static_cast(Monoclinic::k_OdfNumBins[1]); + bins[2] = static_cast(Monoclinic::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType MonoclinicOps::determineEulerAngles(double random[3], int choose) const { @@ -315,16 +286,16 @@ EulerDType MonoclinicOps::determineEulerAngles(double random[3], int choose) con int32_t phi[3]; double h1, h2, h3; - init[0] = Monoclinic::OdfDimInitValue[0]; - init[1] = Monoclinic::OdfDimInitValue[1]; - init[2] = Monoclinic::OdfDimInitValue[2]; - step[0] = Monoclinic::OdfDimStepValue[0]; - step[1] = Monoclinic::OdfDimStepValue[1]; - step[2] = Monoclinic::OdfDimStepValue[2]; + init[0] = Monoclinic::k_OdfDimInitValue[0]; + init[1] = Monoclinic::k_OdfDimInitValue[1]; + init[2] = Monoclinic::k_OdfDimInitValue[2]; + step[0] = Monoclinic::k_OdfDimStepValue[0]; + step[1] = Monoclinic::k_OdfDimStepValue[1]; + step[2] = Monoclinic::k_OdfDimStepValue[2]; - phi[0] = static_cast(choose % Monoclinic::OdfNumBins[0]); - phi[1] = static_cast((choose / Monoclinic::OdfNumBins[0]) % Monoclinic::OdfNumBins[1]); - phi[2] = static_cast(choose / (Monoclinic::OdfNumBins[0] * Monoclinic::OdfNumBins[1])); + phi[0] = static_cast(choose % Monoclinic::k_OdfNumBins[0]); + phi[1] = static_cast((choose / Monoclinic::k_OdfNumBins[0]) % Monoclinic::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (Monoclinic::k_OdfNumBins[0] * Monoclinic::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -333,19 +304,15 @@ EulerDType MonoclinicOps::determineEulerAngles(double random[3], int choose) con return ro.toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType MonoclinicOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(Monoclinic::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = Monoclinic::QuatSym[symOp] * quat; + QuatD qc = Monoclinic::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType MonoclinicOps::determineRodriguesVector(double random[3], int choose) const { @@ -354,15 +321,15 @@ RodriguesDType MonoclinicOps::determineRodriguesVector(double random[3], int cho int32_t phi[3]; double h1, h2, h3; - init[0] = Monoclinic::OdfDimInitValue[0]; - init[1] = Monoclinic::OdfDimInitValue[1]; - init[2] = Monoclinic::OdfDimInitValue[2]; - step[0] = Monoclinic::OdfDimStepValue[0]; - step[1] = Monoclinic::OdfDimStepValue[1]; - step[2] = Monoclinic::OdfDimStepValue[2]; - phi[0] = static_cast(choose % Monoclinic::OdfNumBins[0]); - phi[1] = static_cast((choose / Monoclinic::OdfNumBins[0]) % Monoclinic::OdfNumBins[1]); - phi[2] = static_cast(choose / (Monoclinic::OdfNumBins[0] * Monoclinic::OdfNumBins[1])); + init[0] = Monoclinic::k_OdfDimInitValue[0]; + init[1] = Monoclinic::k_OdfDimInitValue[1]; + init[2] = Monoclinic::k_OdfDimInitValue[2]; + step[0] = Monoclinic::k_OdfDimStepValue[0]; + step[1] = Monoclinic::k_OdfDimStepValue[1]; + step[2] = Monoclinic::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % Monoclinic::k_OdfNumBins[0]); + phi[1] = static_cast((choose / Monoclinic::k_OdfNumBins[0]) % Monoclinic::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (Monoclinic::k_OdfNumBins[0] * Monoclinic::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -370,8 +337,6 @@ RodriguesDType MonoclinicOps::determineRodriguesVector(double random[3], int cho return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int MonoclinicOps::getOdfBin(const RodriguesDType& rod) const { @@ -381,15 +346,15 @@ int MonoclinicOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = Monoclinic::OdfDimInitValue[0]; - dim[1] = Monoclinic::OdfDimInitValue[1]; - dim[2] = Monoclinic::OdfDimInitValue[2]; - step[0] = Monoclinic::OdfDimStepValue[0]; - step[1] = Monoclinic::OdfDimStepValue[1]; - step[2] = Monoclinic::OdfDimStepValue[2]; - bins[0] = static_cast(Monoclinic::OdfNumBins[0]); - bins[1] = static_cast(Monoclinic::OdfNumBins[1]); - bins[2] = static_cast(Monoclinic::OdfNumBins[2]); + dim[0] = Monoclinic::k_OdfDimInitValue[0]; + dim[1] = Monoclinic::k_OdfDimInitValue[1]; + dim[2] = Monoclinic::k_OdfDimInitValue[2]; + step[0] = Monoclinic::k_OdfDimStepValue[0]; + step[1] = Monoclinic::k_OdfDimStepValue[1]; + step[2] = Monoclinic::k_OdfDimStepValue[2]; + bins[0] = static_cast(Monoclinic::k_OdfNumBins[0]); + bins[1] = static_cast(Monoclinic::k_OdfNumBins[1]); + bins[2] = static_cast(Monoclinic::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -419,21 +384,21 @@ void MonoclinicOps::getSchmidFactorAndSS(double load[3], double plane[3], double { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = Monoclinic::MatSym[i][2][0] * plane[0] + Monoclinic::MatSym[i][2][1] * plane[1] + Monoclinic::MatSym[i][2][2] * plane[2]; + slipPlane[2] = Monoclinic::k_MatSym[i](2, 0) * plane[0] + Monoclinic::k_MatSym[i](2, 1) * plane[1] + Monoclinic::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = Monoclinic::MatSym[i][0][0] * plane[0] + Monoclinic::MatSym[i][0][1] * plane[1] + Monoclinic::MatSym[i][0][2] * plane[2]; - slipPlane[1] = Monoclinic::MatSym[i][1][0] * plane[0] + Monoclinic::MatSym[i][1][1] * plane[1] + Monoclinic::MatSym[i][1][2] * plane[2]; + slipPlane[0] = Monoclinic::k_MatSym[i](0, 0) * plane[0] + Monoclinic::k_MatSym[i](0, 1) * plane[1] + Monoclinic::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = Monoclinic::k_MatSym[i](1, 0) * plane[0] + Monoclinic::k_MatSym[i](1, 1) * plane[1] + Monoclinic::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = Monoclinic::MatSym[i][0][0] * direction[0] + Monoclinic::MatSym[i][0][1] * direction[1] + Monoclinic::MatSym[i][0][2] * direction[2]; - slipDirection[1] = Monoclinic::MatSym[i][1][0] * direction[0] + Monoclinic::MatSym[i][1][1] * direction[1] + Monoclinic::MatSym[i][1][2] * direction[2]; - slipDirection[2] = Monoclinic::MatSym[i][2][0] * direction[0] + Monoclinic::MatSym[i][2][1] * direction[1] + Monoclinic::MatSym[i][2][2] * direction[2]; + slipDirection[0] = Monoclinic::k_MatSym[i](0, 0) * direction[0] + Monoclinic::k_MatSym[i](0, 1) * direction[1] + Monoclinic::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = Monoclinic::k_MatSym[i](1, 0) * direction[0] + Monoclinic::k_MatSym[i](1, 1) * direction[1] + Monoclinic::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = Monoclinic::k_MatSym[i](2, 0) * direction[0] + Monoclinic::k_MatSym[i](2, 1) * direction[1] + Monoclinic::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -467,8 +432,6 @@ double MonoclinicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool return 0.0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- namespace Monoclinic @@ -542,25 +505,23 @@ class GenerateSphereCoordsImpl }; } // namespace Monoclinic -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void MonoclinicOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * Monoclinic::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * Monoclinic::k_SymSize0) { - xyz001->resizeTuples(nOrientations * Monoclinic::symSize0 * 3); + xyz001->resizeTuples(nOrientations * Monoclinic::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * Monoclinic::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * Monoclinic::k_SymSize1) { - xyz011->resizeTuples(nOrientations * Monoclinic::symSize1 * 3); + xyz011->resizeTuples(nOrientations * Monoclinic::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * Monoclinic::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * Monoclinic::k_SymSize2) { - xyz111->resizeTuples(nOrientations * Monoclinic::symSize2 * 3); + xyz111->resizeTuples(nOrientations * Monoclinic::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -577,8 +538,6 @@ std::array MonoclinicOps::getIpfColorAngleLimits(double eta) const return {Monoclinic::k_EtaMin * ebsdlib::constants::k_DegToRadD, Monoclinic::k_EtaMax * ebsdlib::constants::k_DegToRadD, Monoclinic::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool MonoclinicOps::inUnitTriangle(double eta, double chi) const { @@ -586,16 +545,12 @@ bool MonoclinicOps::inUnitTriangle(double eta, double chi) const chi > (Monoclinic::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb MonoclinicOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb MonoclinicOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -604,14 +559,12 @@ ebsdlib::Rgb MonoclinicOps::generateIPFColor(double phi1, double phi, double phi return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb MonoclinicOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * Monoclinic::OdfDimInitValue[0]; - double range2 = 2.0f * Monoclinic::OdfDimInitValue[1]; - double range3 = 2.0f * Monoclinic::OdfDimInitValue[2]; + double range1 = 2.0f * Monoclinic::k_OdfDimInitValue[0]; + double range2 = 2.0f * Monoclinic::k_OdfDimInitValue[1]; + double range3 = 2.0f * Monoclinic::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -627,16 +580,12 @@ ebsdlib::Rgb MonoclinicOps::generateRodriguesColor(double r1, double r2, double return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array MonoclinicOps::getDefaultPoleFigureNames() const { return {"<001>", "<100>", "<010>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector MonoclinicOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -663,11 +612,11 @@ std::vector MonoclinicOps::generatePoleFigure( // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Monoclinic::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Monoclinic::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Monoclinic::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Monoclinic::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Monoclinic::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Monoclinic::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -675,7 +624,7 @@ std::vector MonoclinicOps::generatePoleFigure( generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -870,10 +819,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float std::vector xAdj = {0.1F, 0.0F, -0.5F, -1.0F, -1.1F, -1.0F, -0.5F, 0.0F}; std::vector yAdj = {+0.25F, 0.0F, -0.2F, 0.0F, 0.25F, 0.75F, 1.1F, 1.0F}; std::vector drawAngle = {true, true, true, true, true, false, false, false}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -1050,13 +999,13 @@ MonoclinicOps::Pointer MonoclinicOps::NullPointer() // ----------------------------------------------------------------------------- std::string MonoclinicOps::getNameOfClass() const { - return std::string("MonoclinicOps"); + return {"MonoclinicOps"}; } // ----------------------------------------------------------------------------- std::string MonoclinicOps::ClassName() { - return std::string("MonoclinicOps"); + return {"MonoclinicOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/MonoclinicOps.h b/Source/EbsdLib/LaueOps/MonoclinicOps.h index 89a0b4d..2fb3942 100644 --- a/Source/EbsdLib/LaueOps/MonoclinicOps.h +++ b/Source/EbsdLib/LaueOps/MonoclinicOps.h @@ -85,10 +85,10 @@ class EbsdLib_EXPORT MonoclinicOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -97,7 +97,7 @@ class EbsdLib_EXPORT MonoclinicOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -109,7 +109,7 @@ class EbsdLib_EXPORT MonoclinicOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -155,7 +155,7 @@ class EbsdLib_EXPORT MonoclinicOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -168,15 +168,15 @@ class EbsdLib_EXPORT MonoclinicOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp index a516d38..58a4974 100644 --- a/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp +++ b/Source/EbsdLib/LaueOps/OrthoRhombicOps.cpp @@ -58,55 +58,55 @@ using namespace ebsdlib; namespace OrthoRhombic { -constexpr std::array OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {36, 36, 36}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 2; -constexpr int symSize2 = 2; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 2; +constexpr int k_SymSize2 = 2; -constexpr int k_OdfSize = 46656; -constexpr int k_MdfSize = 46656; -constexpr int k_SymOpsCount = 4; +constexpr size_t k_OdfSize = 46656; +constexpr size_t k_MdfSize = 46656; +constexpr size_t k_SymOpsCount = 4; constexpr int k_NumMdfBins = 36; // Rotation Point Group: 222 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(1.0, 0.0, 0.0, 0.0), - QuatD(0.0, 1.0, 0.0, 0.0), - QuatD(0.0, 0.0, 1.0, 0.0), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(1.0, 0.0, 0.0, 0.0), + QuatD(0.0, 1.0, 0.0, 0.0), + QuatD(0.0, 0.0, 1.0, 0.0), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {1.0, 0.0, 0.0, 10000000000000.0}, - {0.0, 1.0, 0.0, 10000000000000.0}, - {0.0, 0.0, 1.0, 10000000000000.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {1.0, 0.0, 0.0, 10000000000000.0}, + {0.0, 1.0, 0.0, 10000000000000.0}, + {0.0, 0.0, 1.0, 10000000000000.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0}, + }; /* clang-format on */ constexpr double k_EtaMin = 0.0; @@ -114,18 +114,12 @@ constexpr double k_EtaMax = 90.0; constexpr double k_ChiMax = 90.0; } // namespace OrthoRhombic -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- OrthoRhombicOps::OrthoRhombicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- OrthoRhombicOps::~OrthoRhombicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool OrthoRhombicOps::getHasInversion() const { @@ -133,9 +127,7 @@ bool OrthoRhombicOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int OrthoRhombicOps::getODFSize() const +size_t OrthoRhombicOps::getODFSize() const { return OrthoRhombic::k_OdfSize; } @@ -143,13 +135,11 @@ int OrthoRhombicOps::getODFSize() const // ----------------------------------------------------------------------------- std::array OrthoRhombicOps::getNumSymmetry() const { - return {OrthoRhombic::symSize0, OrthoRhombic::symSize1, OrthoRhombic::symSize2}; + return {OrthoRhombic::k_SymSize0, OrthoRhombic::k_SymSize1, OrthoRhombic::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int OrthoRhombicOps::getMDFSize() const +size_t OrthoRhombicOps::getMDFSize() const { return OrthoRhombic::k_MdfSize; } @@ -161,9 +151,7 @@ int OrthoRhombicOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int OrthoRhombicOps::getNumSymOps() const +size_t OrthoRhombicOps::getNumSymOps() const { return OrthoRhombic::k_SymOpsCount; } @@ -171,19 +159,15 @@ int OrthoRhombicOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array OrthoRhombicOps::getOdfNumBins() const { - return OrthoRhombic::OdfNumBins; + return OrthoRhombic::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string OrthoRhombicOps::getSymmetryName() const { return "Orthorhombic mmm (D2h)"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string OrthoRhombicOps::getRotationPointGroup() const { @@ -210,47 +194,42 @@ bool OrthoRhombicOps::isInsideFZ(const RodriguesDType& rod) const AxisAngleDType OrthoRhombicOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(OrthoRhombic::QuatSym, q1, q2); + return calculateMisorientationInternal(OrthoRhombic::k_QuatSym, q1, q2); } -QuatD OrthoRhombicOps::getQuatSymOp(int32_t i) const +QuatD OrthoRhombicOps::getQuatSymOp(size_t i) const { - return OrthoRhombic::QuatSym[i]; + return OrthoRhombic::k_QuatSym[i]; } -int32_t OrthoRhombicOps::getNumRodriguesSymOps() const +size_t OrthoRhombicOps::getNumRodriguesSymOps() const { - return OrthoRhombic::RodSym.size(); + return OrthoRhombic::k_RodSym.size(); } RodriguesDType OrthoRhombicOps::getRodSymOp(size_t i) const { - return OrthoRhombic::RodSym[i]; + return OrthoRhombic::k_RodSym[i]; } -Matrix3X3D OrthoRhombicOps::getMatSymOpD(int i) const +Matrix3X3D OrthoRhombicOps::getMatSymOpD(size_t i) const { - return {OrthoRhombic::MatSym[i][0][0], OrthoRhombic::MatSym[i][0][1], OrthoRhombic::MatSym[i][0][2], OrthoRhombic::MatSym[i][1][0], OrthoRhombic::MatSym[i][1][1], - OrthoRhombic::MatSym[i][1][2], OrthoRhombic::MatSym[i][2][0], OrthoRhombic::MatSym[i][2][1], OrthoRhombic::MatSym[i][2][2]}; + return OrthoRhombic::k_MatSym[i]; } -Matrix3X3F OrthoRhombicOps::getMatSymOpF(int i) const +Matrix3X3F OrthoRhombicOps::getMatSymOpF(size_t i) const { - return {static_cast(OrthoRhombic::MatSym[i][0][0]), static_cast(OrthoRhombic::MatSym[i][0][1]), static_cast(OrthoRhombic::MatSym[i][0][2]), - static_cast(OrthoRhombic::MatSym[i][1][0]), static_cast(OrthoRhombic::MatSym[i][1][1]), static_cast(OrthoRhombic::MatSym[i][1][2]), - static_cast(OrthoRhombic::MatSym[i][2][0]), static_cast(OrthoRhombic::MatSym[i][2][1]), static_cast(OrthoRhombic::MatSym[i][2][2])}; + return {static_cast(OrthoRhombic::k_MatSym[i](0, 0)), static_cast(OrthoRhombic::k_MatSym[i](0, 1)), static_cast(OrthoRhombic::k_MatSym[i](0, 2)), + static_cast(OrthoRhombic::k_MatSym[i](1, 0)), static_cast(OrthoRhombic::k_MatSym[i](1, 1)), static_cast(OrthoRhombic::k_MatSym[i](1, 2)), + static_cast(OrthoRhombic::k_MatSym[i](2, 0)), static_cast(OrthoRhombic::k_MatSym[i](2, 1)), static_cast(OrthoRhombic::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType OrthoRhombicOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType OrthoRhombicOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -270,17 +249,15 @@ RodriguesDType OrthoRhombicOps::getMDFFZRod(const RodriguesDType& inRod) const return AxisAngleDType(FZn1, FZn2, FZn3, FZw).toRodrigues(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD OrthoRhombicOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(OrthoRhombic::QuatSym, q1, q2); + return _calcNearestQuat(OrthoRhombic::k_QuatSym, q1, q2); } QuatF OrthoRhombicOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(OrthoRhombic::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(OrthoRhombic::k_QuatSym, q1f.to(), q2f.to()).to(); } // ----------------------------------------------------------------------------- @@ -288,11 +265,9 @@ QuatD OrthoRhombicOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(OrthoRhombic::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(OrthoRhombic::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int OrthoRhombicOps::getMisoBin(const RodriguesDType& rod) const { @@ -301,21 +276,19 @@ int OrthoRhombicOps::getMisoBin(const RodriguesDType& rod) const double step[3]; HomochoricDType ho = rod.toHomochoric(); - dim[0] = OrthoRhombic::OdfDimInitValue[0]; - dim[1] = OrthoRhombic::OdfDimInitValue[1]; - dim[2] = OrthoRhombic::OdfDimInitValue[2]; - step[0] = OrthoRhombic::OdfDimStepValue[0]; - step[1] = OrthoRhombic::OdfDimStepValue[1]; - step[2] = OrthoRhombic::OdfDimStepValue[2]; - bins[0] = static_cast(OrthoRhombic::OdfNumBins[0]); - bins[1] = static_cast(OrthoRhombic::OdfNumBins[1]); - bins[2] = static_cast(OrthoRhombic::OdfNumBins[2]); + dim[0] = OrthoRhombic::k_OdfDimInitValue[0]; + dim[1] = OrthoRhombic::k_OdfDimInitValue[1]; + dim[2] = OrthoRhombic::k_OdfDimInitValue[2]; + step[0] = OrthoRhombic::k_OdfDimStepValue[0]; + step[1] = OrthoRhombic::k_OdfDimStepValue[1]; + step[2] = OrthoRhombic::k_OdfDimStepValue[2]; + bins[0] = static_cast(OrthoRhombic::k_OdfNumBins[0]); + bins[1] = static_cast(OrthoRhombic::k_OdfNumBins[1]); + bins[2] = static_cast(OrthoRhombic::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType OrthoRhombicOps::determineEulerAngles(double random[3], int choose) const { @@ -324,15 +297,15 @@ EulerDType OrthoRhombicOps::determineEulerAngles(double random[3], int choose) c int32_t phi[3]; double h1, h2, h3; - init[0] = OrthoRhombic::OdfDimInitValue[0]; - init[1] = OrthoRhombic::OdfDimInitValue[1]; - init[2] = OrthoRhombic::OdfDimInitValue[2]; - step[0] = OrthoRhombic::OdfDimStepValue[0]; - step[1] = OrthoRhombic::OdfDimStepValue[1]; - step[2] = OrthoRhombic::OdfDimStepValue[2]; - phi[0] = static_cast(choose % OrthoRhombic::OdfNumBins[0]); - phi[1] = static_cast((choose / OrthoRhombic::OdfNumBins[0]) % OrthoRhombic::OdfNumBins[1]); - phi[2] = static_cast(choose / (OrthoRhombic::OdfNumBins[0] * OrthoRhombic::OdfNumBins[1])); + init[0] = OrthoRhombic::k_OdfDimInitValue[0]; + init[1] = OrthoRhombic::k_OdfDimInitValue[1]; + init[2] = OrthoRhombic::k_OdfDimInitValue[2]; + step[0] = OrthoRhombic::k_OdfDimStepValue[0]; + step[1] = OrthoRhombic::k_OdfDimStepValue[1]; + step[2] = OrthoRhombic::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % OrthoRhombic::k_OdfNumBins[0]); + phi[1] = static_cast((choose / OrthoRhombic::k_OdfNumBins[0]) % OrthoRhombic::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (OrthoRhombic::k_OdfNumBins[0] * OrthoRhombic::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -342,19 +315,15 @@ EulerDType OrthoRhombicOps::determineEulerAngles(double random[3], int choose) c return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType OrthoRhombicOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(OrthoRhombic::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = OrthoRhombic::QuatSym[symOp] * quat; + QuatD qc = OrthoRhombic::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType OrthoRhombicOps::determineRodriguesVector(double random[3], int choose) const { @@ -363,15 +332,15 @@ RodriguesDType OrthoRhombicOps::determineRodriguesVector(double random[3], int c int32_t phi[3]; double h1, h2, h3; - init[0] = OrthoRhombic::OdfDimInitValue[0]; - init[1] = OrthoRhombic::OdfDimInitValue[1]; - init[2] = OrthoRhombic::OdfDimInitValue[2]; - step[0] = OrthoRhombic::OdfDimStepValue[0]; - step[1] = OrthoRhombic::OdfDimStepValue[1]; - step[2] = OrthoRhombic::OdfDimStepValue[2]; - phi[0] = static_cast(choose % OrthoRhombic::OdfNumBins[0]); - phi[1] = static_cast((choose / OrthoRhombic::OdfNumBins[0]) % OrthoRhombic::OdfNumBins[1]); - phi[2] = static_cast(choose / (OrthoRhombic::OdfNumBins[0] * OrthoRhombic::OdfNumBins[1])); + init[0] = OrthoRhombic::k_OdfDimInitValue[0]; + init[1] = OrthoRhombic::k_OdfDimInitValue[1]; + init[2] = OrthoRhombic::k_OdfDimInitValue[2]; + step[0] = OrthoRhombic::k_OdfDimStepValue[0]; + step[1] = OrthoRhombic::k_OdfDimStepValue[1]; + step[2] = OrthoRhombic::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % OrthoRhombic::k_OdfNumBins[0]); + phi[1] = static_cast((choose / OrthoRhombic::k_OdfNumBins[0]) % OrthoRhombic::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (OrthoRhombic::k_OdfNumBins[0] * OrthoRhombic::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -379,8 +348,6 @@ RodriguesDType OrthoRhombicOps::determineRodriguesVector(double random[3], int c return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int OrthoRhombicOps::getOdfBin(const RodriguesDType& rod) const { @@ -390,15 +357,15 @@ int OrthoRhombicOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = OrthoRhombic::OdfDimInitValue[0]; - dim[1] = OrthoRhombic::OdfDimInitValue[1]; - dim[2] = OrthoRhombic::OdfDimInitValue[2]; - step[0] = OrthoRhombic::OdfDimStepValue[0]; - step[1] = OrthoRhombic::OdfDimStepValue[1]; - step[2] = OrthoRhombic::OdfDimStepValue[2]; - bins[0] = static_cast(OrthoRhombic::OdfNumBins[0]); - bins[1] = static_cast(OrthoRhombic::OdfNumBins[1]); - bins[2] = static_cast(OrthoRhombic::OdfNumBins[2]); + dim[0] = OrthoRhombic::k_OdfDimInitValue[0]; + dim[1] = OrthoRhombic::k_OdfDimInitValue[1]; + dim[2] = OrthoRhombic::k_OdfDimInitValue[2]; + step[0] = OrthoRhombic::k_OdfDimStepValue[0]; + step[1] = OrthoRhombic::k_OdfDimStepValue[1]; + step[2] = OrthoRhombic::k_OdfDimStepValue[2]; + bins[0] = static_cast(OrthoRhombic::k_OdfNumBins[0]); + bins[1] = static_cast(OrthoRhombic::k_OdfNumBins[1]); + bins[2] = static_cast(OrthoRhombic::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -428,21 +395,21 @@ void OrthoRhombicOps::getSchmidFactorAndSS(double load[3], double plane[3], doub { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = OrthoRhombic::MatSym[i][2][0] * plane[0] + OrthoRhombic::MatSym[i][2][1] * plane[1] + OrthoRhombic::MatSym[i][2][2] * plane[2]; + slipPlane[2] = OrthoRhombic::k_MatSym[i](2, 0) * plane[0] + OrthoRhombic::k_MatSym[i](2, 1) * plane[1] + OrthoRhombic::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = OrthoRhombic::MatSym[i][0][0] * plane[0] + OrthoRhombic::MatSym[i][0][1] * plane[1] + OrthoRhombic::MatSym[i][0][2] * plane[2]; - slipPlane[1] = OrthoRhombic::MatSym[i][1][0] * plane[0] + OrthoRhombic::MatSym[i][1][1] * plane[1] + OrthoRhombic::MatSym[i][1][2] * plane[2]; + slipPlane[0] = OrthoRhombic::k_MatSym[i](0, 0) * plane[0] + OrthoRhombic::k_MatSym[i](0, 1) * plane[1] + OrthoRhombic::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = OrthoRhombic::k_MatSym[i](1, 0) * plane[0] + OrthoRhombic::k_MatSym[i](1, 1) * plane[1] + OrthoRhombic::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = OrthoRhombic::MatSym[i][0][0] * direction[0] + OrthoRhombic::MatSym[i][0][1] * direction[1] + OrthoRhombic::MatSym[i][0][2] * direction[2]; - slipDirection[1] = OrthoRhombic::MatSym[i][1][0] * direction[0] + OrthoRhombic::MatSym[i][1][1] * direction[1] + OrthoRhombic::MatSym[i][1][2] * direction[2]; - slipDirection[2] = OrthoRhombic::MatSym[i][2][0] * direction[0] + OrthoRhombic::MatSym[i][2][1] * direction[1] + OrthoRhombic::MatSym[i][2][2] * direction[2]; + slipDirection[0] = OrthoRhombic::k_MatSym[i](0, 0) * direction[0] + OrthoRhombic::k_MatSym[i](0, 1) * direction[1] + OrthoRhombic::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = OrthoRhombic::k_MatSym[i](1, 0) * direction[0] + OrthoRhombic::k_MatSym[i](1, 1) * direction[1] + OrthoRhombic::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = OrthoRhombic::k_MatSym[i](2, 0) * direction[0] + OrthoRhombic::k_MatSym[i](2, 1) * direction[1] + OrthoRhombic::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -476,8 +443,6 @@ double OrthoRhombicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bo return 0.0; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace OrthoRhombic { @@ -550,25 +515,23 @@ class GenerateSphereCoordsImpl }; } // namespace OrthoRhombic -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void OrthoRhombicOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * OrthoRhombic::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * OrthoRhombic::k_SymSize0) { - xyz001->resizeTuples(nOrientations * OrthoRhombic::symSize0 * 3); + xyz001->resizeTuples(nOrientations * OrthoRhombic::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * OrthoRhombic::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * OrthoRhombic::k_SymSize1) { - xyz011->resizeTuples(nOrientations * OrthoRhombic::symSize1 * 3); + xyz011->resizeTuples(nOrientations * OrthoRhombic::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * OrthoRhombic::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * OrthoRhombic::k_SymSize2) { - xyz111->resizeTuples(nOrientations * OrthoRhombic::symSize2 * 3); + xyz111->resizeTuples(nOrientations * OrthoRhombic::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -585,8 +548,6 @@ std::array OrthoRhombicOps::getIpfColorAngleLimits(double eta) const return {OrthoRhombic::k_EtaMin * ebsdlib::constants::k_DegToRadD, OrthoRhombic::k_EtaMax * ebsdlib::constants::k_DegToRadD, OrthoRhombic::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool OrthoRhombicOps::inUnitTriangle(double eta, double chi) const { @@ -594,16 +555,12 @@ bool OrthoRhombicOps::inUnitTriangle(double eta, double chi) const chi > (OrthoRhombic::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb OrthoRhombicOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb OrthoRhombicOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -612,14 +569,12 @@ ebsdlib::Rgb OrthoRhombicOps::generateIPFColor(double phi1, double phi, double p return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb OrthoRhombicOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * OrthoRhombic::OdfDimInitValue[0]; - double range2 = 2.0f * OrthoRhombic::OdfDimInitValue[1]; - double range3 = 2.0f * OrthoRhombic::OdfDimInitValue[2]; + double range1 = 2.0f * OrthoRhombic::k_OdfDimInitValue[0]; + double range2 = 2.0f * OrthoRhombic::k_OdfDimInitValue[1]; + double range3 = 2.0f * OrthoRhombic::k_OdfDimInitValue[2]; double max1 = range1 / 2.0; double max2 = range2 / 2.0; double max3 = range3 / 2.0; @@ -635,16 +590,12 @@ ebsdlib::Rgb OrthoRhombicOps::generateRodriguesColor(double r1, double r2, doubl return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array OrthoRhombicOps::getDefaultPoleFigureNames() const { return {"<001>", "<100>", "<010>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector OrthoRhombicOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -671,9 +622,9 @@ std::vector OrthoRhombicOps::generatePoleFigur // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. std::vector dims(1, 3); std::vector coords(3); - coords[0] = ebsdlib::FloatArrayType::CreateArray(numOrientations * OrthoRhombic::symSize0, dims, label0 + std::string("001_Coords"), true); - coords[1] = ebsdlib::FloatArrayType::CreateArray(numOrientations * OrthoRhombic::symSize1, dims, label1 + std::string("100_Coords"), true); - coords[2] = ebsdlib::FloatArrayType::CreateArray(numOrientations * OrthoRhombic::symSize2, dims, label2 + std::string("010_Coords"), true); + coords[0] = ebsdlib::FloatArrayType::CreateArray(numOrientations * OrthoRhombic::k_SymSize0, dims, label0 + std::string("001_Coords"), true); + coords[1] = ebsdlib::FloatArrayType::CreateArray(numOrientations * OrthoRhombic::k_SymSize1, dims, label1 + std::string("100_Coords"), true); + coords[2] = ebsdlib::FloatArrayType::CreateArray(numOrientations * OrthoRhombic::k_SymSize2, dims, label2 + std::string("010_Coords"), true); config.sphereRadius = 1.0; @@ -681,7 +632,7 @@ std::vector OrthoRhombicOps::generatePoleFigur generateSphereCoordsFromEulers(config.eulers, coords[0].get(), coords[1].get(), coords[2].get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity100 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity010 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -882,10 +833,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float +0.25F, 0.0F, -0.1F, 0.0F, 0.25F, 0.75F, 1.1F, 1.0F, }; std::vector drawAngle = {true, true, true, false, false, false, false, false}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -1034,13 +985,13 @@ OrthoRhombicOps::Pointer OrthoRhombicOps::NullPointer() // ----------------------------------------------------------------------------- std::string OrthoRhombicOps::getNameOfClass() const { - return std::string("OrthorhombicOps"); + return {"OrthorhombicOps"}; } // ----------------------------------------------------------------------------- std::string OrthoRhombicOps::ClassName() { - return std::string("OrthorhombicOps"); + return {"OrthorhombicOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/OrthoRhombicOps.h b/Source/EbsdLib/LaueOps/OrthoRhombicOps.h index 26c727c..16c37af 100644 --- a/Source/EbsdLib/LaueOps/OrthoRhombicOps.h +++ b/Source/EbsdLib/LaueOps/OrthoRhombicOps.h @@ -87,10 +87,10 @@ class EbsdLib_EXPORT OrthoRhombicOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -99,7 +99,7 @@ class EbsdLib_EXPORT OrthoRhombicOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -111,7 +111,7 @@ class EbsdLib_EXPORT OrthoRhombicOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -157,7 +157,7 @@ class EbsdLib_EXPORT OrthoRhombicOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -170,15 +170,15 @@ class EbsdLib_EXPORT OrthoRhombicOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/SO3Sampler.cpp b/Source/EbsdLib/LaueOps/SO3Sampler.cpp index d5c9d65..2623ca5 100644 --- a/Source/EbsdLib/LaueOps/SO3Sampler.cpp +++ b/Source/EbsdLib/LaueOps/SO3Sampler.cpp @@ -95,13 +95,9 @@ static const int FZoarray[32] = {NoAxisOrder, NoAxisOrder, TwoFold ThreeFoldAxisOrder, ThreeFoldAxisOrder, ThreeFoldAxisOrder, ThreeFoldAxisOrder, SixFoldAxisOrder, SixFoldAxisOrder, SixFoldAxisOrder, SixFoldAxisOrder, SixFoldAxisOrder, SixFoldAxisOrder, SixFoldAxisOrder, NoAxisOrder, NoAxisOrder, NoAxisOrder, NoAxisOrder, NoAxisOrder}; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- SO3Sampler::SO3Sampler() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- SO3Sampler::~SO3Sampler() = default; diff --git a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp index 015f1df..ec5629c 100644 --- a/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalLowOps.cpp @@ -56,55 +56,58 @@ using namespace ebsdlib; namespace TetragonalLow { -constexpr std::array OdfNumBins = {72, 72, 18}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {72, 72, 18}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiOver4D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiOver4D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 2; -constexpr int symSize2 = 2; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 2; +constexpr int k_SymSize2 = 2; -constexpr int k_OdfSize = 93312; -constexpr int k_MdfSize = 93312; -constexpr int k_SymOpsCount = 4; +constexpr size_t k_OdfSize = 93312; +constexpr size_t k_MdfSize = 93312; +constexpr size_t k_SymOpsCount = 4; constexpr int k_NumMdfBins = 36; + +static const double sqrtHalf = std::sqrt(0.500000000000000); + // Rotation Point Group: 4 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(0.0, 0.0, 1.0, 0.0), - QuatD(0.0, 0.0, 0.7071067811865476, 0.7071067811865476), - QuatD(0.0, 0.0, -0.7071067811865476, 0.7071067811865476), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(0.0, 0.0, 1.0, 0.0), + QuatD(0.0, 0.0, sqrtHalf, sqrtHalf), + QuatD(0.0, 0.0, -sqrtHalf, sqrtHalf), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0, 10000000000000.0}, - {0.0, 0.0, 1.0, 1.0}, - {0.0, 0.0, -1.0, 1.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0, 10000000000000.0}, + {0.0, 0.0, 1.0, 1.0}, + {0.0, 0.0, -1.0, 1.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.0, -1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.0, 1.0, 0.0}, - {-1.0, 0.0, -0.0}, - {-0.0, 0.0, 1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {-1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0}, + + {0.0, -1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0}, + + {0.0, 1.0, 0.0, + -1.0, 0.0, -0.0, + -0.0, 0.0, 1.0}, + }; /* clang-format on */ @@ -113,18 +116,12 @@ constexpr double k_EtaMax = 90.0; constexpr double k_ChiMax = 90.0; } // namespace TetragonalLow -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TetragonalLowOps::TetragonalLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TetragonalLowOps::~TetragonalLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TetragonalLowOps::getHasInversion() const { @@ -132,9 +129,7 @@ bool TetragonalLowOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TetragonalLowOps::getODFSize() const +size_t TetragonalLowOps::getODFSize() const { return TetragonalLow::k_OdfSize; } @@ -142,13 +137,11 @@ int TetragonalLowOps::getODFSize() const // ----------------------------------------------------------------------------- std::array TetragonalLowOps::getNumSymmetry() const { - return {TetragonalLow::symSize0, TetragonalLow::symSize1, TetragonalLow::symSize2}; + return {TetragonalLow::k_SymSize0, TetragonalLow::k_SymSize1, TetragonalLow::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TetragonalLowOps::getMDFSize() const +size_t TetragonalLowOps::getMDFSize() const { return TetragonalLow::k_MdfSize; } @@ -160,9 +153,7 @@ int TetragonalLowOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TetragonalLowOps::getNumSymOps() const +size_t TetragonalLowOps::getNumSymOps() const { return TetragonalLow::k_SymOpsCount; } @@ -170,19 +161,15 @@ int TetragonalLowOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array TetragonalLowOps::getOdfNumBins() const { - return TetragonalLow::OdfNumBins; + return TetragonalLow::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TetragonalLowOps::getSymmetryName() const { return "Tetragonal 4/m (C4h)"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TetragonalLowOps::getRotationPointGroup() const { @@ -209,47 +196,42 @@ bool TetragonalLowOps::isInsideFZ(const RodriguesDType& rod) const AxisAngleDType TetragonalLowOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(TetragonalLow::QuatSym, q1, q2); + return calculateMisorientationInternal(TetragonalLow::k_QuatSym, q1, q2); } -QuatD TetragonalLowOps::getQuatSymOp(int32_t i) const +QuatD TetragonalLowOps::getQuatSymOp(size_t i) const { - return TetragonalLow::QuatSym[i]; + return TetragonalLow::k_QuatSym[i]; } -int32_t TetragonalLowOps::getNumRodriguesSymOps() const +size_t TetragonalLowOps::getNumRodriguesSymOps() const { - return TetragonalLow::RodSym.size(); + return TetragonalLow::k_RodSym.size(); } RodriguesDType TetragonalLowOps::getRodSymOp(size_t i) const { - return TetragonalLow::RodSym[i]; + return TetragonalLow::k_RodSym[i]; } -Matrix3X3D TetragonalLowOps::getMatSymOpD(int i) const +Matrix3X3D TetragonalLowOps::getMatSymOpD(size_t i) const { - return {TetragonalLow::MatSym[i][0][0], TetragonalLow::MatSym[i][0][1], TetragonalLow::MatSym[i][0][2], TetragonalLow::MatSym[i][1][0], TetragonalLow::MatSym[i][1][1], - TetragonalLow::MatSym[i][1][2], TetragonalLow::MatSym[i][2][0], TetragonalLow::MatSym[i][2][1], TetragonalLow::MatSym[i][2][2]}; + return TetragonalLow::k_MatSym[i]; } -Matrix3X3F TetragonalLowOps::getMatSymOpF(int i) const +Matrix3X3F TetragonalLowOps::getMatSymOpF(size_t i) const { - return {static_cast(TetragonalLow::MatSym[i][0][0]), static_cast(TetragonalLow::MatSym[i][0][1]), static_cast(TetragonalLow::MatSym[i][0][2]), - static_cast(TetragonalLow::MatSym[i][1][0]), static_cast(TetragonalLow::MatSym[i][1][1]), static_cast(TetragonalLow::MatSym[i][1][2]), - static_cast(TetragonalLow::MatSym[i][2][0]), static_cast(TetragonalLow::MatSym[i][2][1]), static_cast(TetragonalLow::MatSym[i][2][2])}; + return {static_cast(TetragonalLow::k_MatSym[i](0, 0)), static_cast(TetragonalLow::k_MatSym[i](0, 1)), static_cast(TetragonalLow::k_MatSym[i](0, 2)), + static_cast(TetragonalLow::k_MatSym[i](1, 0)), static_cast(TetragonalLow::k_MatSym[i](1, 1)), static_cast(TetragonalLow::k_MatSym[i](1, 2)), + static_cast(TetragonalLow::k_MatSym[i](2, 0)), static_cast(TetragonalLow::k_MatSym[i](2, 1)), static_cast(TetragonalLow::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TetragonalLowOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- RodriguesDType TetragonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const { double FZn1 = 0.0, FZn2 = 0.0, FZn3 = 0.0, FZw = 0.0; @@ -265,16 +247,14 @@ RodriguesDType TetragonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const return AxisAngleDType(FZn1, FZn2, FZn3, FZw).toRodrigues(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD TetragonalLowOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(TetragonalLow::QuatSym, q1, q2); + return _calcNearestQuat(TetragonalLow::k_QuatSym, q1, q2); } QuatF TetragonalLowOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(TetragonalLow::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(TetragonalLow::k_QuatSym, q1f.to(), q2f.to()).to(); } // ----------------------------------------------------------------------------- @@ -282,11 +262,9 @@ QuatD TetragonalLowOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(TetragonalLow::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(TetragonalLow::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TetragonalLowOps::getMisoBin(const RodriguesDType& rod) const { @@ -296,21 +274,19 @@ int TetragonalLowOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TetragonalLow::OdfDimInitValue[0]; - dim[1] = TetragonalLow::OdfDimInitValue[1]; - dim[2] = TetragonalLow::OdfDimInitValue[2]; - step[0] = TetragonalLow::OdfDimStepValue[0]; - step[1] = TetragonalLow::OdfDimStepValue[1]; - step[2] = TetragonalLow::OdfDimStepValue[2]; - bins[0] = static_cast(TetragonalLow::OdfNumBins[0]); - bins[1] = static_cast(TetragonalLow::OdfNumBins[1]); - bins[2] = static_cast(TetragonalLow::OdfNumBins[2]); + dim[0] = TetragonalLow::k_OdfDimInitValue[0]; + dim[1] = TetragonalLow::k_OdfDimInitValue[1]; + dim[2] = TetragonalLow::k_OdfDimInitValue[2]; + step[0] = TetragonalLow::k_OdfDimStepValue[0]; + step[1] = TetragonalLow::k_OdfDimStepValue[1]; + step[2] = TetragonalLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(TetragonalLow::k_OdfNumBins[0]); + bins[1] = static_cast(TetragonalLow::k_OdfNumBins[1]); + bins[2] = static_cast(TetragonalLow::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TetragonalLowOps::determineEulerAngles(double random[3], int choose) const { @@ -319,15 +295,15 @@ EulerDType TetragonalLowOps::determineEulerAngles(double random[3], int choose) int32_t phi[3]; double h1, h2, h3; - init[0] = TetragonalLow::OdfDimInitValue[0]; - init[1] = TetragonalLow::OdfDimInitValue[1]; - init[2] = TetragonalLow::OdfDimInitValue[2]; - step[0] = TetragonalLow::OdfDimStepValue[0]; - step[1] = TetragonalLow::OdfDimStepValue[1]; - step[2] = TetragonalLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TetragonalLow::OdfNumBins[0]); - phi[1] = static_cast((choose / TetragonalLow::OdfNumBins[0]) % TetragonalLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (TetragonalLow::OdfNumBins[0] * TetragonalLow::OdfNumBins[1])); + init[0] = TetragonalLow::k_OdfDimInitValue[0]; + init[1] = TetragonalLow::k_OdfDimInitValue[1]; + init[2] = TetragonalLow::k_OdfDimInitValue[2]; + step[0] = TetragonalLow::k_OdfDimStepValue[0]; + step[1] = TetragonalLow::k_OdfDimStepValue[1]; + step[2] = TetragonalLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TetragonalLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TetragonalLow::k_OdfNumBins[0]) % TetragonalLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TetragonalLow::k_OdfNumBins[0] * TetragonalLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -337,19 +313,15 @@ EulerDType TetragonalLowOps::determineEulerAngles(double random[3], int choose) return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TetragonalLowOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(TetragonalLow::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = TetragonalLow::QuatSym[symOp] * quat; + QuatD qc = TetragonalLow::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TetragonalLowOps::determineRodriguesVector(double random[3], int choose) const { @@ -358,15 +330,15 @@ RodriguesDType TetragonalLowOps::determineRodriguesVector(double random[3], int int32_t phi[3]; double h1, h2, h3; - init[0] = TetragonalLow::OdfDimInitValue[0]; - init[1] = TetragonalLow::OdfDimInitValue[1]; - init[2] = TetragonalLow::OdfDimInitValue[2]; - step[0] = TetragonalLow::OdfDimStepValue[0]; - step[1] = TetragonalLow::OdfDimStepValue[1]; - step[2] = TetragonalLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TetragonalLow::OdfNumBins[0]); - phi[1] = static_cast((choose / TetragonalLow::OdfNumBins[0]) % TetragonalLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (TetragonalLow::OdfNumBins[0] * TetragonalLow::OdfNumBins[1])); + init[0] = TetragonalLow::k_OdfDimInitValue[0]; + init[1] = TetragonalLow::k_OdfDimInitValue[1]; + init[2] = TetragonalLow::k_OdfDimInitValue[2]; + step[0] = TetragonalLow::k_OdfDimStepValue[0]; + step[1] = TetragonalLow::k_OdfDimStepValue[1]; + step[2] = TetragonalLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TetragonalLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TetragonalLow::k_OdfNumBins[0]) % TetragonalLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TetragonalLow::k_OdfNumBins[0] * TetragonalLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -374,8 +346,6 @@ RodriguesDType TetragonalLowOps::determineRodriguesVector(double random[3], int return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TetragonalLowOps::getOdfBin(const RodriguesDType& rod) const { @@ -385,15 +355,15 @@ int TetragonalLowOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TetragonalLow::OdfDimInitValue[0]; - dim[1] = TetragonalLow::OdfDimInitValue[1]; - dim[2] = TetragonalLow::OdfDimInitValue[2]; - step[0] = TetragonalLow::OdfDimStepValue[0]; - step[1] = TetragonalLow::OdfDimStepValue[1]; - step[2] = TetragonalLow::OdfDimStepValue[2]; - bins[0] = static_cast(TetragonalLow::OdfNumBins[0]); - bins[1] = static_cast(TetragonalLow::OdfNumBins[1]); - bins[2] = static_cast(TetragonalLow::OdfNumBins[2]); + dim[0] = TetragonalLow::k_OdfDimInitValue[0]; + dim[1] = TetragonalLow::k_OdfDimInitValue[1]; + dim[2] = TetragonalLow::k_OdfDimInitValue[2]; + step[0] = TetragonalLow::k_OdfDimStepValue[0]; + step[1] = TetragonalLow::k_OdfDimStepValue[1]; + step[2] = TetragonalLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(TetragonalLow::k_OdfNumBins[0]); + bins[1] = static_cast(TetragonalLow::k_OdfNumBins[1]); + bins[2] = static_cast(TetragonalLow::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -423,21 +393,21 @@ void TetragonalLowOps::getSchmidFactorAndSS(double load[3], double plane[3], dou { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = TetragonalLow::MatSym[i][2][0] * plane[0] + TetragonalLow::MatSym[i][2][1] * plane[1] + TetragonalLow::MatSym[i][2][2] * plane[2]; + slipPlane[2] = TetragonalLow::k_MatSym[i](2, 0) * plane[0] + TetragonalLow::k_MatSym[i](2, 1) * plane[1] + TetragonalLow::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = TetragonalLow::MatSym[i][0][0] * plane[0] + TetragonalLow::MatSym[i][0][1] * plane[1] + TetragonalLow::MatSym[i][0][2] * plane[2]; - slipPlane[1] = TetragonalLow::MatSym[i][1][0] * plane[0] + TetragonalLow::MatSym[i][1][1] * plane[1] + TetragonalLow::MatSym[i][1][2] * plane[2]; + slipPlane[0] = TetragonalLow::k_MatSym[i](0, 0) * plane[0] + TetragonalLow::k_MatSym[i](0, 1) * plane[1] + TetragonalLow::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = TetragonalLow::k_MatSym[i](1, 0) * plane[0] + TetragonalLow::k_MatSym[i](1, 1) * plane[1] + TetragonalLow::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = TetragonalLow::MatSym[i][0][0] * direction[0] + TetragonalLow::MatSym[i][0][1] * direction[1] + TetragonalLow::MatSym[i][0][2] * direction[2]; - slipDirection[1] = TetragonalLow::MatSym[i][1][0] * direction[0] + TetragonalLow::MatSym[i][1][1] * direction[1] + TetragonalLow::MatSym[i][1][2] * direction[2]; - slipDirection[2] = TetragonalLow::MatSym[i][2][0] * direction[0] + TetragonalLow::MatSym[i][2][1] * direction[1] + TetragonalLow::MatSym[i][2][2] * direction[2]; + slipDirection[0] = TetragonalLow::k_MatSym[i](0, 0) * direction[0] + TetragonalLow::k_MatSym[i](0, 1) * direction[1] + TetragonalLow::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = TetragonalLow::k_MatSym[i](1, 0) * direction[0] + TetragonalLow::k_MatSym[i](1, 1) * direction[1] + TetragonalLow::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = TetragonalLow::k_MatSym[i](2, 0) * direction[0] + TetragonalLow::k_MatSym[i](2, 1) * direction[1] + TetragonalLow::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -471,8 +441,6 @@ double TetragonalLowOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], b return 0.0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- namespace TetragonalLow @@ -546,25 +514,23 @@ class GenerateSphereCoordsImpl }; } // namespace TetragonalLow -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void TetragonalLowOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * TetragonalLow::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * TetragonalLow::k_SymSize0) { - xyz001->resizeTuples(nOrientations * TetragonalLow::symSize0 * 3); + xyz001->resizeTuples(nOrientations * TetragonalLow::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * TetragonalLow::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * TetragonalLow::k_SymSize1) { - xyz011->resizeTuples(nOrientations * TetragonalLow::symSize1 * 3); + xyz011->resizeTuples(nOrientations * TetragonalLow::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * TetragonalLow::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * TetragonalLow::k_SymSize2) { - xyz111->resizeTuples(nOrientations * TetragonalLow::symSize2 * 3); + xyz111->resizeTuples(nOrientations * TetragonalLow::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -581,8 +547,6 @@ std::array TetragonalLowOps::getIpfColorAngleLimits(double eta) const return {TetragonalLow::k_EtaMin * ebsdlib::constants::k_DegToRadD, TetragonalLow::k_EtaMax * ebsdlib::constants::k_DegToRadD, TetragonalLow::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TetragonalLowOps::inUnitTriangle(double eta, double chi) const { @@ -590,16 +554,12 @@ bool TetragonalLowOps::inUnitTriangle(double eta, double chi) const chi > (TetragonalLow::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TetragonalLowOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TetragonalLowOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -608,14 +568,12 @@ ebsdlib::Rgb TetragonalLowOps::generateIPFColor(double phi1, double phi, double return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TetragonalLowOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * TetragonalLow::OdfDimInitValue[0]; - double range2 = 2.0f * TetragonalLow::OdfDimInitValue[1]; - double range3 = 2.0f * TetragonalLow::OdfDimInitValue[2]; + double range1 = 2.0f * TetragonalLow::k_OdfDimInitValue[0]; + double range2 = 2.0f * TetragonalLow::k_OdfDimInitValue[1]; + double range3 = 2.0f * TetragonalLow::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -631,16 +589,12 @@ ebsdlib::Rgb TetragonalLowOps::generateRodriguesColor(double r1, double r2, doub return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array TetragonalLowOps::getDefaultPoleFigureNames() const { return {"<001>", "<100>", "<010>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector TetragonalLowOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -667,11 +621,11 @@ std::vector TetragonalLowOps::generatePoleFigu // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalLow::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalLow::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalLow::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalLow::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalLow::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalLow::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -679,7 +633,7 @@ std::vector TetragonalLowOps::generatePoleFigu generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -881,10 +835,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float +0.25F, 0.0F, -0.1F, 0.0F, 0.25F, 0.75F, 1.1F, 1.0F, }; std::vector drawAngle = {true, true, true, false, false, false, false, false}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -1060,13 +1014,13 @@ TetragonalLowOps::Pointer TetragonalLowOps::NullPointer() // ----------------------------------------------------------------------------- std::string TetragonalLowOps::getNameOfClass() const { - return std::string("TetragonalLowOps"); + return {"TetragonalLowOps"}; } // ----------------------------------------------------------------------------- std::string TetragonalLowOps::ClassName() { - return std::string("TetragonalLowOps"); + return {"TetragonalLowOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TetragonalLowOps.h b/Source/EbsdLib/LaueOps/TetragonalLowOps.h index 7289460..371ba77 100644 --- a/Source/EbsdLib/LaueOps/TetragonalLowOps.h +++ b/Source/EbsdLib/LaueOps/TetragonalLowOps.h @@ -87,10 +87,10 @@ class EbsdLib_EXPORT TetragonalLowOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -99,7 +99,7 @@ class EbsdLib_EXPORT TetragonalLowOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -111,7 +111,7 @@ class EbsdLib_EXPORT TetragonalLowOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -157,7 +157,7 @@ class EbsdLib_EXPORT TetragonalLowOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -170,15 +170,15 @@ class EbsdLib_EXPORT TetragonalLowOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TetragonalOps.cpp b/Source/EbsdLib/LaueOps/TetragonalOps.cpp index 8f8f93c..a0bf0eb 100644 --- a/Source/EbsdLib/LaueOps/TetragonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TetragonalOps.cpp @@ -57,99 +57,96 @@ using namespace ebsdlib; namespace TetragonalHigh { -constexpr std::array OdfNumBins = {36, 36, 18}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {36, 36, 18}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiOver4D)-std::sin((ebsdlib::constants::k_PiOver4D)))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiOver2D)-std::sin((ebsdlib::constants::k_PiOver2D)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiOver4D)-std::sin((ebsdlib::constants::k_PiOver4D)))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 4; -constexpr int symSize2 = 4; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 4; +constexpr int k_SymSize2 = 4; -constexpr int k_OdfSize = 23328; -constexpr int k_MdfSize = 23328; -constexpr int k_SymOpsCount = 8; +constexpr size_t k_OdfSize = 23328; +constexpr size_t k_MdfSize = 23328; +constexpr size_t k_SymOpsCount = 8; constexpr int k_NumMdfBins = 20; +static const double sqrtHalf = std::sqrt(0.500000000000000); + // Rotation Point Group: 422 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(0.0, 0.0, 1.0, 0.0), - QuatD(0.0, 0.0, 0.7071067811865476, 0.7071067811865476), - QuatD(0.0, 0.0, -0.7071067811865476, 0.7071067811865476), - QuatD(1.0, 0.0, 0.0, 0.0), - QuatD(0.0, 1.0, 0.0, 0.0), - QuatD(0.7071067811865476, 0.7071067811865476, 0.0, 0.0), - QuatD(-0.7071067811865476, 0.7071067811865476, 0.0, 0.0), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(0.0, 0.0, 1.0, 0.0), + QuatD(0.0, 0.0, sqrtHalf, sqrtHalf), + QuatD(0.0, 0.0, -sqrtHalf, sqrtHalf), + QuatD(1.0, 0.0, 0.0, 0.0), + QuatD(0.0, 1.0, 0.0, 0.0), + QuatD(sqrtHalf, sqrtHalf, 0.0, 0.0), + QuatD(-sqrtHalf, sqrtHalf, 0.0, 0.0), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0, 10000000000000.0}, - {0.0, 0.0, 1.0, 1.0}, - {0.0, 0.0, -1.0, 1.0}, - {1.0, 0.0, 0.0, 10000000000000.0}, - {0.0, 1.0, 0.0, 10000000000000.0}, - {0.7071067811865476, 0.7071067811865476, 0.0, 10000000000000.0}, - {-0.7071067811865476, 0.7071067811865476, 0.0, 10000000000000.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0, 10000000000000.0}, + {0.0, 0.0, 1.0, 1.0}, + {0.0, 0.0, -1.0, 1.0}, + {1.0, 0.0, 0.0, 10000000000000.0}, + {0.0, 1.0, 0.0, 10000000000000.0}, + {sqrtHalf, sqrtHalf, 0.0, 10000000000000.0}, + {-sqrtHalf, sqrtHalf, 0.0, 10000000000000.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.0, -1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{0.0, 1.0, 0.0}, - {-1.0, 0.0, -0.0}, - {-0.0, 0.0, 1.0}}, - - {{1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{0.0, 1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{0.0, -1.0, 0.0}, - {-1.0, 0.0, 0.0}, - {-0.0, 0.0, -1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {-1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0}, + + {0.0, -1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0}, + + {0.0, 1.0, 0.0, + -1.0, 0.0, -0.0, + -0.0, 0.0, 1.0}, + + {1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0}, + + {0.0, 1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, -1.0}, + + {0.0, -1.0, 0.0, + -1.0, 0.0, 0.0, + -0.0, 0.0, -1.0}, + }; /* clang-format on */ + constexpr double k_EtaMin = 0.0; constexpr double k_EtaMax = 45.0; constexpr double k_ChiMax = 90.0; } // namespace TetragonalHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TetragonalOps::TetragonalOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TetragonalOps::~TetragonalOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TetragonalOps::getHasInversion() const { @@ -157,9 +154,7 @@ bool TetragonalOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TetragonalOps::getODFSize() const +size_t TetragonalOps::getODFSize() const { return TetragonalHigh::k_OdfSize; } @@ -167,13 +162,11 @@ int TetragonalOps::getODFSize() const // ----------------------------------------------------------------------------- std::array TetragonalOps::getNumSymmetry() const { - return {TetragonalHigh::symSize0, TetragonalHigh::symSize1, TetragonalHigh::symSize2}; + return {TetragonalHigh::k_SymSize0, TetragonalHigh::k_SymSize1, TetragonalHigh::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TetragonalOps::getMDFSize() const +size_t TetragonalOps::getMDFSize() const { return TetragonalHigh::k_MdfSize; } @@ -185,9 +178,7 @@ int TetragonalOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TetragonalOps::getNumSymOps() const +size_t TetragonalOps::getNumSymOps() const { return TetragonalHigh::k_SymOpsCount; } @@ -195,11 +186,9 @@ int TetragonalOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array TetragonalOps::getOdfNumBins() const { - return TetragonalHigh::OdfNumBins; + return TetragonalHigh::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TetragonalOps::getSymmetryName() const { @@ -207,8 +196,6 @@ std::string TetragonalOps::getSymmetryName() const ; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TetragonalOps::getRotationPointGroup() const { @@ -236,47 +223,42 @@ bool TetragonalOps::isInsideFZ(const RodriguesDType& rod) const // ----------------------------------------------------------------------------- AxisAngleDType TetragonalOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(TetragonalHigh::QuatSym, q1, q2); + return calculateMisorientationInternal(TetragonalHigh::k_QuatSym, q1, q2); } -QuatD TetragonalOps::getQuatSymOp(int32_t i) const +QuatD TetragonalOps::getQuatSymOp(size_t i) const { - return TetragonalHigh::QuatSym[i]; + return TetragonalHigh::k_QuatSym[i]; } -int32_t TetragonalOps::getNumRodriguesSymOps() const +size_t TetragonalOps::getNumRodriguesSymOps() const { - return TetragonalHigh::RodSym.size(); + return TetragonalHigh::k_RodSym.size(); } RodriguesDType TetragonalOps::getRodSymOp(size_t i) const { - return TetragonalHigh::RodSym[i]; + return TetragonalHigh::k_RodSym[i]; } -Matrix3X3D TetragonalOps::getMatSymOpD(int i) const +Matrix3X3D TetragonalOps::getMatSymOpD(size_t i) const { - return {TetragonalHigh::MatSym[i][0][0], TetragonalHigh::MatSym[i][0][1], TetragonalHigh::MatSym[i][0][2], TetragonalHigh::MatSym[i][1][0], TetragonalHigh::MatSym[i][1][1], - TetragonalHigh::MatSym[i][1][2], TetragonalHigh::MatSym[i][2][0], TetragonalHigh::MatSym[i][2][1], TetragonalHigh::MatSym[i][2][2]}; + return TetragonalHigh::k_MatSym[i]; } -Matrix3X3F TetragonalOps::getMatSymOpF(int i) const +Matrix3X3F TetragonalOps::getMatSymOpF(size_t i) const { - return {static_cast(TetragonalHigh::MatSym[i][0][0]), static_cast(TetragonalHigh::MatSym[i][0][1]), static_cast(TetragonalHigh::MatSym[i][0][2]), - static_cast(TetragonalHigh::MatSym[i][1][0]), static_cast(TetragonalHigh::MatSym[i][1][1]), static_cast(TetragonalHigh::MatSym[i][1][2]), - static_cast(TetragonalHigh::MatSym[i][2][0]), static_cast(TetragonalHigh::MatSym[i][2][1]), static_cast(TetragonalHigh::MatSym[i][2][2])}; + return {static_cast(TetragonalHigh::k_MatSym[i](0, 0)), static_cast(TetragonalHigh::k_MatSym[i](0, 1)), static_cast(TetragonalHigh::k_MatSym[i](0, 2)), + static_cast(TetragonalHigh::k_MatSym[i](1, 0)), static_cast(TetragonalHigh::k_MatSym[i](1, 1)), static_cast(TetragonalHigh::k_MatSym[i](1, 2)), + static_cast(TetragonalHigh::k_MatSym[i](2, 0)), static_cast(TetragonalHigh::k_MatSym[i](2, 1)), static_cast(TetragonalHigh::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TetragonalOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TetragonalOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -294,16 +276,14 @@ RodriguesDType TetragonalOps::getMDFFZRod(const RodriguesDType& inRod) const return AxisAngleDType(FZn1, FZn2, FZn3, FZw).toRodrigues(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD TetragonalOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(TetragonalHigh::QuatSym, q1, q2); + return _calcNearestQuat(TetragonalHigh::k_QuatSym, q1, q2); } QuatF TetragonalOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(TetragonalHigh::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(TetragonalHigh::k_QuatSym, q1f.to(), q2f.to()).to(); } // ----------------------------------------------------------------------------- @@ -311,11 +291,9 @@ QuatD TetragonalOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(TetragonalHigh::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(TetragonalHigh::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TetragonalOps::getMisoBin(const RodriguesDType& rod) const { @@ -325,21 +303,19 @@ int TetragonalOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TetragonalHigh::OdfDimInitValue[0]; - dim[1] = TetragonalHigh::OdfDimInitValue[1]; - dim[2] = TetragonalHigh::OdfDimInitValue[2]; - step[0] = TetragonalHigh::OdfDimStepValue[0]; - step[1] = TetragonalHigh::OdfDimStepValue[1]; - step[2] = TetragonalHigh::OdfDimStepValue[2]; - bins[0] = static_cast(TetragonalHigh::OdfNumBins[0]); - bins[1] = static_cast(TetragonalHigh::OdfNumBins[1]); - bins[2] = static_cast(TetragonalHigh::OdfNumBins[2]); + dim[0] = TetragonalHigh::k_OdfDimInitValue[0]; + dim[1] = TetragonalHigh::k_OdfDimInitValue[1]; + dim[2] = TetragonalHigh::k_OdfDimInitValue[2]; + step[0] = TetragonalHigh::k_OdfDimStepValue[0]; + step[1] = TetragonalHigh::k_OdfDimStepValue[1]; + step[2] = TetragonalHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(TetragonalHigh::k_OdfNumBins[0]); + bins[1] = static_cast(TetragonalHigh::k_OdfNumBins[1]); + bins[2] = static_cast(TetragonalHigh::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TetragonalOps::determineEulerAngles(double random[3], int choose) const { @@ -348,15 +324,15 @@ EulerDType TetragonalOps::determineEulerAngles(double random[3], int choose) con int32_t phi[3]; double h1, h2, h3; - init[0] = TetragonalHigh::OdfDimInitValue[0]; - init[1] = TetragonalHigh::OdfDimInitValue[1]; - init[2] = TetragonalHigh::OdfDimInitValue[2]; - step[0] = TetragonalHigh::OdfDimStepValue[0]; - step[1] = TetragonalHigh::OdfDimStepValue[1]; - step[2] = TetragonalHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TetragonalHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / TetragonalHigh::OdfNumBins[0]) % TetragonalHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (TetragonalHigh::OdfNumBins[0] * TetragonalHigh::OdfNumBins[1])); + init[0] = TetragonalHigh::k_OdfDimInitValue[0]; + init[1] = TetragonalHigh::k_OdfDimInitValue[1]; + init[2] = TetragonalHigh::k_OdfDimInitValue[2]; + step[0] = TetragonalHigh::k_OdfDimStepValue[0]; + step[1] = TetragonalHigh::k_OdfDimStepValue[1]; + step[2] = TetragonalHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TetragonalHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TetragonalHigh::k_OdfNumBins[0]) % TetragonalHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TetragonalHigh::k_OdfNumBins[0] * TetragonalHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -366,19 +342,15 @@ EulerDType TetragonalOps::determineEulerAngles(double random[3], int choose) con return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TetragonalOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(TetragonalHigh::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = TetragonalHigh::QuatSym[symOp] * quat; + QuatD qc = TetragonalHigh::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TetragonalOps::determineRodriguesVector(double random[3], int choose) const { @@ -387,15 +359,15 @@ RodriguesDType TetragonalOps::determineRodriguesVector(double random[3], int cho int32_t phi[3]; double h1, h2, h3; - init[0] = TetragonalHigh::OdfDimInitValue[0]; - init[1] = TetragonalHigh::OdfDimInitValue[1]; - init[2] = TetragonalHigh::OdfDimInitValue[2]; - step[0] = TetragonalHigh::OdfDimStepValue[0]; - step[1] = TetragonalHigh::OdfDimStepValue[1]; - step[2] = TetragonalHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TetragonalHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / TetragonalHigh::OdfNumBins[0]) % TetragonalHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (TetragonalHigh::OdfNumBins[0] * TetragonalHigh::OdfNumBins[1])); + init[0] = TetragonalHigh::k_OdfDimInitValue[0]; + init[1] = TetragonalHigh::k_OdfDimInitValue[1]; + init[2] = TetragonalHigh::k_OdfDimInitValue[2]; + step[0] = TetragonalHigh::k_OdfDimStepValue[0]; + step[1] = TetragonalHigh::k_OdfDimStepValue[1]; + step[2] = TetragonalHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TetragonalHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TetragonalHigh::k_OdfNumBins[0]) % TetragonalHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TetragonalHigh::k_OdfNumBins[0] * TetragonalHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -403,8 +375,6 @@ RodriguesDType TetragonalOps::determineRodriguesVector(double random[3], int cho return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TetragonalOps::getOdfBin(const RodriguesDType& rod) const { @@ -414,15 +384,15 @@ int TetragonalOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TetragonalHigh::OdfDimInitValue[0]; - dim[1] = TetragonalHigh::OdfDimInitValue[1]; - dim[2] = TetragonalHigh::OdfDimInitValue[2]; - step[0] = TetragonalHigh::OdfDimStepValue[0]; - step[1] = TetragonalHigh::OdfDimStepValue[1]; - step[2] = TetragonalHigh::OdfDimStepValue[2]; - bins[0] = static_cast(TetragonalHigh::OdfNumBins[0]); - bins[1] = static_cast(TetragonalHigh::OdfNumBins[1]); - bins[2] = static_cast(TetragonalHigh::OdfNumBins[2]); + dim[0] = TetragonalHigh::k_OdfDimInitValue[0]; + dim[1] = TetragonalHigh::k_OdfDimInitValue[1]; + dim[2] = TetragonalHigh::k_OdfDimInitValue[2]; + step[0] = TetragonalHigh::k_OdfDimStepValue[0]; + step[1] = TetragonalHigh::k_OdfDimStepValue[1]; + step[2] = TetragonalHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(TetragonalHigh::k_OdfNumBins[0]); + bins[1] = static_cast(TetragonalHigh::k_OdfNumBins[1]); + bins[2] = static_cast(TetragonalHigh::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -452,21 +422,21 @@ void TetragonalOps::getSchmidFactorAndSS(double load[3], double plane[3], double { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = TetragonalHigh::MatSym[i][2][0] * plane[0] + TetragonalHigh::MatSym[i][2][1] * plane[1] + TetragonalHigh::MatSym[i][2][2] * plane[2]; + slipPlane[2] = TetragonalHigh::k_MatSym[i](2, 0) * plane[0] + TetragonalHigh::k_MatSym[i](2, 1) * plane[1] + TetragonalHigh::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = TetragonalHigh::MatSym[i][0][0] * plane[0] + TetragonalHigh::MatSym[i][0][1] * plane[1] + TetragonalHigh::MatSym[i][0][2] * plane[2]; - slipPlane[1] = TetragonalHigh::MatSym[i][1][0] * plane[0] + TetragonalHigh::MatSym[i][1][1] * plane[1] + TetragonalHigh::MatSym[i][1][2] * plane[2]; + slipPlane[0] = TetragonalHigh::k_MatSym[i](0, 0) * plane[0] + TetragonalHigh::k_MatSym[i](0, 1) * plane[1] + TetragonalHigh::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = TetragonalHigh::k_MatSym[i](1, 0) * plane[0] + TetragonalHigh::k_MatSym[i](1, 1) * plane[1] + TetragonalHigh::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = TetragonalHigh::MatSym[i][0][0] * direction[0] + TetragonalHigh::MatSym[i][0][1] * direction[1] + TetragonalHigh::MatSym[i][0][2] * direction[2]; - slipDirection[1] = TetragonalHigh::MatSym[i][1][0] * direction[0] + TetragonalHigh::MatSym[i][1][1] * direction[1] + TetragonalHigh::MatSym[i][1][2] * direction[2]; - slipDirection[2] = TetragonalHigh::MatSym[i][2][0] * direction[0] + TetragonalHigh::MatSym[i][2][1] * direction[1] + TetragonalHigh::MatSym[i][2][2] * direction[2]; + slipDirection[0] = TetragonalHigh::k_MatSym[i](0, 0) * direction[0] + TetragonalHigh::k_MatSym[i](0, 1) * direction[1] + TetragonalHigh::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = TetragonalHigh::k_MatSym[i](1, 0) * direction[0] + TetragonalHigh::k_MatSym[i](1, 1) * direction[1] + TetragonalHigh::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = TetragonalHigh::k_MatSym[i](2, 0) * direction[0] + TetragonalHigh::k_MatSym[i](2, 1) * direction[1] + TetragonalHigh::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -500,8 +470,6 @@ double TetragonalOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool return 0.0; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace TetragonalHigh { class GenerateSphereCoordsImpl @@ -588,24 +556,22 @@ class GenerateSphereCoordsImpl }; } // namespace TetragonalHigh // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- void TetragonalOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * TetragonalHigh::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * TetragonalHigh::k_SymSize0) { - xyz001->resizeTuples(nOrientations * TetragonalHigh::symSize0 * 3); + xyz001->resizeTuples(nOrientations * TetragonalHigh::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * TetragonalHigh::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * TetragonalHigh::k_SymSize1) { - xyz011->resizeTuples(nOrientations * TetragonalHigh::symSize1 * 3); + xyz011->resizeTuples(nOrientations * TetragonalHigh::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * TetragonalHigh::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * TetragonalHigh::k_SymSize2) { - xyz111->resizeTuples(nOrientations * TetragonalHigh::symSize2 * 3); + xyz111->resizeTuples(nOrientations * TetragonalHigh::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -628,8 +594,6 @@ std::array TetragonalOps::getIpfColorAngleLimits(double eta) const return {TetragonalHigh::k_EtaMin * ebsdlib::constants::k_DegToRadD, TetragonalHigh::k_EtaMax * ebsdlib::constants::k_DegToRadD, TetragonalHigh::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TetragonalOps::inUnitTriangle(double eta, double chi) const { @@ -637,16 +601,12 @@ bool TetragonalOps::inUnitTriangle(double eta, double chi) const chi > (TetragonalHigh::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TetragonalOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TetragonalOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -655,14 +615,12 @@ ebsdlib::Rgb TetragonalOps::generateIPFColor(double phi1, double phi, double phi return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TetragonalOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * TetragonalHigh::OdfDimInitValue[0]; - double range2 = 2.0f * TetragonalHigh::OdfDimInitValue[1]; - double range3 = 2.0f * TetragonalHigh::OdfDimInitValue[2]; + double range1 = 2.0f * TetragonalHigh::k_OdfDimInitValue[0]; + double range2 = 2.0f * TetragonalHigh::k_OdfDimInitValue[1]; + double range3 = 2.0f * TetragonalHigh::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -678,16 +636,12 @@ ebsdlib::Rgb TetragonalOps::generateRodriguesColor(double r1, double r2, double return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array TetragonalOps::getDefaultPoleFigureNames() const { return {"<001>", "<100>", "<110>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector TetragonalOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -714,11 +668,11 @@ std::vector TetragonalOps::generatePoleFigure( // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalHigh::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalHigh::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalHigh::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalHigh::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalHigh::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TetragonalHigh::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -726,7 +680,7 @@ std::vector TetragonalOps::generatePoleFigure( generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -924,10 +878,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float +0.25F, 0.0F, -0.1F, 0.0F, 0.25F, 0.75F, 1.1F, 1.0F, }; std::vector drawAngle = {true, true, false, false, false, false, false, false}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -1077,13 +1031,13 @@ TetragonalOps::Pointer TetragonalOps::NullPointer() // ----------------------------------------------------------------------------- std::string TetragonalOps::getNameOfClass() const { - return std::string("TetragonalOps"); + return {"TetragonalOps"}; } // ----------------------------------------------------------------------------- std::string TetragonalOps::ClassName() { - return std::string("TetragonalOps"); + return {"TetragonalOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TetragonalOps.h b/Source/EbsdLib/LaueOps/TetragonalOps.h index de56c03..fde56af 100644 --- a/Source/EbsdLib/LaueOps/TetragonalOps.h +++ b/Source/EbsdLib/LaueOps/TetragonalOps.h @@ -87,10 +87,10 @@ class EbsdLib_EXPORT TetragonalOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -99,7 +99,7 @@ class EbsdLib_EXPORT TetragonalOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -111,7 +111,7 @@ class EbsdLib_EXPORT TetragonalOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -157,7 +157,7 @@ class EbsdLib_EXPORT TetragonalOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -170,15 +170,15 @@ class EbsdLib_EXPORT TetragonalOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TriclinicOps.cpp b/Source/EbsdLib/LaueOps/TriclinicOps.cpp index e85d8de..a423061 100644 --- a/Source/EbsdLib/LaueOps/TriclinicOps.cpp +++ b/Source/EbsdLib/LaueOps/TriclinicOps.cpp @@ -59,37 +59,37 @@ using namespace ebsdlib; namespace Triclinic { -constexpr std::array OdfNumBins = {72, 72, 72}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {72, 72, 72}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimInitValue = {std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiD)-std::sin((ebsdlib::constants::k_PiD)))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 2; -constexpr int symSize2 = 2; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 2; +constexpr int k_SymSize2 = 2; -constexpr int k_OdfSize = 373248; -constexpr int k_MdfSize = 373248; -constexpr int k_SymOpsCount = 1; +constexpr size_t k_OdfSize = 373248; +constexpr size_t k_MdfSize = 373248; +constexpr size_t k_SymOpsCount = 1; constexpr int k_NumMdfBins = 36; // Rotation Point Group: 1 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + }; /* clang-format on */ @@ -99,18 +99,12 @@ constexpr double k_ChiMax = 90.0; } // namespace Triclinic -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TriclinicOps::TriclinicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TriclinicOps::~TriclinicOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TriclinicOps::getHasInversion() const { @@ -118,9 +112,7 @@ bool TriclinicOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TriclinicOps::getODFSize() const +size_t TriclinicOps::getODFSize() const { return Triclinic::k_OdfSize; } @@ -128,13 +120,11 @@ int TriclinicOps::getODFSize() const // ----------------------------------------------------------------------------- std::array TriclinicOps::getNumSymmetry() const { - return {Triclinic::symSize0, Triclinic::symSize1, Triclinic::symSize2}; + return {Triclinic::k_SymSize0, Triclinic::k_SymSize1, Triclinic::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TriclinicOps::getMDFSize() const +size_t TriclinicOps::getMDFSize() const { return Triclinic::k_MdfSize; } @@ -146,9 +136,7 @@ int TriclinicOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TriclinicOps::getNumSymOps() const +size_t TriclinicOps::getNumSymOps() const { return Triclinic::k_SymOpsCount; } @@ -156,19 +144,15 @@ int TriclinicOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array TriclinicOps::getOdfNumBins() const { - return Triclinic::OdfNumBins; + return Triclinic::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TriclinicOps::getSymmetryName() const { return "Triclinic -1 (Ci)"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TriclinicOps::getRotationPointGroup() const { @@ -193,52 +177,45 @@ bool TriclinicOps::isInsideFZ(const RodriguesDType& rod) const return IsInsideFZ(rod, getFZType(), getAxisOrderingType()); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- AxisAngleDType TriclinicOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(Triclinic::QuatSym, q1, q2); + return calculateMisorientationInternal(Triclinic::k_QuatSym, q1, q2); } -QuatD TriclinicOps::getQuatSymOp(int32_t i) const +QuatD TriclinicOps::getQuatSymOp(size_t i) const { - return Triclinic::QuatSym[i]; + return Triclinic::k_QuatSym[i]; } -int32_t TriclinicOps::getNumRodriguesSymOps() const +size_t TriclinicOps::getNumRodriguesSymOps() const { - return Triclinic::RodSym.size(); + return Triclinic::k_RodSym.size(); } RodriguesDType TriclinicOps::getRodSymOp(size_t i) const { - return Triclinic::RodSym[i]; + return Triclinic::k_RodSym[i]; } -Matrix3X3D TriclinicOps::getMatSymOpD(int i) const +Matrix3X3D TriclinicOps::getMatSymOpD(size_t i) const { - return {Triclinic::MatSym[i][0][0], Triclinic::MatSym[i][0][1], Triclinic::MatSym[i][0][2], Triclinic::MatSym[i][1][0], Triclinic::MatSym[i][1][1], - Triclinic::MatSym[i][1][2], Triclinic::MatSym[i][2][0], Triclinic::MatSym[i][2][1], Triclinic::MatSym[i][2][2]}; + return Triclinic::k_MatSym[i]; } -Matrix3X3F TriclinicOps::getMatSymOpF(int i) const +Matrix3X3F TriclinicOps::getMatSymOpF(size_t i) const { - return {static_cast(Triclinic::MatSym[i][0][0]), static_cast(Triclinic::MatSym[i][0][1]), static_cast(Triclinic::MatSym[i][0][2]), - static_cast(Triclinic::MatSym[i][1][0]), static_cast(Triclinic::MatSym[i][1][1]), static_cast(Triclinic::MatSym[i][1][2]), - static_cast(Triclinic::MatSym[i][2][0]), static_cast(Triclinic::MatSym[i][2][1]), static_cast(Triclinic::MatSym[i][2][2])}; + return {static_cast(Triclinic::k_MatSym[i](0, 0)), static_cast(Triclinic::k_MatSym[i](0, 1)), static_cast(Triclinic::k_MatSym[i](0, 2)), + static_cast(Triclinic::k_MatSym[i](1, 0)), static_cast(Triclinic::k_MatSym[i](1, 1)), static_cast(Triclinic::k_MatSym[i](1, 2)), + static_cast(Triclinic::k_MatSym[i](2, 0)), static_cast(Triclinic::k_MatSym[i](2, 1)), static_cast(Triclinic::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TriclinicOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TriclinicOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -252,16 +229,14 @@ RodriguesDType TriclinicOps::getMDFFZRod(const RodriguesDType& inRod) const return ax.toRodrigues(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD TriclinicOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(Triclinic::QuatSym, q1, q2); + return _calcNearestQuat(Triclinic::k_QuatSym, q1, q2); } QuatF TriclinicOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(Triclinic::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(Triclinic::k_QuatSym, q1f.to(), q2f.to()).to(); } // ----------------------------------------------------------------------------- @@ -269,11 +244,9 @@ QuatD TriclinicOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(Triclinic::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(Triclinic::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TriclinicOps::getMisoBin(const RodriguesDType& rod) const { @@ -283,21 +256,19 @@ int TriclinicOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = Triclinic::OdfDimInitValue[0]; - dim[1] = Triclinic::OdfDimInitValue[1]; - dim[2] = Triclinic::OdfDimInitValue[2]; - step[0] = Triclinic::OdfDimStepValue[0]; - step[1] = Triclinic::OdfDimStepValue[1]; - step[2] = Triclinic::OdfDimStepValue[2]; - bins[0] = static_cast(Triclinic::OdfNumBins[0]); - bins[1] = static_cast(Triclinic::OdfNumBins[1]); - bins[2] = static_cast(Triclinic::OdfNumBins[2]); + dim[0] = Triclinic::k_OdfDimInitValue[0]; + dim[1] = Triclinic::k_OdfDimInitValue[1]; + dim[2] = Triclinic::k_OdfDimInitValue[2]; + step[0] = Triclinic::k_OdfDimStepValue[0]; + step[1] = Triclinic::k_OdfDimStepValue[1]; + step[2] = Triclinic::k_OdfDimStepValue[2]; + bins[0] = static_cast(Triclinic::k_OdfNumBins[0]); + bins[1] = static_cast(Triclinic::k_OdfNumBins[1]); + bins[2] = static_cast(Triclinic::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TriclinicOps::determineEulerAngles(double random[3], int choose) const { @@ -306,15 +277,15 @@ EulerDType TriclinicOps::determineEulerAngles(double random[3], int choose) cons int32_t phi[3]; double h1, h2, h3; - init[0] = Triclinic::OdfDimInitValue[0]; - init[1] = Triclinic::OdfDimInitValue[1]; - init[2] = Triclinic::OdfDimInitValue[2]; - step[0] = Triclinic::OdfDimStepValue[0]; - step[1] = Triclinic::OdfDimStepValue[1]; - step[2] = Triclinic::OdfDimStepValue[2]; - phi[0] = static_cast(choose % Triclinic::OdfNumBins[0]); - phi[1] = static_cast((choose / Triclinic::OdfNumBins[0]) % Triclinic::OdfNumBins[1]); - phi[2] = static_cast(choose / (Triclinic::OdfNumBins[0] * Triclinic::OdfNumBins[1])); + init[0] = Triclinic::k_OdfDimInitValue[0]; + init[1] = Triclinic::k_OdfDimInitValue[1]; + init[2] = Triclinic::k_OdfDimInitValue[2]; + step[0] = Triclinic::k_OdfDimStepValue[0]; + step[1] = Triclinic::k_OdfDimStepValue[1]; + step[2] = Triclinic::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % Triclinic::k_OdfNumBins[0]); + phi[1] = static_cast((choose / Triclinic::k_OdfNumBins[0]) % Triclinic::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (Triclinic::k_OdfNumBins[0] * Triclinic::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -324,19 +295,15 @@ EulerDType TriclinicOps::determineEulerAngles(double random[3], int choose) cons return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TriclinicOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(Triclinic::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = Triclinic::QuatSym[symOp] * quat; + QuatD qc = Triclinic::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TriclinicOps::determineRodriguesVector(double random[3], int choose) const { @@ -345,15 +312,15 @@ RodriguesDType TriclinicOps::determineRodriguesVector(double random[3], int choo int32_t phi[3]; double h1, h2, h3; - init[0] = Triclinic::OdfDimInitValue[0]; - init[1] = Triclinic::OdfDimInitValue[1]; - init[2] = Triclinic::OdfDimInitValue[2]; - step[0] = Triclinic::OdfDimStepValue[0]; - step[1] = Triclinic::OdfDimStepValue[1]; - step[2] = Triclinic::OdfDimStepValue[2]; - phi[0] = static_cast(choose % Triclinic::OdfNumBins[0]); - phi[1] = static_cast((choose / Triclinic::OdfNumBins[0]) % Triclinic::OdfNumBins[1]); - phi[2] = static_cast(choose / (Triclinic::OdfNumBins[0] * Triclinic::OdfNumBins[1])); + init[0] = Triclinic::k_OdfDimInitValue[0]; + init[1] = Triclinic::k_OdfDimInitValue[1]; + init[2] = Triclinic::k_OdfDimInitValue[2]; + step[0] = Triclinic::k_OdfDimStepValue[0]; + step[1] = Triclinic::k_OdfDimStepValue[1]; + step[2] = Triclinic::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % Triclinic::k_OdfNumBins[0]); + phi[1] = static_cast((choose / Triclinic::k_OdfNumBins[0]) % Triclinic::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (Triclinic::k_OdfNumBins[0] * Triclinic::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -361,8 +328,6 @@ RodriguesDType TriclinicOps::determineRodriguesVector(double random[3], int choo return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TriclinicOps::getOdfBin(const RodriguesDType& rod) const { @@ -372,15 +337,15 @@ int TriclinicOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = Triclinic::OdfDimInitValue[0]; - dim[1] = Triclinic::OdfDimInitValue[1]; - dim[2] = Triclinic::OdfDimInitValue[2]; - step[0] = Triclinic::OdfDimStepValue[0]; - step[1] = Triclinic::OdfDimStepValue[1]; - step[2] = Triclinic::OdfDimStepValue[2]; - bins[0] = static_cast(Triclinic::OdfNumBins[0]); - bins[1] = static_cast(Triclinic::OdfNumBins[1]); - bins[2] = static_cast(Triclinic::OdfNumBins[2]); + dim[0] = Triclinic::k_OdfDimInitValue[0]; + dim[1] = Triclinic::k_OdfDimInitValue[1]; + dim[2] = Triclinic::k_OdfDimInitValue[2]; + step[0] = Triclinic::k_OdfDimStepValue[0]; + step[1] = Triclinic::k_OdfDimStepValue[1]; + step[2] = Triclinic::k_OdfDimStepValue[2]; + bins[0] = static_cast(Triclinic::k_OdfNumBins[0]); + bins[1] = static_cast(Triclinic::k_OdfNumBins[1]); + bins[2] = static_cast(Triclinic::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -410,21 +375,21 @@ void TriclinicOps::getSchmidFactorAndSS(double load[3], double plane[3], double { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = Triclinic::MatSym[i][2][0] * plane[0] + Triclinic::MatSym[i][2][1] * plane[1] + Triclinic::MatSym[i][2][2] * plane[2]; + slipPlane[2] = Triclinic::k_MatSym[i](2, 0) * plane[0] + Triclinic::k_MatSym[i](2, 1) * plane[1] + Triclinic::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = Triclinic::MatSym[i][0][0] * plane[0] + Triclinic::MatSym[i][0][1] * plane[1] + Triclinic::MatSym[i][0][2] * plane[2]; - slipPlane[1] = Triclinic::MatSym[i][1][0] * plane[0] + Triclinic::MatSym[i][1][1] * plane[1] + Triclinic::MatSym[i][1][2] * plane[2]; + slipPlane[0] = Triclinic::k_MatSym[i](0, 0) * plane[0] + Triclinic::k_MatSym[i](0, 1) * plane[1] + Triclinic::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = Triclinic::k_MatSym[i](1, 0) * plane[0] + Triclinic::k_MatSym[i](1, 1) * plane[1] + Triclinic::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = Triclinic::MatSym[i][0][0] * direction[0] + Triclinic::MatSym[i][0][1] * direction[1] + Triclinic::MatSym[i][0][2] * direction[2]; - slipDirection[1] = Triclinic::MatSym[i][1][0] * direction[0] + Triclinic::MatSym[i][1][1] * direction[1] + Triclinic::MatSym[i][1][2] * direction[2]; - slipDirection[2] = Triclinic::MatSym[i][2][0] * direction[0] + Triclinic::MatSym[i][2][1] * direction[1] + Triclinic::MatSym[i][2][2] * direction[2]; + slipDirection[0] = Triclinic::k_MatSym[i](0, 0) * direction[0] + Triclinic::k_MatSym[i](0, 1) * direction[1] + Triclinic::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = Triclinic::k_MatSym[i](1, 0) * direction[0] + Triclinic::k_MatSym[i](1, 1) * direction[1] + Triclinic::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = Triclinic::k_MatSym[i](2, 0) * direction[0] + Triclinic::k_MatSym[i](2, 1) * direction[1] + Triclinic::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -458,8 +423,6 @@ double TriclinicOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool return 0.0; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace TriclinicHigh { @@ -533,25 +496,23 @@ class GenerateSphereCoordsImpl }; } // namespace TriclinicHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void TriclinicOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * Triclinic::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * Triclinic::k_SymSize0) { - xyz001->resizeTuples(nOrientations * Triclinic::symSize0 * 3); + xyz001->resizeTuples(nOrientations * Triclinic::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * Triclinic::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * Triclinic::k_SymSize1) { - xyz011->resizeTuples(nOrientations * Triclinic::symSize1 * 3); + xyz011->resizeTuples(nOrientations * Triclinic::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * Triclinic::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * Triclinic::k_SymSize2) { - xyz111->resizeTuples(nOrientations * Triclinic::symSize2 * 3); + xyz111->resizeTuples(nOrientations * Triclinic::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -574,8 +535,6 @@ std::array TriclinicOps::getIpfColorAngleLimits(double eta) const return {Triclinic::k_EtaMin * ebsdlib::constants::k_DegToRadD, Triclinic::k_EtaMax * ebsdlib::constants::k_DegToRadD, Triclinic::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TriclinicOps::inUnitTriangle(double eta, double chi) const { @@ -583,16 +542,12 @@ bool TriclinicOps::inUnitTriangle(double eta, double chi) const chi > (Triclinic::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TriclinicOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TriclinicOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -601,14 +556,12 @@ ebsdlib::Rgb TriclinicOps::generateIPFColor(double phi1, double phi, double phi2 return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TriclinicOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * Triclinic::OdfDimInitValue[0]; - double range2 = 2.0f * Triclinic::OdfDimInitValue[1]; - double range3 = 2.0f * Triclinic::OdfDimInitValue[2]; + double range1 = 2.0f * Triclinic::k_OdfDimInitValue[0]; + double range2 = 2.0f * Triclinic::k_OdfDimInitValue[1]; + double range3 = 2.0f * Triclinic::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -624,16 +577,12 @@ ebsdlib::Rgb TriclinicOps::generateRodriguesColor(double r1, double r2, double r return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array TriclinicOps::getDefaultPoleFigureNames() const { return {"<001>", "<100>", "<010>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector TriclinicOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -660,11 +609,11 @@ std::vector TriclinicOps::generatePoleFigure(P // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Triclinic::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Triclinic::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Triclinic::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Triclinic::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Triclinic::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * Triclinic::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -672,7 +621,7 @@ std::vector TriclinicOps::generatePoleFigure(P generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -864,10 +813,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float std::vector xAdj = {0.1F, 0.0F, -0.5F, -1.0F, -1.1F, -1.0F, -0.5F, 0.0F}; std::vector yAdj = {+0.25F, 0.0F, -0.2F, 0.0F, 0.25F, 0.75F, 1.1F, 1.0F}; std::vector drawAngle = {true, false, true, false, true, false, true, false}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -940,8 +889,6 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float } // namespace // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- ebsdlib::UInt8ArrayType::Pointer TriclinicOps::generateIPFTriangleLegend(int canvasDim, bool generateEntirePlane) const { // Figure out the Legend Pixel Size @@ -1034,13 +981,13 @@ TriclinicOps::Pointer TriclinicOps::NullPointer() // ----------------------------------------------------------------------------- std::string TriclinicOps::getNameOfClass() const { - return std::string("TriclinicOps"); + return {"TriclinicOps"}; } // ----------------------------------------------------------------------------- std::string TriclinicOps::ClassName() { - return std::string("TriclinicOps"); + return {"TriclinicOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TriclinicOps.h b/Source/EbsdLib/LaueOps/TriclinicOps.h index bf5c729..035758f 100644 --- a/Source/EbsdLib/LaueOps/TriclinicOps.h +++ b/Source/EbsdLib/LaueOps/TriclinicOps.h @@ -87,10 +87,10 @@ class EbsdLib_EXPORT TriclinicOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -99,7 +99,7 @@ class EbsdLib_EXPORT TriclinicOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -111,7 +111,7 @@ class EbsdLib_EXPORT TriclinicOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -157,7 +157,7 @@ class EbsdLib_EXPORT TriclinicOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -170,15 +170,15 @@ class EbsdLib_EXPORT TriclinicOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp index 9a77dfa..0d4f1a7 100644 --- a/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalLowOps.cpp @@ -58,52 +58,53 @@ using namespace ebsdlib; namespace TrigonalLow { -constexpr std::array OdfNumBins = {72, 72, 24}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {72, 72, 24}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), - std::pow((0.75 * ((ebsdlib::constants::k_PiD / 6.0) - std::sin(ebsdlib::constants::k_PiD / 6.0))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiD - std::sin(ebsdlib::constants::k_PiD))), (1.0 / 3.0)), + std::pow((0.75 * ((ebsdlib::constants::k_PiD / 6.0) - std::sin(ebsdlib::constants::k_PiD / 6.0))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 2; -constexpr int symSize2 = 2; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 2; +constexpr int k_SymSize2 = 2; -constexpr int k_OdfSize = 124416; -constexpr int k_MdfSize = 124416; -constexpr int k_SymOpsCount = 3; +constexpr size_t k_OdfSize = 124416; +constexpr size_t k_MdfSize = 124416; +constexpr size_t k_SymOpsCount = 3; constexpr int k_NumMdfBins = 12; static double sq32 = std::sqrt(3.0) / 2.0; +static const double sqrtThree = std::sqrt(3.0); // Rotation Point Group: 3 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(0.0, 0.0, sq32, 0.5), - QuatD(0.0, 0.0, sq32, -0.5), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(0.0, 0.0, sq32, 0.5), + QuatD(0.0, 0.0, sq32, -0.5), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0, 1.7320508075688767}, - {0.0, 0.0, sq32, 10000000000000.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0, sqrtThree}, + {0.0, 0.0, sq32, 10000000000000.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, -sq32, 0.0}, - {sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, sq32, 0.0}, - {-sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {-0.5, -sq32, 0.0, + sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + + {-0.5, sq32, 0.0, + -sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + }; /* clang-format on */ constexpr double k_EtaMin = -120.0; @@ -111,18 +112,12 @@ constexpr double k_EtaMax = 0.0; constexpr double k_ChiMax = 90.0; } // namespace TrigonalLow -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TrigonalLowOps::TrigonalLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TrigonalLowOps::~TrigonalLowOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TrigonalLowOps::getHasInversion() const { @@ -130,9 +125,7 @@ bool TrigonalLowOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TrigonalLowOps::getODFSize() const +size_t TrigonalLowOps::getODFSize() const { return TrigonalLow::k_OdfSize; } @@ -140,13 +133,11 @@ int TrigonalLowOps::getODFSize() const // ----------------------------------------------------------------------------- std::array TrigonalLowOps::getNumSymmetry() const { - return {TrigonalLow::symSize0, TrigonalLow::symSize1, TrigonalLow::symSize2}; + return {TrigonalLow::k_SymSize0, TrigonalLow::k_SymSize1, TrigonalLow::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TrigonalLowOps::getMDFSize() const +size_t TrigonalLowOps::getMDFSize() const { return TrigonalLow::k_MdfSize; } @@ -158,9 +149,7 @@ int TrigonalLowOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TrigonalLowOps::getNumSymOps() const +size_t TrigonalLowOps::getNumSymOps() const { return TrigonalLow::k_SymOpsCount; } @@ -168,19 +157,15 @@ int TrigonalLowOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array TrigonalLowOps::getOdfNumBins() const { - return TrigonalLow::OdfNumBins; + return TrigonalLow::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TrigonalLowOps::getSymmetryName() const { return "Trigonal -3 (C3i)"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TrigonalLowOps::getRotationPointGroup() const { @@ -207,47 +192,42 @@ bool TrigonalLowOps::isInsideFZ(const RodriguesDType& rod) const AxisAngleDType TrigonalLowOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(TrigonalLow::QuatSym, q1, q2); + return calculateMisorientationInternal(TrigonalLow::k_QuatSym, q1, q2); } -QuatD TrigonalLowOps::getQuatSymOp(int32_t i) const +QuatD TrigonalLowOps::getQuatSymOp(size_t i) const { - return TrigonalLow::QuatSym[i]; + return TrigonalLow::k_QuatSym[i]; } -int32_t TrigonalLowOps::getNumRodriguesSymOps() const +size_t TrigonalLowOps::getNumRodriguesSymOps() const { - return TrigonalLow::RodSym.size(); + return TrigonalLow::k_RodSym.size(); } RodriguesDType TrigonalLowOps::getRodSymOp(size_t i) const { - return TrigonalLow::RodSym[i]; + return TrigonalLow::k_RodSym[i]; } -Matrix3X3D TrigonalLowOps::getMatSymOpD(int i) const +Matrix3X3D TrigonalLowOps::getMatSymOpD(size_t i) const { - return {TrigonalLow::MatSym[i][0][0], TrigonalLow::MatSym[i][0][1], TrigonalLow::MatSym[i][0][2], TrigonalLow::MatSym[i][1][0], TrigonalLow::MatSym[i][1][1], - TrigonalLow::MatSym[i][1][2], TrigonalLow::MatSym[i][2][0], TrigonalLow::MatSym[i][2][1], TrigonalLow::MatSym[i][2][2]}; + return TrigonalLow::k_MatSym[i]; } -Matrix3X3F TrigonalLowOps::getMatSymOpF(int i) const +Matrix3X3F TrigonalLowOps::getMatSymOpF(size_t i) const { - return {static_cast(TrigonalLow::MatSym[i][0][0]), static_cast(TrigonalLow::MatSym[i][0][1]), static_cast(TrigonalLow::MatSym[i][0][2]), - static_cast(TrigonalLow::MatSym[i][1][0]), static_cast(TrigonalLow::MatSym[i][1][1]), static_cast(TrigonalLow::MatSym[i][1][2]), - static_cast(TrigonalLow::MatSym[i][2][0]), static_cast(TrigonalLow::MatSym[i][2][1]), static_cast(TrigonalLow::MatSym[i][2][2])}; + return {static_cast(TrigonalLow::k_MatSym[i](0, 0)), static_cast(TrigonalLow::k_MatSym[i](0, 1)), static_cast(TrigonalLow::k_MatSym[i](0, 2)), + static_cast(TrigonalLow::k_MatSym[i](1, 0)), static_cast(TrigonalLow::k_MatSym[i](1, 1)), static_cast(TrigonalLow::k_MatSym[i](1, 2)), + static_cast(TrigonalLow::k_MatSym[i](2, 0)), static_cast(TrigonalLow::k_MatSym[i](2, 1)), static_cast(TrigonalLow::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TrigonalLowOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TrigonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -296,16 +276,14 @@ RodriguesDType TrigonalLowOps::getMDFFZRod(const RodriguesDType& inRod) const return AxisAngleDType(FZn1, FZn2, FZn3, FZw).toRodrigues(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD TrigonalLowOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(TrigonalLow::QuatSym, q1, q2); + return _calcNearestQuat(TrigonalLow::k_QuatSym, q1, q2); } QuatF TrigonalLowOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(TrigonalLow::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(TrigonalLow::k_QuatSym, q1f.to(), q2f.to()).to(); } // ----------------------------------------------------------------------------- @@ -313,11 +291,9 @@ QuatD TrigonalLowOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(TrigonalLow::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(TrigonalLow::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TrigonalLowOps::getMisoBin(const RodriguesDType& rod) const { @@ -327,21 +303,19 @@ int TrigonalLowOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TrigonalLow::OdfDimInitValue[0]; - dim[1] = TrigonalLow::OdfDimInitValue[1]; - dim[2] = TrigonalLow::OdfDimInitValue[2]; - step[0] = TrigonalLow::OdfDimStepValue[0]; - step[1] = TrigonalLow::OdfDimStepValue[1]; - step[2] = TrigonalLow::OdfDimStepValue[2]; - bins[0] = static_cast(TrigonalLow::OdfNumBins[0]); - bins[1] = static_cast(TrigonalLow::OdfNumBins[1]); - bins[2] = static_cast(TrigonalLow::OdfNumBins[2]); + dim[0] = TrigonalLow::k_OdfDimInitValue[0]; + dim[1] = TrigonalLow::k_OdfDimInitValue[1]; + dim[2] = TrigonalLow::k_OdfDimInitValue[2]; + step[0] = TrigonalLow::k_OdfDimStepValue[0]; + step[1] = TrigonalLow::k_OdfDimStepValue[1]; + step[2] = TrigonalLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(TrigonalLow::k_OdfNumBins[0]); + bins[1] = static_cast(TrigonalLow::k_OdfNumBins[1]); + bins[2] = static_cast(TrigonalLow::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TrigonalLowOps::determineEulerAngles(double random[3], int choose) const { @@ -350,15 +324,15 @@ EulerDType TrigonalLowOps::determineEulerAngles(double random[3], int choose) co int32_t phi[3]; double h1, h2, h3; - init[0] = TrigonalLow::OdfDimInitValue[0]; - init[1] = TrigonalLow::OdfDimInitValue[1]; - init[2] = TrigonalLow::OdfDimInitValue[2]; - step[0] = TrigonalLow::OdfDimStepValue[0]; - step[1] = TrigonalLow::OdfDimStepValue[1]; - step[2] = TrigonalLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TrigonalLow::OdfNumBins[0]); - phi[1] = static_cast((choose / TrigonalLow::OdfNumBins[0]) % TrigonalLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (TrigonalLow::OdfNumBins[0] * TrigonalLow::OdfNumBins[1])); + init[0] = TrigonalLow::k_OdfDimInitValue[0]; + init[1] = TrigonalLow::k_OdfDimInitValue[1]; + init[2] = TrigonalLow::k_OdfDimInitValue[2]; + step[0] = TrigonalLow::k_OdfDimStepValue[0]; + step[1] = TrigonalLow::k_OdfDimStepValue[1]; + step[2] = TrigonalLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TrigonalLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TrigonalLow::k_OdfNumBins[0]) % TrigonalLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TrigonalLow::k_OdfNumBins[0] * TrigonalLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -368,19 +342,15 @@ EulerDType TrigonalLowOps::determineEulerAngles(double random[3], int choose) co return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TrigonalLowOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(TrigonalLow::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = TrigonalLow::QuatSym[symOp] * quat; + QuatD qc = TrigonalLow::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TrigonalLowOps::determineRodriguesVector(double random[3], int choose) const { @@ -389,15 +359,15 @@ RodriguesDType TrigonalLowOps::determineRodriguesVector(double random[3], int ch int32_t phi[3]; double h1, h2, h3; - init[0] = TrigonalLow::OdfDimInitValue[0]; - init[1] = TrigonalLow::OdfDimInitValue[1]; - init[2] = TrigonalLow::OdfDimInitValue[2]; - step[0] = TrigonalLow::OdfDimStepValue[0]; - step[1] = TrigonalLow::OdfDimStepValue[1]; - step[2] = TrigonalLow::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TrigonalLow::OdfNumBins[0]); - phi[1] = static_cast((choose / TrigonalLow::OdfNumBins[0]) % TrigonalLow::OdfNumBins[1]); - phi[2] = static_cast(choose / (TrigonalLow::OdfNumBins[0] * TrigonalLow::OdfNumBins[1])); + init[0] = TrigonalLow::k_OdfDimInitValue[0]; + init[1] = TrigonalLow::k_OdfDimInitValue[1]; + init[2] = TrigonalLow::k_OdfDimInitValue[2]; + step[0] = TrigonalLow::k_OdfDimStepValue[0]; + step[1] = TrigonalLow::k_OdfDimStepValue[1]; + step[2] = TrigonalLow::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TrigonalLow::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TrigonalLow::k_OdfNumBins[0]) % TrigonalLow::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TrigonalLow::k_OdfNumBins[0] * TrigonalLow::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -405,8 +375,6 @@ RodriguesDType TrigonalLowOps::determineRodriguesVector(double random[3], int ch return ro; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TrigonalLowOps::getOdfBin(const RodriguesDType& rod) const { @@ -416,15 +384,15 @@ int TrigonalLowOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TrigonalLow::OdfDimInitValue[0]; - dim[1] = TrigonalLow::OdfDimInitValue[1]; - dim[2] = TrigonalLow::OdfDimInitValue[2]; - step[0] = TrigonalLow::OdfDimStepValue[0]; - step[1] = TrigonalLow::OdfDimStepValue[1]; - step[2] = TrigonalLow::OdfDimStepValue[2]; - bins[0] = static_cast(TrigonalLow::OdfNumBins[0]); - bins[1] = static_cast(TrigonalLow::OdfNumBins[1]); - bins[2] = static_cast(TrigonalLow::OdfNumBins[2]); + dim[0] = TrigonalLow::k_OdfDimInitValue[0]; + dim[1] = TrigonalLow::k_OdfDimInitValue[1]; + dim[2] = TrigonalLow::k_OdfDimInitValue[2]; + step[0] = TrigonalLow::k_OdfDimStepValue[0]; + step[1] = TrigonalLow::k_OdfDimStepValue[1]; + step[2] = TrigonalLow::k_OdfDimStepValue[2]; + bins[0] = static_cast(TrigonalLow::k_OdfNumBins[0]); + bins[1] = static_cast(TrigonalLow::k_OdfNumBins[1]); + bins[2] = static_cast(TrigonalLow::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -454,21 +422,21 @@ void TrigonalLowOps::getSchmidFactorAndSS(double load[3], double plane[3], doubl { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = TrigonalLow::MatSym[i][2][0] * plane[0] + TrigonalLow::MatSym[i][2][1] * plane[1] + TrigonalLow::MatSym[i][2][2] * plane[2]; + slipPlane[2] = TrigonalLow::k_MatSym[i](2, 0) * plane[0] + TrigonalLow::k_MatSym[i](2, 1) * plane[1] + TrigonalLow::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = TrigonalLow::MatSym[i][0][0] * plane[0] + TrigonalLow::MatSym[i][0][1] * plane[1] + TrigonalLow::MatSym[i][0][2] * plane[2]; - slipPlane[1] = TrigonalLow::MatSym[i][1][0] * plane[0] + TrigonalLow::MatSym[i][1][1] * plane[1] + TrigonalLow::MatSym[i][1][2] * plane[2]; + slipPlane[0] = TrigonalLow::k_MatSym[i](0, 0) * plane[0] + TrigonalLow::k_MatSym[i](0, 1) * plane[1] + TrigonalLow::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = TrigonalLow::k_MatSym[i](1, 0) * plane[0] + TrigonalLow::k_MatSym[i](1, 1) * plane[1] + TrigonalLow::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = TrigonalLow::MatSym[i][0][0] * direction[0] + TrigonalLow::MatSym[i][0][1] * direction[1] + TrigonalLow::MatSym[i][0][2] * direction[2]; - slipDirection[1] = TrigonalLow::MatSym[i][1][0] * direction[0] + TrigonalLow::MatSym[i][1][1] * direction[1] + TrigonalLow::MatSym[i][1][2] * direction[2]; - slipDirection[2] = TrigonalLow::MatSym[i][2][0] * direction[0] + TrigonalLow::MatSym[i][2][1] * direction[1] + TrigonalLow::MatSym[i][2][2] * direction[2]; + slipDirection[0] = TrigonalLow::k_MatSym[i](0, 0) * direction[0] + TrigonalLow::k_MatSym[i](0, 1) * direction[1] + TrigonalLow::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = TrigonalLow::k_MatSym[i](1, 0) * direction[0] + TrigonalLow::k_MatSym[i](1, 1) * direction[1] + TrigonalLow::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = TrigonalLow::k_MatSym[i](2, 0) * direction[0] + TrigonalLow::k_MatSym[i](2, 1) * direction[1] + TrigonalLow::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -502,8 +470,6 @@ double TrigonalLowOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], boo return 0.0; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace TrigonalLow { @@ -577,25 +543,23 @@ class GenerateSphereCoordsImpl }; } // namespace TrigonalLow -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void TrigonalLowOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * TrigonalLow::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * TrigonalLow::k_SymSize0) { - xyz001->resizeTuples(nOrientations * TrigonalLow::symSize0 * 3); + xyz001->resizeTuples(nOrientations * TrigonalLow::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * TrigonalLow::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * TrigonalLow::k_SymSize1) { - xyz011->resizeTuples(nOrientations * TrigonalLow::symSize1 * 3); + xyz011->resizeTuples(nOrientations * TrigonalLow::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * TrigonalLow::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * TrigonalLow::k_SymSize2) { - xyz111->resizeTuples(nOrientations * TrigonalLow::symSize2 * 3); + xyz111->resizeTuples(nOrientations * TrigonalLow::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -618,8 +582,6 @@ std::array TrigonalLowOps::getIpfColorAngleLimits(double eta) const return {TrigonalLow::k_EtaMin * ebsdlib::constants::k_DegToRadD, TrigonalLow::k_EtaMax * ebsdlib::constants::k_DegToRadD, TrigonalLow::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TrigonalLowOps::inUnitTriangle(double eta, double chi) const { @@ -627,16 +589,12 @@ bool TrigonalLowOps::inUnitTriangle(double eta, double chi) const chi > (TrigonalLow::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TrigonalLowOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TrigonalLowOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -645,14 +603,12 @@ ebsdlib::Rgb TrigonalLowOps::generateIPFColor(double phi1, double phi, double ph return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TrigonalLowOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * TrigonalLow::OdfDimInitValue[0]; - double range2 = 2.0f * TrigonalLow::OdfDimInitValue[1]; - double range3 = 2.0f * TrigonalLow::OdfDimInitValue[2]; + double range1 = 2.0f * TrigonalLow::k_OdfDimInitValue[0]; + double range2 = 2.0f * TrigonalLow::k_OdfDimInitValue[1]; + double range3 = 2.0f * TrigonalLow::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -668,16 +624,12 @@ ebsdlib::Rgb TrigonalLowOps::generateRodriguesColor(double r1, double r2, double return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array TrigonalLowOps::getDefaultPoleFigureNames() const { return {"<0001>", "<-1-120>", "<2-1-10>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector TrigonalLowOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -704,11 +656,11 @@ std::vector TrigonalLowOps::generatePoleFigure // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalLow::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalLow::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalLow::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalLow::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalLow::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalLow::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -716,7 +668,7 @@ std::vector TrigonalLowOps::generatePoleFigure generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -924,10 +876,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float +0.25F, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.25F, 0.5F, 1.0F, 1.1F, 1.0F, 1.0F, }; std::vector drawAngle = {true, false, false, false, false, false, false, false, true, true, true, true}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_PiOver180F; float x = radius * (cos(rads)); @@ -1082,13 +1034,13 @@ TrigonalLowOps::Pointer TrigonalLowOps::NullPointer() // ----------------------------------------------------------------------------- std::string TrigonalLowOps::getNameOfClass() const { - return std::string("TrigonalLowOps"); + return {"TrigonalLowOps"}; } // ----------------------------------------------------------------------------- std::string TrigonalLowOps::ClassName() { - return std::string("TrigonalLowOps"); + return {"TrigonalLowOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TrigonalLowOps.h b/Source/EbsdLib/LaueOps/TrigonalLowOps.h index 1d3bb8e..17ca764 100644 --- a/Source/EbsdLib/LaueOps/TrigonalLowOps.h +++ b/Source/EbsdLib/LaueOps/TrigonalLowOps.h @@ -88,10 +88,10 @@ class EbsdLib_EXPORT TrigonalLowOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -100,7 +100,7 @@ class EbsdLib_EXPORT TrigonalLowOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -112,7 +112,7 @@ class EbsdLib_EXPORT TrigonalLowOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -158,7 +158,7 @@ class EbsdLib_EXPORT TrigonalLowOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -171,15 +171,15 @@ class EbsdLib_EXPORT TrigonalLowOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/LaueOps/TrigonalOps.cpp b/Source/EbsdLib/LaueOps/TrigonalOps.cpp index 1d6ba77..26ffc94 100644 --- a/Source/EbsdLib/LaueOps/TrigonalOps.cpp +++ b/Source/EbsdLib/LaueOps/TrigonalOps.cpp @@ -57,69 +57,71 @@ using namespace ebsdlib; namespace TrigonalHigh { -constexpr std::array OdfNumBins = {36, 36, 24}; // Represents a 5Deg bin +constexpr std::array k_OdfNumBins = {36, 36, 24}; // Represents a 5Deg bin -static const std::array OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), - std::pow((0.75 * (ebsdlib::constants::k_PiOver3D - std::sin(ebsdlib::constants::k_PiOver3D))), (1.0 / 3.0))}; -static const std::array OdfDimStepValue = {OdfDimInitValue[0] / static_cast(OdfNumBins[0] / 2), OdfDimInitValue[1] / static_cast(OdfNumBins[1] / 2), - OdfDimInitValue[2] / static_cast(OdfNumBins[2] / 2)}; +static const std::array k_OdfDimInitValue = {std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiOver2D - std::sin(ebsdlib::constants::k_PiOver2D))), (1.0 / 3.0)), + std::pow((0.75 * (ebsdlib::constants::k_PiOver3D - std::sin(ebsdlib::constants::k_PiOver3D))), (1.0 / 3.0))}; +static const std::array k_OdfDimStepValue = {k_OdfDimInitValue[0] / static_cast(k_OdfNumBins[0] / 2), k_OdfDimInitValue[1] / static_cast(k_OdfNumBins[1] / 2), + k_OdfDimInitValue[2] / static_cast(k_OdfNumBins[2] / 2)}; -constexpr int symSize0 = 2; -constexpr int symSize1 = 2; -constexpr int symSize2 = 2; +constexpr int k_SymSize0 = 2; +constexpr int k_SymSize1 = 2; +constexpr int k_SymSize2 = 2; -constexpr int k_OdfSize = 31104; -constexpr int k_MdfSize = 31104; -constexpr int k_SymOpsCount = 6; +constexpr size_t k_OdfSize = 31104; +constexpr size_t k_MdfSize = 31104; +constexpr size_t k_SymOpsCount = 6; constexpr int k_NumMdfBins = 12; static double sq32 = std::sqrt(3.0) / 2.0; +static const double sqrtThree = std::sqrt(3.0); + // Rotation Point Group: 32 /* clang-format off */ -static const std::vector QuatSym ={ - QuatD(0.0, 0.0, 0.0, 1.0), - QuatD(0.0, 0.0, sq32, 0.5), - QuatD(0.0, 0.0, sq32, -0.5), - QuatD(1.0, 0.0, 0.0, 0.0), - QuatD(0.5, sq32, 0.0, 0.0), - QuatD(-0.5, sq32, 0.0, 0.0), +static const std::vector k_QuatSym ={ + QuatD(0.0, 0.0, 0.0, 1.0), + QuatD(0.0, 0.0, sq32, 0.5), + QuatD(0.0, 0.0, sq32, -0.5), + QuatD(1.0, 0.0, 0.0, 0.0), + QuatD(0.5, sq32, 0.0, 0.0), + QuatD(-0.5, sq32, 0.0, 0.0), }; -static const std::vector RodSym = { - {0.0, 0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0, 1.7320508075688767}, - {0.0, 0.0, sq32, 10000000000000.0}, - {1.0, 0.0, 0.0, 10000000000000.0}, - {0.5, sq32, 0.0, 10000000000000.0}, - {-0.5, sq32, 0.0, 10000000000000.0}, +static const std::vector k_RodSym = { + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0, sqrtThree}, + {0.0, 0.0, sq32, 10000000000000.0}, + {1.0, 0.0, 0.0, 10000000000000.0}, + {0.5, sq32, 0.0, 10000000000000.0}, + {-0.5, sq32, 0.0, 10000000000000.0}, }; -static const double MatSym[k_SymOpsCount][3][3] = { - {{1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, -sq32, 0.0}, - {sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{-0.5, sq32, 0.0}, - {-sq32, -0.5, 0.0}, - {0.0, 0.0, 1.0}}, - - {{1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-0.5, sq32, 0.0}, - {sq32, 0.5, 0.0}, - {0.0, 0.0, -1.0}}, - - {{-0.5, -sq32, 0.0}, - {-sq32, 0.5, 0.0}, - {-0.0, 0.0, -1.0}}, - +static const std::vector k_MatSym = { + {1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0}, + + {-0.5, -sq32, 0.0, + sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + + {-0.5, sq32, 0.0, + -sq32, -0.5, 0.0, + 0.0, 0.0, 1.0}, + + {1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0}, + + {-0.5, sq32, 0.0, + sq32, 0.5, 0.0, + 0.0, 0.0, -1.0}, + + {-0.5, -sq32, 0.0, + -sq32, 0.5, 0.0, + -0.0, 0.0, -1.0}, + }; /* clang-format on */ constexpr double k_EtaMin = -90.0; @@ -127,18 +129,12 @@ constexpr double k_EtaMax = -30.0; constexpr double k_ChiMax = 90.0; } // namespace TrigonalHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TrigonalOps::TrigonalOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TrigonalOps::~TrigonalOps() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TrigonalOps::getHasInversion() const { @@ -146,9 +142,7 @@ bool TrigonalOps::getHasInversion() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TrigonalOps::getODFSize() const +size_t TrigonalOps::getODFSize() const { return TrigonalHigh::k_OdfSize; } @@ -156,13 +150,11 @@ int TrigonalOps::getODFSize() const // ----------------------------------------------------------------------------- std::array TrigonalOps::getNumSymmetry() const { - return {TrigonalHigh::symSize0, TrigonalHigh::symSize1, TrigonalHigh::symSize2}; + return {TrigonalHigh::k_SymSize0, TrigonalHigh::k_SymSize1, TrigonalHigh::k_SymSize2}; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TrigonalOps::getMDFSize() const +size_t TrigonalOps::getMDFSize() const { return TrigonalHigh::k_MdfSize; } @@ -174,9 +166,7 @@ int TrigonalOps::getMdfPlotBins() const } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -int TrigonalOps::getNumSymOps() const +size_t TrigonalOps::getNumSymOps() const { return TrigonalHigh::k_SymOpsCount; } @@ -184,19 +174,15 @@ int TrigonalOps::getNumSymOps() const // ----------------------------------------------------------------------------- std::array TrigonalOps::getOdfNumBins() const { - return TrigonalHigh::OdfNumBins; + return TrigonalHigh::k_OdfNumBins; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string TrigonalOps::getSymmetryName() const { return "Trigonal -3m (D3d)"; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- std::string TrigonalOps::getRotationPointGroup() const { return "32"; @@ -222,48 +208,43 @@ bool TrigonalOps::isInsideFZ(const RodriguesDType& rod) const AxisAngleDType TrigonalOps::calculateMisorientation(const QuatD& q1, const QuatD& q2) const { - return calculateMisorientationInternal(TrigonalHigh::QuatSym, q1, q2); + return calculateMisorientationInternal(TrigonalHigh::k_QuatSym, q1, q2); } // ----------------------------------------------------------------------------- -QuatD TrigonalOps::getQuatSymOp(int32_t i) const +QuatD TrigonalOps::getQuatSymOp(size_t i) const { - return TrigonalHigh::QuatSym[i]; + return TrigonalHigh::k_QuatSym[i]; } -int32_t TrigonalOps::getNumRodriguesSymOps() const +size_t TrigonalOps::getNumRodriguesSymOps() const { - return TrigonalHigh::RodSym.size(); + return TrigonalHigh::k_RodSym.size(); } RodriguesDType TrigonalOps::getRodSymOp(size_t i) const { - return TrigonalHigh::RodSym[i]; + return TrigonalHigh::k_RodSym[i]; } -Matrix3X3D TrigonalOps::getMatSymOpD(int i) const +Matrix3X3D TrigonalOps::getMatSymOpD(size_t i) const { - return {TrigonalHigh::MatSym[i][0][0], TrigonalHigh::MatSym[i][0][1], TrigonalHigh::MatSym[i][0][2], TrigonalHigh::MatSym[i][1][0], TrigonalHigh::MatSym[i][1][1], - TrigonalHigh::MatSym[i][1][2], TrigonalHigh::MatSym[i][2][0], TrigonalHigh::MatSym[i][2][1], TrigonalHigh::MatSym[i][2][2]}; + return TrigonalHigh::k_MatSym[i]; } -Matrix3X3F TrigonalOps::getMatSymOpF(int i) const +Matrix3X3F TrigonalOps::getMatSymOpF(size_t i) const { - return {static_cast(TrigonalHigh::MatSym[i][0][0]), static_cast(TrigonalHigh::MatSym[i][0][1]), static_cast(TrigonalHigh::MatSym[i][0][2]), - static_cast(TrigonalHigh::MatSym[i][1][0]), static_cast(TrigonalHigh::MatSym[i][1][1]), static_cast(TrigonalHigh::MatSym[i][1][2]), - static_cast(TrigonalHigh::MatSym[i][2][0]), static_cast(TrigonalHigh::MatSym[i][2][1]), static_cast(TrigonalHigh::MatSym[i][2][2])}; + return {static_cast(TrigonalHigh::k_MatSym[i](0, 0)), static_cast(TrigonalHigh::k_MatSym[i](0, 1)), static_cast(TrigonalHigh::k_MatSym[i](0, 2)), + static_cast(TrigonalHigh::k_MatSym[i](1, 0)), static_cast(TrigonalHigh::k_MatSym[i](1, 1)), static_cast(TrigonalHigh::k_MatSym[i](1, 2)), + static_cast(TrigonalHigh::k_MatSym[i](2, 0)), static_cast(TrigonalHigh::k_MatSym[i](2, 1)), static_cast(TrigonalHigh::k_MatSym[i](2, 2))}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TrigonalOps::getODFFZRod(const RodriguesDType& rod) const { return _calcRodNearestOrigin(rod); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TrigonalOps::getMDFFZRod(const RodriguesDType& inRod) const { @@ -317,16 +298,14 @@ RodriguesDType TrigonalOps::getMDFFZRod(const RodriguesDType& inRod) const return AxisAngleDType(FZn1, FZn2, FZn3, FZw).toRodrigues(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- QuatD TrigonalOps::getNearestQuat(const QuatD& q1, const QuatD& q2) const { - return _calcNearestQuat(TrigonalHigh::QuatSym, q1, q2); + return _calcNearestQuat(TrigonalHigh::k_QuatSym, q1, q2); } QuatF TrigonalOps::getNearestQuat(const QuatF& q1f, const QuatF& q2f) const { - return _calcNearestQuat(TrigonalHigh::QuatSym, q1f.to(), q2f.to()).to(); + return _calcNearestQuat(TrigonalHigh::k_QuatSym, q1f.to(), q2f.to()).to(); } // ----------------------------------------------------------------------------- @@ -334,11 +313,9 @@ QuatD TrigonalOps::getFZQuat(const QuatD& qr) const { LaueOps::FZType fzType = laue_ops::FZtarray[getPointGroup() - 1]; LaueOps::AxisOrderingType orderingType = laue_ops::FZoarray[getPointGroup() - 1]; - return ConvertToFZ(TrigonalHigh::QuatSym, qr, fzType, orderingType); + return ConvertToFZ(TrigonalHigh::k_QuatSym, qr, fzType, orderingType); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int TrigonalOps::getMisoBin(const RodriguesDType& rod) const { @@ -348,21 +325,19 @@ int TrigonalOps::getMisoBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TrigonalHigh::OdfDimInitValue[0]; - dim[1] = TrigonalHigh::OdfDimInitValue[1]; - dim[2] = TrigonalHigh::OdfDimInitValue[2]; - step[0] = TrigonalHigh::OdfDimStepValue[0]; - step[1] = TrigonalHigh::OdfDimStepValue[1]; - step[2] = TrigonalHigh::OdfDimStepValue[2]; - bins[0] = static_cast(TrigonalHigh::OdfNumBins[0]); - bins[1] = static_cast(TrigonalHigh::OdfNumBins[1]); - bins[2] = static_cast(TrigonalHigh::OdfNumBins[2]); + dim[0] = TrigonalHigh::k_OdfDimInitValue[0]; + dim[1] = TrigonalHigh::k_OdfDimInitValue[1]; + dim[2] = TrigonalHigh::k_OdfDimInitValue[2]; + step[0] = TrigonalHigh::k_OdfDimStepValue[0]; + step[1] = TrigonalHigh::k_OdfDimStepValue[1]; + step[2] = TrigonalHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(TrigonalHigh::k_OdfNumBins[0]); + bins[1] = static_cast(TrigonalHigh::k_OdfNumBins[1]); + bins[2] = static_cast(TrigonalHigh::k_OdfNumBins[2]); return _calcMisoBin(dim, bins, step, ho); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TrigonalOps::determineEulerAngles(double random[3], int choose) const { @@ -371,15 +346,15 @@ EulerDType TrigonalOps::determineEulerAngles(double random[3], int choose) const int32_t phi[3]; double h1, h2, h3; - init[0] = TrigonalHigh::OdfDimInitValue[0]; - init[1] = TrigonalHigh::OdfDimInitValue[1]; - init[2] = TrigonalHigh::OdfDimInitValue[2]; - step[0] = TrigonalHigh::OdfDimStepValue[0]; - step[1] = TrigonalHigh::OdfDimStepValue[1]; - step[2] = TrigonalHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TrigonalHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / TrigonalHigh::OdfNumBins[0]) % TrigonalHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (TrigonalHigh::OdfNumBins[0] * TrigonalHigh::OdfNumBins[1])); + init[0] = TrigonalHigh::k_OdfDimInitValue[0]; + init[1] = TrigonalHigh::k_OdfDimInitValue[1]; + init[2] = TrigonalHigh::k_OdfDimInitValue[2]; + step[0] = TrigonalHigh::k_OdfDimStepValue[0]; + step[1] = TrigonalHigh::k_OdfDimStepValue[1]; + step[2] = TrigonalHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TrigonalHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TrigonalHigh::k_OdfNumBins[0]) % TrigonalHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TrigonalHigh::k_OdfNumBins[0] * TrigonalHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); @@ -389,19 +364,15 @@ EulerDType TrigonalOps::determineEulerAngles(double random[3], int choose) const return eu; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EulerDType TrigonalOps::randomizeEulerAngles(const EulerDType& synea) const { size_t symOp = getRandomSymmetryOperatorIndex(TrigonalHigh::k_SymOpsCount); QuatD quat = synea.toQuaternion(); - QuatD qc = TrigonalHigh::QuatSym[symOp] * quat; + QuatD qc = TrigonalHigh::k_QuatSym[symOp] * quat; return QuaternionDType(qc).toEuler(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- RodriguesDType TrigonalOps::determineRodriguesVector(double random[3], int choose) const { @@ -410,15 +381,15 @@ RodriguesDType TrigonalOps::determineRodriguesVector(double random[3], int choos int32_t phi[3]; double h1, h2, h3; - init[0] = TrigonalHigh::OdfDimInitValue[0]; - init[1] = TrigonalHigh::OdfDimInitValue[1]; - init[2] = TrigonalHigh::OdfDimInitValue[2]; - step[0] = TrigonalHigh::OdfDimStepValue[0]; - step[1] = TrigonalHigh::OdfDimStepValue[1]; - step[2] = TrigonalHigh::OdfDimStepValue[2]; - phi[0] = static_cast(choose % TrigonalHigh::OdfNumBins[0]); - phi[1] = static_cast((choose / TrigonalHigh::OdfNumBins[0]) % TrigonalHigh::OdfNumBins[1]); - phi[2] = static_cast(choose / (TrigonalHigh::OdfNumBins[0] * TrigonalHigh::OdfNumBins[1])); + init[0] = TrigonalHigh::k_OdfDimInitValue[0]; + init[1] = TrigonalHigh::k_OdfDimInitValue[1]; + init[2] = TrigonalHigh::k_OdfDimInitValue[2]; + step[0] = TrigonalHigh::k_OdfDimStepValue[0]; + step[1] = TrigonalHigh::k_OdfDimStepValue[1]; + step[2] = TrigonalHigh::k_OdfDimStepValue[2]; + phi[0] = static_cast(choose % TrigonalHigh::k_OdfNumBins[0]); + phi[1] = static_cast((choose / TrigonalHigh::k_OdfNumBins[0]) % TrigonalHigh::k_OdfNumBins[1]); + phi[2] = static_cast(choose / (TrigonalHigh::k_OdfNumBins[0] * TrigonalHigh::k_OdfNumBins[1])); _calcDetermineHomochoricValues(random, init, step, phi, h1, h2, h3); RodriguesDType ro = HomochoricDType(h1, h2, h3).toRodrigues(); @@ -434,15 +405,15 @@ int TrigonalOps::getOdfBin(const RodriguesDType& rod) const HomochoricDType ho = rod.toHomochoric(); - dim[0] = TrigonalHigh::OdfDimInitValue[0]; - dim[1] = TrigonalHigh::OdfDimInitValue[1]; - dim[2] = TrigonalHigh::OdfDimInitValue[2]; - step[0] = TrigonalHigh::OdfDimStepValue[0]; - step[1] = TrigonalHigh::OdfDimStepValue[1]; - step[2] = TrigonalHigh::OdfDimStepValue[2]; - bins[0] = static_cast(TrigonalHigh::OdfNumBins[0]); - bins[1] = static_cast(TrigonalHigh::OdfNumBins[1]); - bins[2] = static_cast(TrigonalHigh::OdfNumBins[2]); + dim[0] = TrigonalHigh::k_OdfDimInitValue[0]; + dim[1] = TrigonalHigh::k_OdfDimInitValue[1]; + dim[2] = TrigonalHigh::k_OdfDimInitValue[2]; + step[0] = TrigonalHigh::k_OdfDimStepValue[0]; + step[1] = TrigonalHigh::k_OdfDimStepValue[1]; + step[2] = TrigonalHigh::k_OdfDimStepValue[2]; + bins[0] = static_cast(TrigonalHigh::k_OdfNumBins[0]); + bins[1] = static_cast(TrigonalHigh::k_OdfNumBins[1]); + bins[2] = static_cast(TrigonalHigh::k_OdfNumBins[2]); return _calcODFBin(dim, bins, step, ho); } @@ -472,21 +443,21 @@ void TrigonalOps::getSchmidFactorAndSS(double load[3], double plane[3], double d { // compute slip system double slipPlane[3] = {0}; - slipPlane[2] = TrigonalHigh::MatSym[i][2][0] * plane[0] + TrigonalHigh::MatSym[i][2][1] * plane[1] + TrigonalHigh::MatSym[i][2][2] * plane[2]; + slipPlane[2] = TrigonalHigh::k_MatSym[i](2, 0) * plane[0] + TrigonalHigh::k_MatSym[i](2, 1) * plane[1] + TrigonalHigh::k_MatSym[i](2, 2) * plane[2]; // dont consider negative z planes (to avoid duplicates) if(slipPlane[2] >= 0) { - slipPlane[0] = TrigonalHigh::MatSym[i][0][0] * plane[0] + TrigonalHigh::MatSym[i][0][1] * plane[1] + TrigonalHigh::MatSym[i][0][2] * plane[2]; - slipPlane[1] = TrigonalHigh::MatSym[i][1][0] * plane[0] + TrigonalHigh::MatSym[i][1][1] * plane[1] + TrigonalHigh::MatSym[i][1][2] * plane[2]; + slipPlane[0] = TrigonalHigh::k_MatSym[i](0, 0) * plane[0] + TrigonalHigh::k_MatSym[i](0, 1) * plane[1] + TrigonalHigh::k_MatSym[i](0, 2) * plane[2]; + slipPlane[1] = TrigonalHigh::k_MatSym[i](1, 0) * plane[0] + TrigonalHigh::k_MatSym[i](1, 1) * plane[1] + TrigonalHigh::k_MatSym[i](1, 2) * plane[2]; double slipDirection[3] = {0}; - slipDirection[0] = TrigonalHigh::MatSym[i][0][0] * direction[0] + TrigonalHigh::MatSym[i][0][1] * direction[1] + TrigonalHigh::MatSym[i][0][2] * direction[2]; - slipDirection[1] = TrigonalHigh::MatSym[i][1][0] * direction[0] + TrigonalHigh::MatSym[i][1][1] * direction[1] + TrigonalHigh::MatSym[i][1][2] * direction[2]; - slipDirection[2] = TrigonalHigh::MatSym[i][2][0] * direction[0] + TrigonalHigh::MatSym[i][2][1] * direction[1] + TrigonalHigh::MatSym[i][2][2] * direction[2]; + slipDirection[0] = TrigonalHigh::k_MatSym[i](0, 0) * direction[0] + TrigonalHigh::k_MatSym[i](0, 1) * direction[1] + TrigonalHigh::k_MatSym[i](0, 2) * direction[2]; + slipDirection[1] = TrigonalHigh::k_MatSym[i](1, 0) * direction[0] + TrigonalHigh::k_MatSym[i](1, 1) * direction[1] + TrigonalHigh::k_MatSym[i](1, 2) * direction[2]; + slipDirection[2] = TrigonalHigh::k_MatSym[i](2, 0) * direction[0] + TrigonalHigh::k_MatSym[i](2, 1) * direction[1] + TrigonalHigh::k_MatSym[i](2, 2) * direction[2]; - double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; - double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; + const double cosPhi = fabs(load[0] * slipPlane[0] + load[1] * slipPlane[1] + load[2] * slipPlane[2]) / planeMag; + const double cosLambda = fabs(load[0] * slipDirection[0] + load[1] * slipDirection[1] + load[2] * slipDirection[2]) / directionMag; double schmid = cosPhi * cosLambda; if(schmid > schmidfactor) @@ -520,8 +491,6 @@ double TrigonalOps::getF7(const QuatD& q1, const QuatD& q2, double LD[3], bool m return 0.0; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- namespace TrigonalHigh { @@ -595,25 +564,23 @@ class GenerateSphereCoordsImpl }; } // namespace TrigonalHigh -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void TrigonalOps::generateSphereCoordsFromEulers(ebsdlib::FloatArrayType* eulers, ebsdlib::FloatArrayType* xyz001, ebsdlib::FloatArrayType* xyz011, ebsdlib::FloatArrayType* xyz111) const { size_t nOrientations = eulers->getNumberOfTuples(); // Sanity Check the size of the arrays - if(xyz001->getNumberOfTuples() < nOrientations * TrigonalHigh::symSize0) + if(xyz001->getNumberOfTuples() < nOrientations * TrigonalHigh::k_SymSize0) { - xyz001->resizeTuples(nOrientations * TrigonalHigh::symSize0 * 3); + xyz001->resizeTuples(nOrientations * TrigonalHigh::k_SymSize0 * 3); } - if(xyz011->getNumberOfTuples() < nOrientations * TrigonalHigh::symSize1) + if(xyz011->getNumberOfTuples() < nOrientations * TrigonalHigh::k_SymSize1) { - xyz011->resizeTuples(nOrientations * TrigonalHigh::symSize1 * 3); + xyz011->resizeTuples(nOrientations * TrigonalHigh::k_SymSize1 * 3); } - if(xyz111->getNumberOfTuples() < nOrientations * TrigonalHigh::symSize2) + if(xyz111->getNumberOfTuples() < nOrientations * TrigonalHigh::k_SymSize2) { - xyz111->resizeTuples(nOrientations * TrigonalHigh::symSize2 * 3); + xyz111->resizeTuples(nOrientations * TrigonalHigh::k_SymSize2 * 3); } #ifdef EbsdLib_USE_PARALLEL_ALGORITHMS @@ -636,8 +603,6 @@ std::array TrigonalOps::getIpfColorAngleLimits(double eta) const return {TrigonalHigh::k_EtaMin * ebsdlib::constants::k_DegToRadD, TrigonalHigh::k_EtaMax * ebsdlib::constants::k_DegToRadD, TrigonalHigh::k_ChiMax * ebsdlib::constants::k_DegToRadD}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool TrigonalOps::inUnitTriangle(double eta, double chi) const { @@ -645,16 +610,12 @@ bool TrigonalOps::inUnitTriangle(double eta, double chi) const chi > (TrigonalHigh::k_ChiMax * ebsdlib::constants::k_PiOver180D)); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TrigonalOps::generateIPFColor(double* eulers, double* refDir, bool degToRad) const { return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TrigonalOps::generateIPFColor(double phi1, double phi, double phi2, double refDir0, double refDir1, double refDir2, bool degToRad) const { @@ -663,14 +624,12 @@ ebsdlib::Rgb TrigonalOps::generateIPFColor(double phi1, double phi, double phi2, return computeIPFColor(eulers, refDir, degToRad); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb TrigonalOps::generateRodriguesColor(double r1, double r2, double r3) const { - double range1 = 2.0f * TrigonalHigh::OdfDimInitValue[0]; - double range2 = 2.0f * TrigonalHigh::OdfDimInitValue[1]; - double range3 = 2.0f * TrigonalHigh::OdfDimInitValue[2]; + double range1 = 2.0f * TrigonalHigh::k_OdfDimInitValue[0]; + double range2 = 2.0f * TrigonalHigh::k_OdfDimInitValue[1]; + double range3 = 2.0f * TrigonalHigh::k_OdfDimInitValue[2]; double max1 = range1 / 2.0f; double max2 = range2 / 2.0f; double max3 = range3 / 2.0f; @@ -681,16 +640,12 @@ ebsdlib::Rgb TrigonalOps::generateRodriguesColor(double r1, double r2, double r3 return ebsdlib::RgbColor::dRgb(static_cast(red * 255), static_cast(green * 255), static_cast(blue * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::array TrigonalOps::getDefaultPoleFigureNames() const { return {"<0001>", "<0-110>", "<1-100>"}; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector TrigonalOps::generatePoleFigure(PoleFigureConfiguration_t& config) const { @@ -717,11 +672,11 @@ std::vector TrigonalOps::generatePoleFigure(Po // Create an Array to hold the XYZ Coordinates which are the coords on the sphere. // this is size for CUBIC ONLY, <001> Family std::vector dims(1, 3); - ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalHigh::symSize0, dims, label0 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz001 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalHigh::k_SymSize0, dims, label0 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <011> Family - ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalHigh::symSize1, dims, label1 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz011 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalHigh::k_SymSize1, dims, label1 + std::string("xyzCoords"), true); // this is size for CUBIC ONLY, <111> Family - ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalHigh::symSize2, dims, label2 + std::string("xyzCoords"), true); + ebsdlib::FloatArrayType::Pointer xyz111 = ebsdlib::FloatArrayType::CreateArray(numOrientations * TrigonalHigh::k_SymSize2, dims, label2 + std::string("xyzCoords"), true); config.sphereRadius = 1.0f; @@ -729,7 +684,7 @@ std::vector TrigonalOps::generatePoleFigure(Po generateSphereCoordsFromEulers(config.eulers, xyz001.get(), xyz011.get(), xyz111.get()); // These arrays hold the "intensity" images which eventually get converted to an actual Color RGB image - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ebsdlib::DoubleArrayType::Pointer intensity001 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label0 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity011 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label1 + "_Intensity_Image", true); ebsdlib::DoubleArrayType::Pointer intensity111 = ebsdlib::DoubleArrayType::CreateArray(config.imageDim * config.imageDim, label2 + "_Intensity_Image", true); @@ -937,10 +892,10 @@ void DrawFullCircleAnnotations(canvas_ity::canvas& context, int canvasDim, float +0.25F, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.25F, 0.5F, 1.0F, 1.1F, 1.0F, 1.0F, }; std::vector drawAngle = {false, false, false, false, false, false, false, false, false, true, true, true}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); @@ -1086,13 +1041,13 @@ TrigonalOps::Pointer TrigonalOps::NullPointer() // ----------------------------------------------------------------------------- std::string TrigonalOps::getNameOfClass() const { - return std::string("TrigonalOps"); + return {"TrigonalOps"}; } // ----------------------------------------------------------------------------- std::string TrigonalOps::ClassName() { - return std::string("TrigonalOps"); + return {"TrigonalOps"}; } // ----------------------------------------------------------------------------- diff --git a/Source/EbsdLib/LaueOps/TrigonalOps.h b/Source/EbsdLib/LaueOps/TrigonalOps.h index facc605..c59a0db 100644 --- a/Source/EbsdLib/LaueOps/TrigonalOps.h +++ b/Source/EbsdLib/LaueOps/TrigonalOps.h @@ -87,10 +87,10 @@ class EbsdLib_EXPORT TrigonalOps : public LaueOps * @brief getODFSize Returns the number of ODF bins * @return */ - int getODFSize() const override; + size_t getODFSize() const override; /** - * @brief getNumSymmetry Returns the internal variables for symSize0, symSize1, symSize2 + * @brief getNumSymmetry Returns the internal variables for k_SymSize0, k_SymSize1, k_SymSize2 * @return */ std::array getNumSymmetry() const override; @@ -99,7 +99,7 @@ class EbsdLib_EXPORT TrigonalOps : public LaueOps * @brief getMDFSize Returns the number of MDF bins * @return */ - int getMDFSize() const override; + size_t getMDFSize() const override; /** * @brief Returns the number of bins for an MDF Plot assuming 5 degree increments @@ -111,7 +111,7 @@ class EbsdLib_EXPORT TrigonalOps : public LaueOps * @brief getNumSymOps Returns the number of symmetry operators * @return */ - int getNumSymOps() const override; + size_t getNumSymOps() const override; /** * @brief getSymmetryName Returns the name of the Laue class @@ -157,7 +157,7 @@ class EbsdLib_EXPORT TrigonalOps : public LaueOps * @param i The index into the Symmetry operators array * @return The quaternion symmetry operator */ - QuatD getQuatSymOp(int i) const override; + QuatD getQuatSymOp(size_t i) const override; /** * @brief getRodSymOp Returns a Rodrigues vector based on the symmetry operator at index i @@ -170,15 +170,15 @@ class EbsdLib_EXPORT TrigonalOps : public LaueOps * @brief getNumRodriguesSymOps Returns the number of Rodrigues symmetry operators * @return */ - int32_t getNumRodriguesSymOps() const override; + size_t getNumRodriguesSymOps() const override; /** * @brief Retrieves a specific Symmetry Operator for a giving index * @param i The index from the Symmetry Operator Array to retrieve * @return void or a Matrix3X3 object. */ - Matrix3X3F getMatSymOpF(int i) const override; - Matrix3X3D getMatSymOpD(int i) const override; + Matrix3X3F getMatSymOpF(size_t i) const override; + Matrix3X3D getMatSymOpD(size_t i) const override; RodriguesDType getODFFZRod(const RodriguesDType& rod) const override; RodriguesDType getMDFFZRod(const RodriguesDType& rod) const override; diff --git a/Source/EbsdLib/Math/EbsdLibRandom.cpp b/Source/EbsdLib/Math/EbsdLibRandom.cpp index 7f83bff..82bbd86 100644 --- a/Source/EbsdLib/Math/EbsdLibRandom.cpp +++ b/Source/EbsdLib/Math/EbsdLibRandom.cpp @@ -95,13 +95,9 @@ // static unsigned long mt[N]; /* the array for the state vector */ // static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */ -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EbsdLibRandom::EbsdLibRandom() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EbsdLibRandom::~EbsdLibRandom() = default; @@ -245,8 +241,6 @@ double EbsdLibRandom::genrand_res53() return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- double EbsdLibRandom::genrand_beta(double aa, double bb) { @@ -412,8 +406,6 @@ double EbsdLibRandom::genrand_beta(double aa, double bb) #undef infnty } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- double EbsdLibRandom::genrand_norm(double m, double s) { diff --git a/Source/EbsdLib/Math/Matrix3X1.hpp b/Source/EbsdLib/Math/Matrix3X1.hpp index cd9b35b..f2af012 100644 --- a/Source/EbsdLib/Math/Matrix3X1.hpp +++ b/Source/EbsdLib/Math/Matrix3X1.hpp @@ -87,7 +87,7 @@ class Matrix3X1 * @param rhs * @return result */ - SelfType operator+(const SelfType& rhs) + SelfType operator+(const SelfType& rhs) const { return {m_Data[0] + rhs[0], m_Data[1] + rhs[1], m_Data[2] + rhs[2]}; } @@ -97,7 +97,7 @@ class Matrix3X1 * @param rhs * @return result */ - SelfType operator+(T scalar) + SelfType operator+(T scalar) const { return {m_Data[0] + scalar, m_Data[1] + scalar, m_Data[2] + scalar}; } @@ -107,7 +107,7 @@ class Matrix3X1 * @param rhs * @return outMat result */ - SelfType operator-(const SelfType& rhs) + SelfType operator-(const SelfType& rhs) const { return {m_Data[0] - rhs[0], m_Data[1] - rhs[1], m_Data[2] - rhs[2]}; } @@ -126,7 +126,7 @@ class Matrix3X1 * @return Matrix3X1 (1,0,0); */ - Matrix3X1 identity() + Matrix3X1 identity() const { return {1.0f, 0.0f, 0.0f}; } @@ -253,7 +253,7 @@ class Matrix3X1 /** * @brief Returns index of maximum value. */ - size_t maxValueIndex() + size_t maxValueIndex() const { float a = fabs(m_Data[0]); float b = fabs(m_Data[1]); diff --git a/Source/EbsdLib/Math/SourceList.cmake b/Source/EbsdLib/Math/SourceList.cmake index feb6d47..c20d862 100644 --- a/Source/EbsdLib/Math/SourceList.cmake +++ b/Source/EbsdLib/Math/SourceList.cmake @@ -2,9 +2,7 @@ set(DIR_NAME Math) set(EbsdLib_${DIR_NAME}_HDRS ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/EbsdLibMath.h - ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/GeometryMath.h ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/ArrayHelpers.hpp - ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/EbsdMatrixMath.h ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/EbsdLibRandom.h ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/Matrix3X1.hpp ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/Matrix3X3.hpp @@ -12,8 +10,6 @@ set(EbsdLib_${DIR_NAME}_HDRS set(EbsdLib_${DIR_NAME}_SRCS ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/EbsdLibMath.cpp - ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/GeometryMath.cpp - ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/EbsdMatrixMath.cpp ${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/${DIR_NAME}/EbsdLibRandom.cpp ) diff --git a/Source/EbsdLib/Math/EbsdMatrixMath.cpp b/Source/EbsdLib/Math/deprecated/EbsdMatrixMath.cpp similarity index 91% rename from Source/EbsdLib/Math/EbsdMatrixMath.cpp rename to Source/EbsdLib/Math/deprecated/EbsdMatrixMath.cpp index baa0664..199532b 100644 --- a/Source/EbsdLib/Math/EbsdMatrixMath.cpp +++ b/Source/EbsdLib/Math/deprecated/EbsdMatrixMath.cpp @@ -38,18 +38,12 @@ #include "EbsdLib/Math/EbsdLibMath.h" using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::EbsdMatrixMath::EbsdMatrixMath() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::EbsdMatrixMath::~EbsdMatrixMath() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ebsdlib::EbsdMatrixMath::Multiply3x3with3x1(const double g1[3][3], const double g2[3], float outMat[3]) { diff --git a/Source/EbsdLib/Math/EbsdMatrixMath.h b/Source/EbsdLib/Math/deprecated/EbsdMatrixMath.h similarity index 99% rename from Source/EbsdLib/Math/EbsdMatrixMath.h rename to Source/EbsdLib/Math/deprecated/EbsdMatrixMath.h index f555c6d..3e0d38a 100644 --- a/Source/EbsdLib/Math/EbsdMatrixMath.h +++ b/Source/EbsdLib/Math/deprecated/EbsdMatrixMath.h @@ -35,6 +35,8 @@ #pragma once +#error DEPRECATED + #include #include diff --git a/Source/EbsdLib/Math/GeometryMath.cpp b/Source/EbsdLib/Math/deprecated/GeometryMath.cpp similarity index 100% rename from Source/EbsdLib/Math/GeometryMath.cpp rename to Source/EbsdLib/Math/deprecated/GeometryMath.cpp diff --git a/Source/EbsdLib/Math/GeometryMath.h b/Source/EbsdLib/Math/deprecated/GeometryMath.h similarity index 99% rename from Source/EbsdLib/Math/GeometryMath.h rename to Source/EbsdLib/Math/deprecated/GeometryMath.h index 07485c1..825ea0e 100644 --- a/Source/EbsdLib/Math/GeometryMath.h +++ b/Source/EbsdLib/Math/deprecated/GeometryMath.h @@ -35,6 +35,8 @@ #pragma once +#error DEPRECATED + #include "EbsdLib/EbsdLib.h" namespace ebsdlib diff --git a/Source/EbsdLib/Orientation/Quaternion.hpp b/Source/EbsdLib/Orientation/Quaternion.hpp index 464c05f..ebc3a46 100644 --- a/Source/EbsdLib/Orientation/Quaternion.hpp +++ b/Source/EbsdLib/Orientation/Quaternion.hpp @@ -487,7 +487,7 @@ class Quaternion : public OrientationBase * THESE ARE THE CRYSTALLOGRAPHIC ORIENTATION CONVERSION METHODS * ****************************************************************************/ /** - * @brief Ensures this Quat represents an orientation that is located in the northern hemisphere. + * @brief Ensures this Quat represents an orientation that is located in the Northern Hemisphere. * * NOTE: This is done IN PLACE!! */ @@ -503,7 +503,7 @@ class Quaternion : public OrientationBase } /** - * @brief Returns a new Quat that represents an orientation that is located in the northern hemisphere + * @brief Returns a new Quat that represents an orientation that is located in the Northern Hemisphere * @return Copy of Quat */ SelfType getPositiveOrientation() const diff --git a/Source/EbsdLib/Texture/TexturePreset.cpp b/Source/EbsdLib/Texture/TexturePreset.cpp index c9f5ce5..5885357 100644 --- a/Source/EbsdLib/Texture/TexturePreset.cpp +++ b/Source/EbsdLib/Texture/TexturePreset.cpp @@ -38,20 +38,14 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TexturePreset::TexturePreset() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TexturePreset::~TexturePreset() = default; #define ADD_NEW_TEXTURE(name, xtal, e1, e2, e3) textures.push_back(TexturePreset::New(xtal, name, e1, e2, e3)); -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector CubicTexturePresets::getTextures() { @@ -73,8 +67,6 @@ std::vector CubicTexturePresets::getTextures() return textures; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector HexTexturePresets::getTextures() { diff --git a/Source/EbsdLib/Utilities/CanvasUtilities.cpp b/Source/EbsdLib/Utilities/CanvasUtilities.cpp index 772d1ed..665c360 100644 --- a/Source/EbsdLib/Utilities/CanvasUtilities.cpp +++ b/Source/EbsdLib/Utilities/CanvasUtilities.cpp @@ -286,10 +286,10 @@ ebsdlib::UInt8ArrayType::Pointer DrawStandardHexagonalProjection(ebsdlib::UInt8A 0.25F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F, 0.25F, 0.5F, 1.0F, -1.0F, 1.0F, 1.0F, }; std::vector drawAngle = {true, false, false, false, false, false, false, false, true, true, true, true}; - float radius = 1.0; // Work with a Unit Circle. + for(size_t idx = 0; idx < angles.size(); idx++) { - radius = 1.0F; + float radius = 1.0f; float angle = angles[idx]; float rads = angle * ebsdlib::constants::k_DegToRadF; float x = radius * (cos(rads)); diff --git a/Source/EbsdLib/Utilities/ColorTable.cpp b/Source/EbsdLib/Utilities/ColorTable.cpp index e91c38b..a97b46b 100644 --- a/Source/EbsdLib/Utilities/ColorTable.cpp +++ b/Source/EbsdLib/Utilities/ColorTable.cpp @@ -42,17 +42,11 @@ using namespace ebsdlib; // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- EbsdColorTable::EbsdColorTable() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- EbsdColorTable::~EbsdColorTable() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void EbsdColorTable::GetColorTable(int numColors, std::vector& colorsOut) { diff --git a/Source/EbsdLib/Utilities/ColorUtilities.cpp b/Source/EbsdLib/Utilities/ColorUtilities.cpp index 8183ac8..b3fb2dd 100644 --- a/Source/EbsdLib/Utilities/ColorUtilities.cpp +++ b/Source/EbsdLib/Utilities/ColorUtilities.cpp @@ -39,18 +39,12 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ColorUtilities::ColorUtilities() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ColorUtilities::~ColorUtilities() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb ColorUtilities::ConvertHSVtoRgb(float h, float s, float v) { @@ -129,8 +123,6 @@ ebsdlib::Rgb ColorUtilities::ConvertHSVtoRgb(float h, float s, float v) return ebsdlib::RgbColor::dRgb(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255), 0); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::Rgb ColorUtilities::Hsv2Rgb(float h, float s, float v) { @@ -210,8 +202,6 @@ ebsdlib::Rgb ColorUtilities::Hsv2Rgb(float h, float s, float v) return ebsdlib::RgbColor::dRgb(static_cast(out.r * 255), static_cast(out.g * 255), static_cast(out.b * 255), 255); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector ColorUtilities::GenerateColors(int count, int saturation, int value) { diff --git a/Source/EbsdLib/Utilities/ComputeStereographicProjection.cpp b/Source/EbsdLib/Utilities/ComputeStereographicProjection.cpp index 8eb6496..8e095e9 100644 --- a/Source/EbsdLib/Utilities/ComputeStereographicProjection.cpp +++ b/Source/EbsdLib/Utilities/ComputeStereographicProjection.cpp @@ -40,8 +40,6 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ComputeStereographicProjection::ComputeStereographicProjection(ebsdlib::FloatArrayType* xyzCoords, PoleFigureConfiguration_t* config, ebsdlib::DoubleArrayType* intensity) : m_XYZCoords(xyzCoords) @@ -50,13 +48,9 @@ ComputeStereographicProjection::ComputeStereographicProjection(ebsdlib::FloatArr { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ComputeStereographicProjection::~ComputeStereographicProjection() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ComputeStereographicProjection::operator()() const { diff --git a/Source/EbsdLib/Utilities/ComputeStereographicProjection.h b/Source/EbsdLib/Utilities/ComputeStereographicProjection.h index 617e785..d541e8c 100644 --- a/Source/EbsdLib/Utilities/ComputeStereographicProjection.h +++ b/Source/EbsdLib/Utilities/ComputeStereographicProjection.h @@ -78,7 +78,7 @@ std::vector> TransformUnitSphereToStereographicCoords(cons for(const auto& point : points) { - if(point[2] < 0) // project southern hemisphere + if(point[2] < 0) // project Southern Hemisphere { stereoPts.emplace_back(Point3DType{(point[0] / (1.0F - point[2])), (point[1] / (1.0F - point[2])), 0}); } diff --git a/Source/EbsdLib/Utilities/LambertUtilities.cpp b/Source/EbsdLib/Utilities/LambertUtilities.cpp index cf3f75b..533583f 100644 --- a/Source/EbsdLib/Utilities/LambertUtilities.cpp +++ b/Source/EbsdLib/Utilities/LambertUtilities.cpp @@ -39,18 +39,12 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- LambertUtilities::LambertUtilities() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- LambertUtilities::~LambertUtilities() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int32_t LambertUtilities::LambertSquareVertToSphereVert(float* vert, Hemisphere hemi) { diff --git a/Source/EbsdLib/Utilities/ModifiedLambertProjection.cpp b/Source/EbsdLib/Utilities/ModifiedLambertProjection.cpp index cfa4045..d248bad 100644 --- a/Source/EbsdLib/Utilities/ModifiedLambertProjection.cpp +++ b/Source/EbsdLib/Utilities/ModifiedLambertProjection.cpp @@ -62,8 +62,6 @@ double calcInterpolatedValue(const ModifiedLambertProjection& self, const std::a }; } // namespace -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjection::ModifiedLambertProjection() : m_Dimension(0) @@ -74,13 +72,9 @@ ModifiedLambertProjection::ModifiedLambertProjection() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjection::~ModifiedLambertProjection() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjection::Pointer ModifiedLambertProjection::LambertBallToSquare(ebsdlib::FloatArrayType* coords, int dimension, float sphereRadius) { @@ -146,8 +140,6 @@ ModifiedLambertProjection::Pointer ModifiedLambertProjection::LambertBallToSquar return squareProj; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjection::initializeSquares(int dims, float sphereRadius) { @@ -174,8 +166,6 @@ void ModifiedLambertProjection::initializeSquares(int dims, float sphereRadius) } #ifdef DATA_ARRAY_ENABLE_HDF5_IO // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- int ModifiedLambertProjection::writeHDF5Data(hid_t groupId) { int err = -1; @@ -189,8 +179,6 @@ int ModifiedLambertProjection::writeHDF5Data(hid_t groupId) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjection::readHDF5Data(hid_t groupId) { @@ -200,8 +188,6 @@ int ModifiedLambertProjection::readHDF5Data(hid_t groupId) #endif // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- void ModifiedLambertProjection::addInterpolatedValues(Square square, float* sqCoord, double value) { int abin1 = 0, bbin1 = 0; @@ -292,8 +278,6 @@ void ModifiedLambertProjection::addInterpolatedValues(Square square, float* sqCo } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjection::addValue(Square square, int index, double value) { @@ -309,8 +293,6 @@ void ModifiedLambertProjection::addValue(Square square, int index, double value) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjection::setValue(Square square, int index, double value) { @@ -324,8 +306,6 @@ void ModifiedLambertProjection::setValue(Square square, int index, double value) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- double ModifiedLambertProjection::getValue(Square square, int index) { @@ -337,8 +317,6 @@ double ModifiedLambertProjection::getValue(Square square, int index) return m_SouthSquare->getValue(index); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- double ModifiedLambertProjection::getInterpolatedValue(Square square, const float* sqCoord) const { @@ -420,8 +398,6 @@ double ModifiedLambertProjection::getInterpolatedValue(Square square, const floa return interpolatedIntensity; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool ModifiedLambertProjection::getSquareCoord(const float* xyz, float* sqCoord) const { @@ -462,8 +438,6 @@ bool ModifiedLambertProjection::getSquareCoord(const float* xyz, float* sqCoord) return nhCheck; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjection::getSquareIndex(float* sqCoord) { @@ -490,8 +464,6 @@ int ModifiedLambertProjection::getSquareIndex(float* sqCoord) return index; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjection::normalizeSquares() { @@ -520,8 +492,6 @@ void ModifiedLambertProjection::normalizeSquares() } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjection::normalizeSquaresToMRD() { @@ -540,8 +510,6 @@ void ModifiedLambertProjection::normalizeSquaresToMRD() } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjection::createStereographicProjection(int dim, ebsdlib::DoubleArrayType& stereoIntensity) { @@ -587,8 +555,6 @@ void ModifiedLambertProjection::createStereographicProjection(int dim, ebsdlib:: } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::DoubleArrayType::Pointer ModifiedLambertProjection::createStereographicProjection(int dim) { diff --git a/Source/EbsdLib/Utilities/ModifiedLambertProjectionArray.cpp b/Source/EbsdLib/Utilities/ModifiedLambertProjectionArray.cpp index 840ef65..9e5c502 100644 --- a/Source/EbsdLib/Utilities/ModifiedLambertProjectionArray.cpp +++ b/Source/EbsdLib/Utilities/ModifiedLambertProjectionArray.cpp @@ -49,8 +49,6 @@ using namespace H5Support; using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjectionArray::ModifiedLambertProjectionArray() : m_Name("") @@ -58,13 +56,9 @@ ModifiedLambertProjectionArray::ModifiedLambertProjectionArray() m_IsAllocated = true; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjectionArray::~ModifiedLambertProjectionArray() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::getXdmfTypeAndSize(std::string& xdmfTypeName, int& precision) const { @@ -72,48 +66,36 @@ void ModifiedLambertProjectionArray::getXdmfTypeAndSize(std::string& xdmfTypeNam precision = 0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string ModifiedLambertProjectionArray::getTypeAsString() const { return "ModifiedLambertProjectionArray"; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjectionArray::Pointer ModifiedLambertProjectionArray::createNewArray(size_t numElements, int rank, const size_t* dims, const std::string& name, bool allocate) const { return ModifiedLambertProjectionArray::NullPointer(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjectionArray::Pointer ModifiedLambertProjectionArray::createNewArray(size_t numElements, const std::vector& dims, const std::string& name, bool allocate) const { return ModifiedLambertProjectionArray::NullPointer(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool ModifiedLambertProjectionArray::isAllocated() const { return m_IsAllocated; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::clearAll() { m_ModifiedLambertProjectionArray.clear(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::setModifiedLambertProjection(int index, ModifiedLambertProjection::Pointer ModifiedLambertProjection) { @@ -130,8 +112,6 @@ void ModifiedLambertProjectionArray::setModifiedLambertProjection(int index, Mod m_ModifiedLambertProjectionArray[index] = ModifiedLambertProjection; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::fillArrayWithNewModifiedLambertProjection(size_t n) { @@ -145,8 +125,6 @@ void ModifiedLambertProjectionArray::fillArrayWithNewModifiedLambertProjection(s } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjection::Pointer ModifiedLambertProjectionArray::getModifiedLambertProjection(int idx) { @@ -159,8 +137,6 @@ ModifiedLambertProjection::Pointer ModifiedLambertProjectionArray::getModifiedLa return m_ModifiedLambertProjectionArray[idx]; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjection::Pointer ModifiedLambertProjectionArray::operator[](size_t idx) { @@ -173,37 +149,27 @@ ModifiedLambertProjection::Pointer ModifiedLambertProjectionArray::operator[](si return m_ModifiedLambertProjectionArray[idx]; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::setName(const std::string& name) { m_Name = name; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- std::string ModifiedLambertProjectionArray::getName() const { return m_Name; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::takeOwnership() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::releaseOwnership() { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void* ModifiedLambertProjectionArray::getVoidPointer(size_t i) { @@ -220,24 +186,18 @@ void* ModifiedLambertProjectionArray::getVoidPointer(size_t i) return (void*)(&(m_ModifiedLambertProjectionArray[i])); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- size_t ModifiedLambertProjectionArray::getNumberOfTuples() const { return m_ModifiedLambertProjectionArray.size(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- size_t ModifiedLambertProjectionArray::getSize() const { return m_ModifiedLambertProjectionArray.size(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::SetNumberOfComponents(int nc) { @@ -247,16 +207,12 @@ void ModifiedLambertProjectionArray::SetNumberOfComponents(int nc) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjectionArray::getNumberOfComponents() const { return 1; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::vector ModifiedLambertProjectionArray::getComponentDimensions() const { @@ -264,31 +220,23 @@ std::vector ModifiedLambertProjectionArray::getComponentDimensions() con return dims; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::SetRank(int rnk) { } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjectionArray::getRank() const { return 1; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- size_t ModifiedLambertProjectionArray::getTypeSize() const { return sizeof(ModifiedLambertProjection); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjectionArray::eraseTuples(std::vector& idxs) { @@ -340,8 +288,6 @@ int ModifiedLambertProjectionArray::eraseTuples(std::vector& idxs) return err; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjectionArray::copyTuple(size_t currentPos, size_t newPos) { @@ -349,8 +295,6 @@ int ModifiedLambertProjectionArray::copyTuple(size_t currentPos, size_t newPos) return 0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- bool ModifiedLambertProjectionArray::copyFromArray(size_t destTupleOffset, ModifiedLambertProjectionArray::Pointer sourceArray, size_t srcTupleOffset, size_t totalSrcTuples) { @@ -395,16 +339,12 @@ bool ModifiedLambertProjectionArray::copyFromArray(size_t destTupleOffset, Modif return true; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::initializeTuple(size_t i, void* p) { EBSD_METHOD_NOT_IMPLEMENTED() } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::initializeWithZeros() { @@ -415,8 +355,6 @@ void ModifiedLambertProjectionArray::initializeWithZeros() } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ModifiedLambertProjectionArray::Pointer ModifiedLambertProjectionArray::deepCopy(bool forceNoAllocate) const { @@ -433,8 +371,6 @@ ModifiedLambertProjectionArray::Pointer ModifiedLambertProjectionArray::deepCopy return daCopyPtr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int32_t ModifiedLambertProjectionArray::resizeTotalElements(size_t size) { @@ -442,24 +378,18 @@ int32_t ModifiedLambertProjectionArray::resizeTotalElements(size_t size) return 1; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::resizeTuples(size_t numTuples) { resizeTotalElements(numTuples); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::printTuple(std::stringstream& out, size_t i, char delimiter) const { EBSD_METHOD_NOT_IMPLEMENTED() } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- void ModifiedLambertProjectionArray::printComponent(std::stringstream& out, size_t i, int j) const {EBSD_METHOD_NOT_IMPLEMENTED()} #ifdef EbsdLib_ENABLE_HDF5 @@ -615,8 +545,6 @@ void Create2DExpandableDataset(hid_t gid, const std::string& dsetName, int lambe H5Pclose(cparms); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjectionArray::writeH5Data(hid_t parentId, const std::vector& tDims) const { @@ -660,8 +588,6 @@ int ModifiedLambertProjectionArray::writeH5Data(hid_t parentId, const std::vecto return err; } // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- int ModifiedLambertProjectionArray::readH5Data(hid_t parentId) { // bool ok = false; @@ -703,8 +629,6 @@ int ModifiedLambertProjectionArray::readH5Data(hid_t parentId) } #endif -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int ModifiedLambertProjectionArray::writeXdmfAttribute(std::stringstream& out, int64_t* volDims, const std::string& hdfFileName, const std::string& groupPath, const std::string& labelb) const { @@ -712,8 +636,6 @@ int ModifiedLambertProjectionArray::writeXdmfAttribute(std::stringstream& out, i return -1; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string ModifiedLambertProjectionArray::getInfoString(ebsdlib::InfoStringFormat format) const { @@ -724,8 +646,6 @@ std::string ModifiedLambertProjectionArray::getInfoString(ebsdlib::InfoStringFor return std::string(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::ToolTipGenerator ModifiedLambertProjectionArray::getToolTipGenerator() const { diff --git a/Source/EbsdLib/Utilities/PoleFigureData.cpp b/Source/EbsdLib/Utilities/PoleFigureData.cpp index 25f3165..4a962bd 100644 --- a/Source/EbsdLib/Utilities/PoleFigureData.cpp +++ b/Source/EbsdLib/Utilities/PoleFigureData.cpp @@ -38,8 +38,6 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- PoleFigureData::PoleFigureData(std::vector& x_data, std::vector& y_data, const std::string& title, int32_t* kernelRad, int32_t* size) : xData(x_data) @@ -52,8 +50,6 @@ PoleFigureData::PoleFigureData(std::vector& x_data, std::vector& y kernelRadius[1] = kernelRad[1]; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- PoleFigureData::PoleFigureData(const PoleFigureData& rhs) { @@ -67,13 +63,9 @@ PoleFigureData::PoleFigureData(const PoleFigureData& rhs) this->kernelRadius[1] = rhs.kernelRadius[1]; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- PoleFigureData::~PoleFigureData() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void PoleFigureData::operator=(const PoleFigureData& rhs) { diff --git a/Source/EbsdLib/Utilities/PoleFigureUtilities.cpp b/Source/EbsdLib/Utilities/PoleFigureUtilities.cpp index 26b4b32..d2ae275 100644 --- a/Source/EbsdLib/Utilities/PoleFigureUtilities.cpp +++ b/Source/EbsdLib/Utilities/PoleFigureUtilities.cpp @@ -49,18 +49,12 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- PoleFigureUtilities::PoleFigureUtilities() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- PoleFigureUtilities::~PoleFigureUtilities() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- int writeVtkFile(ebsdlib::FloatArrayType* xyz, const std::string& filename) { @@ -85,8 +79,6 @@ int writeVtkFile(ebsdlib::FloatArrayType* xyz, const std::string& filename) return 0; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ebsdlib::UInt8ArrayType::Pointer PoleFigureUtilities::CreateColorImage(ebsdlib::DoubleArrayType* data, int width, int height, int nColors, const std::string& name, double min, double max) { @@ -105,8 +97,6 @@ ebsdlib::UInt8ArrayType::Pointer PoleFigureUtilities::CreateColorImage(ebsdlib:: return image; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void PoleFigureUtilities::CreateColorImage(ebsdlib::DoubleArrayType* data, PoleFigureConfiguration_t& config, ebsdlib::UInt8ArrayType* image) { @@ -187,8 +177,6 @@ void PoleFigureUtilities::CreateColorImage(ebsdlib::DoubleArrayType* data, PoleF } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void PoleFigureUtilities::GenerateHexPoleFigures(ebsdlib::FloatArrayType* eulers, int lambertDimension, int poleFigureDim, ebsdlib::DoubleArrayType::Pointer& intensity0001, ebsdlib::DoubleArrayType::Pointer& intensity1010, ebsdlib::DoubleArrayType::Pointer& intensity1120) @@ -215,7 +203,7 @@ void PoleFigureUtilities::GenerateHexPoleFigures(ebsdlib::FloatArrayType* eulers writeVtkFile(xyz1120.get(), "c:/Users/GroebeMA/Desktop/Sphere_XYZ_FROM_EULER_1120.vtk"); #endif - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ModifiedLambertProjection::Pointer lambert = ModifiedLambertProjection::LambertBallToSquare(xyz0001.get(), lambertDimension, sphereRadius); // Now create the intensity image that will become the actual Pole figure image ebsdlib::DoubleArrayType::Pointer poleFigurePtr = lambert->createStereographicProjection(poleFigureDim); @@ -244,8 +232,6 @@ void PoleFigureUtilities::GenerateHexPoleFigures(ebsdlib::FloatArrayType* eulers intensity1120.swap(poleFigurePtr); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void PoleFigureUtilities::GenerateOrthoPoleFigures(ebsdlib::FloatArrayType* eulers, int lambertDimension, int poleFigureDim, ebsdlib::DoubleArrayType::Pointer& intensity100, ebsdlib::DoubleArrayType::Pointer& intensity010, ebsdlib::DoubleArrayType::Pointer& intensity001) @@ -272,7 +258,7 @@ void PoleFigureUtilities::GenerateOrthoPoleFigures(ebsdlib::FloatArrayType* eule writeVtkFile(xyz001.get(), "c:/Users/GroebeMA/Desktop/Sphere_XYZ_FROM_EULER_001.vtk"); #endif - // Generate the modified Lambert projection images (Squares, 2 of them, 1 for northern hemisphere, 1 for southern hemisphere + // Generate the modified Lambert projection images (Squares, 2 of them, 1 for Northern Hemisphere, 1 for Southern Hemisphere ModifiedLambertProjection::Pointer lambert = ModifiedLambertProjection::LambertBallToSquare(xyz100.get(), lambertDimension, sphereRadius); // Now create the intensity image that will become the actual Pole figure image ebsdlib::DoubleArrayType::Pointer poleFigurePtr = lambert->createStereographicProjection(poleFigureDim); @@ -301,8 +287,6 @@ void PoleFigureUtilities::GenerateOrthoPoleFigures(ebsdlib::FloatArrayType* eule intensity001.swap(poleFigurePtr); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- GeneratePoleFigureRgbaImageImpl::GeneratePoleFigureRgbaImageImpl() = default; @@ -314,8 +298,6 @@ GeneratePoleFigureRgbaImageImpl::GeneratePoleFigureRgbaImageImpl(ebsdlib::Double } GeneratePoleFigureRgbaImageImpl::~GeneratePoleFigureRgbaImageImpl() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void GeneratePoleFigureRgbaImageImpl::operator()() const { diff --git a/Source/EbsdLib/Utilities/ToolTipGenerator.cpp b/Source/EbsdLib/Utilities/ToolTipGenerator.cpp index 5781c45..83d9fa5 100644 --- a/Source/EbsdLib/Utilities/ToolTipGenerator.cpp +++ b/Source/EbsdLib/Utilities/ToolTipGenerator.cpp @@ -36,21 +36,15 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ToolTipGenerator::ToolTipGenerator() = default; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- ToolTipGenerator::~ToolTipGenerator() { clear(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ToolTipGenerator::addTitle(const std::string& title) { @@ -60,8 +54,6 @@ void ToolTipGenerator::addTitle(const std::string& title) m_Rows.push_back(titleRow); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ToolTipGenerator::addValue(const std::string& name, const std::string& value) { @@ -72,8 +64,6 @@ void ToolTipGenerator::addValue(const std::string& name, const std::string& valu m_Rows.push_back(valueRow); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ToolTipGenerator::addSpacer() { @@ -82,8 +72,6 @@ void ToolTipGenerator::addSpacer() m_Rows.push_back(spacer); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ToolTipGenerator::append(const ToolTipGenerator& other) { @@ -94,32 +82,24 @@ void ToolTipGenerator::append(const ToolTipGenerator& other) } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ToolTipGenerator::clear() { m_Rows.clear(); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string ToolTipGenerator::getRowColorStr() const { return m_RowColorStr; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void ToolTipGenerator::setRowColorStr(const std::string& color) { m_RowColorStr = color; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string ToolTipGenerator::generateHTML() const { @@ -145,8 +125,6 @@ std::string ToolTipGenerator::generateHTML() const return html; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string ToolTipGenerator::rowToHTML(const RowItem& row) const { diff --git a/Source/Test/AngleFileLoaderTest.cpp b/Source/Test/AngleFileLoaderTest.cpp index 2b8465a..0b36f49 100644 --- a/Source/Test/AngleFileLoaderTest.cpp +++ b/Source/Test/AngleFileLoaderTest.cpp @@ -51,8 +51,6 @@ using namespace ebsdlib; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- void makeTestFile(const std::string delim, const std::string& outputFile) { diff --git a/Source/Test/CtfReaderTest.cpp b/Source/Test/CtfReaderTest.cpp index 92221ca..6ee45d7 100644 --- a/Source/Test/CtfReaderTest.cpp +++ b/Source/Test/CtfReaderTest.cpp @@ -84,8 +84,6 @@ TEST_CASE("ebsdlib::CtfReaderTest::TestCtfReader", "[EbsdLib][CtfReaderTest]") DREAM3D_REQUIRE(euler3[1] == 29.394f) } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TEST_CASE("ebsdlib::CtfReaderTest::TestMultiplePhases_European", "[EbsdLib][CtfReaderTest]") { @@ -122,8 +120,6 @@ TEST_CASE("ebsdlib::CtfReaderTest::TestMultiplePhases_European", "[EbsdLib][CtfR DREAM3D_REQUIRE(euler3[1] == 0.2423f) } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TEST_CASE("ebsdlib::CtfReaderTest::TestMultiplePhases_US", "[EbsdLib][CtfReaderTest]") { @@ -160,8 +156,6 @@ TEST_CASE("ebsdlib::CtfReaderTest::TestMultiplePhases_US", "[EbsdLib][CtfReaderT DREAM3D_REQUIRE(euler3[1] == 29.394f) } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TEST_CASE("ebsdlib::CtfReaderTest::TestCellCountToLarge", "[EbsdLib][CtfReaderTest]") { @@ -172,8 +166,6 @@ TEST_CASE("ebsdlib::CtfReaderTest::TestCellCountToLarge", "[EbsdLib][CtfReaderTe DREAM3D_REQUIRED(err, ==, -110) } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- TEST_CASE("ebsdlib::CtfReaderTest::TestShortFile", "[EbsdLib][CtfReaderTest]") { diff --git a/Source/Test/Not_Used/TestPrintFunctions.h b/Source/Test/Not_Used/TestPrintFunctions.h index 0ab23a8..18ec397 100644 --- a/Source/Test/Not_Used/TestPrintFunctions.h +++ b/Source/Test/Not_Used/TestPrintFunctions.h @@ -19,8 +19,6 @@ namespace ebsdlib const std::string k_InputNames[s_NumReps] = {"eu", "om", "qu", "ax", "ro", "ho", "cu", "st"}; const int k_CompDims[s_NumReps] = {3, 9, 4, 4, 4, 3, 3, 3}; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_EU(const T& om) @@ -28,8 +26,6 @@ void Print_EU(const T& om) printf("EU:% 3.16f % 3.16f % 3.16f\n", om[0], om[1], om[2]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_OM(const T& om) @@ -39,8 +35,6 @@ void Print_OM(const T& om) printf("OM: \\ % 3.16f % 3.16f % 3.16f /\n", om[6], om[7], om[8]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_AX(const T& om) @@ -48,8 +42,6 @@ void Print_AX(const T& om) printf("Ax:<% 3.16f % 3.16f % 3.16f>% 3.16f\n", om[0], om[1], om[2], om[3]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_RO(const T& om) @@ -70,8 +62,6 @@ void Print_RO3(const T& om) printf("Ro:% 3.16f % 3.16f % 3.16f\n", om[0], om[1], om[2]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_HO(const T& om) @@ -79,8 +69,6 @@ void Print_HO(const T& om) printf("Ho:% 3.16f % 3.16f % 3.16f\n", om[0], om[1], om[2]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_QU(const T& om, typename T::Order layout) @@ -103,8 +91,6 @@ void Print_QU(const Quaternion& q) printf("QU:<% 3.16f % 3.6f % 3.16f> % 3.16f\n", q.x(), q.y(), q.z(), q.w()); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_CU(const T& om) @@ -112,8 +98,6 @@ void Print_CU(const T& om) printf("Cu:% 3.16f % 3.16f % 3.16f\n", om[0], om[1], om[2]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void Print_ST(const T& om) @@ -121,8 +105,6 @@ void Print_ST(const T& om) printf("St:% 3.16f % 3.16f % 3.16f\n", om[0], om[1], om[2]); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void PrintTuple(typename DataArrayClass::Pointer data, size_t t) diff --git a/Source/Test/QuaternionTest.cpp b/Source/Test/QuaternionTest.cpp index 5bef9c6..f877397 100644 --- a/Source/Test/QuaternionTest.cpp +++ b/Source/Test/QuaternionTest.cpp @@ -35,7 +35,6 @@ #include #include "EbsdLib/EbsdLib.h" -#include "EbsdLib/Math/EbsdMatrixMath.h" #include "EbsdLib/Math/Matrix3X1.hpp" #include "EbsdLib/Math/Matrix3X3.hpp" #include "EbsdLib/Orientation/Quaternion.hpp" @@ -67,9 +66,9 @@ TEST_CASE("ebsdlib::QuaternionTest::TestEbsdMatrixMath", "[EbsdLib][QuaternionTe } { - std::array dir = {1.0f, 2.0f, 3.0f}; - ebsdlib::EbsdMatrixMath::Normalize3x1(dir.data()); - ebsdlib::EbsdMatrixMath::Multiply3x1withConstant(dir.data(), -1.0f); + Matrix3X1F dir = {1.0f, 2.0f, 3.0f}; + dir = dir.normalize(); + dir = dir * -1.0f; } } diff --git a/Source/Test/UnitTestSupport.hpp b/Source/Test/UnitTestSupport.hpp index 209749d..32e06a3 100644 --- a/Source/Test/UnitTestSupport.hpp +++ b/Source/Test/UnitTestSupport.hpp @@ -79,8 +79,6 @@ static int SizeOfFailed = 6; #if 0 // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- std::stringstream& operator<<(std::stringstream& out, const DataArrayPath& v) { out << v.getDataContainerName() << "|" << v.getAttributeMatrixName() << "|" << v.getDataArrayName(); @@ -88,8 +86,6 @@ std::stringstream& operator<<(std::stringstream& out, const DataArrayPath& v) } #endif -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- class TestException : public std::exception { @@ -200,8 +196,6 @@ class TestException : public std::exception void operator=(const TestException&); // Move assignment Not Implemented }; -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- inline void TestPassed(const std::string& test) { @@ -223,8 +217,6 @@ inline void TestPassed(const std::string& test) ebsdlib::unittest::numTestsPass++; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- inline void TestFailed(const std::string& test) { @@ -246,8 +238,6 @@ inline void TestFailed(const std::string& test) ebsdlib::unittest::numTestFailed++; } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- #define INFINITYCHECK 1 #define SIGNCHECK 1 @@ -496,8 +486,6 @@ inline bool AlmostEqualUlpsFinal(float* A, float* B, int maxUlps) err = EXIT_FAILURE; \ } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void require_equal(T l, const std::string& L, K r, const std::string& R, const std::string file = "", int line = 0) @@ -514,8 +502,6 @@ void require_equal(T l, const std::string& L, K r, const std::string& R, const s } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void require_less_than(T l, const std::string& L, K r, const std::string& R, const std::string file = "", int line = 0) @@ -531,8 +517,6 @@ void require_less_than(T l, const std::string& L, K r, const std::string& R, con } } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- template void require_greater_than(T l, const std::string& L, K r, const std::string& R, const std::string file = "", int line = 0) diff --git a/cmake/cmpVersion.cpp.in b/cmake/cmpVersion.cpp.in index 53bc042..ecf68e2 100755 --- a/cmake/cmpVersion.cpp.in +++ b/cmake/cmpVersion.cpp.in @@ -16,48 +16,36 @@ #include "@VERSION_GEN_HEADER_FILE_NAME@" -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::Complete() { return std::string("@VERSION_GEN_VER_MAJOR@.@VERSION_GEN_VER_MINOR@.@VERSION_GEN_VER_PATCH@.@VERSION_GEN_VER_REVISION@"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::Major() { return std::string("@VERSION_GEN_VER_MAJOR@"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::Minor() { return std::string("@VERSION_GEN_VER_MINOR@"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::Patch() { return std::string("@VERSION_GEN_VER_PATCH@"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::Revision() { return std::string("@VERSION_GEN_VER_REVISION@"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::Package() { @@ -65,24 +53,18 @@ std::string @VERSION_GEN_NAMESPACE@::Version::Package() } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::PackageComplete() { return std::string("@PROJECT_PREFIX@ Version @VERSION_GEN_VER_MAJOR@.@VERSION_GEN_VER_MINOR@.@VERSION_GEN_VER_PATCH@.@VERSION_GEN_VER_REVISION@"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::BuildDate() { return std::string("@VERSION_BUILD_DATE@"); } -// ----------------------------------------------------------------------------- -// // ----------------------------------------------------------------------------- std::string @VERSION_GEN_NAMESPACE@::Version::GitHash() { From 02cb545bfd291739db60501053cb51b69da658e8 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 16 Jan 2026 11:01:20 -0500 Subject: [PATCH 5/5] Remove Static cast Co-authored-by: Jared Duffey --- Source/EbsdLib/LaueOps/LaueOps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/EbsdLib/LaueOps/LaueOps.cpp b/Source/EbsdLib/LaueOps/LaueOps.cpp index 6f9b942..9df533d 100644 --- a/Source/EbsdLib/LaueOps/LaueOps.cpp +++ b/Source/EbsdLib/LaueOps/LaueOps.cpp @@ -550,7 +550,7 @@ RodriguesDType LaueOps::_calcRodNearestOrigin(const RodriguesDType& inRod) const rod[0] *= rod[3]; rod[1] *= rod[3]; rod[2] *= rod[3]; - size_t numsym = static_cast(getNumRodriguesSymOps()); + size_t numsym = getNumRodriguesSymOps(); for(size_t i = 0; i < numsym; i++) {