Skip to content

Commit 25f7699

Browse files
BUG: Fix bugs inside of the _calcRodNearestOrigin function. (#36)
* 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. * Update some static constants to constexpr * COMP: Remove legacy float[3][3] for MatSymOp functions * ENH: Update more functions, static constants, formatting and other bits --------- Co-authored-by: Jared Duffey <jared.duffey@bluequartz.net>
1 parent fdf5858 commit 25f7699

81 files changed

Lines changed: 2040 additions & 3353 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ option(EbsdLib_BUILD_H5SUPPORT "Build H5Support Library" OFF)
3737

3838

3939
# set project's name
40-
project(EbsdLibProj VERSION 2.0.0)
40+
project(EbsdLibProj VERSION 2.1.0)
4141

4242

4343
# Request C++17 standard, using new CMake variables.

Source/Apps/gen_sym_code.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ void Print3x3(const OrientationMatrixDType& m)
158158
std::cout << std::fixed;
159159
std::cout << std::setprecision(16);
160160
size_t i = 0;
161-
std::cout << " {{" << m[i++] << ", " << m[i++] << ", " << m[i++] << "},\n";
162-
std::cout << " {" << m[i++] << ", " << m[i++] << ", " << m[i++] << "},\n";
163-
std::cout << " {" << m[i++] << ", " << m[i++] << ", " << m[i++] << "}},\n";
161+
std::cout << " {" << m[i++] << ", " << m[i++] << ", " << m[i++] << ",\n";
162+
std::cout << " " << m[i++] << ", " << m[i++] << ", " << m[i++] << ",\n";
163+
std::cout << " " << m[i++] << ", " << m[i++] << ", " << m[i++] << "},\n";
164164
}
165165

166166
void PrintQuat(const QuatD& q, bool sv)
@@ -208,15 +208,15 @@ int main(int argc, char* argv[])
208208

209209
std::cout << std::setprecision(8);
210210
std::cout << "/* clang-format off */\n";
211-
std::cout << "static const std::vector<QuatD> QuatSym ={\n";
211+
std::cout << "static const std::vector<QuatD> k_QuatSym ={\n";
212212
for(const auto& symOp : symOPs)
213213
{
214214
PrintQuat(symOp, false);
215215
std::cout << ",\n";
216216
}
217217
std::cout << "};\n\n";
218218

219-
std::cout << "static const std::vector<RodriguesDType> RodSym = {\n";
219+
std::cout << "static const std::vector<RodriguesDType> k_RodSym = {\n";
220220
for(const auto& symOp : symOPs)
221221
{
222222
auto ro = QuaternionDType(symOp).toRodrigues();
@@ -225,7 +225,7 @@ int main(int argc, char* argv[])
225225
}
226226
std::cout << "};\n\n";
227227

228-
std::cout << "static const double MatSym[k_SymOpsCount][3][3] = {\n";
228+
std::cout << "static const std::vector<Matrix3X3D> k_MatSym = {\n";
229229
for(const auto& symOp : symOPs)
230230
{
231231
auto om = QuaternionDType(symOp).toOrientationMatrix();

Source/Apps/make_ipf.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "EbsdLib/IO/TSL/AngPhase.h"
1010
#include "EbsdLib/IO/TSL/AngReader.h"
1111
#include "EbsdLib/LaueOps/LaueOps.h"
12-
#include "EbsdLib/Math/EbsdMatrixMath.h"
1312
#include "EbsdLib/Utilities/ColorTable.h"
1413
#include "EbsdLib/Utilities/TiffWriter.h"
1514

@@ -26,7 +25,7 @@ using namespace ebsdlib;
2625
class GenerateIPFColorsImpl
2726
{
2827
public:
29-
GenerateIPFColorsImpl(FloatVec3Type& referenceDir, const std::vector<float>& eulers, int32_t* phases, std::vector<AngPhase::Pointer>& crystalStructures, bool* goodVoxels, uint8_t* colors)
28+
GenerateIPFColorsImpl(Matrix3X1F& referenceDir, const std::vector<float>& eulers, int32_t* phases, std::vector<AngPhase::Pointer>& crystalStructures, bool* goodVoxels, uint8_t* colors)
3029
: m_ReferenceDir(referenceDir)
3130
, m_CellEulerAngles(eulers)
3231
, m_CellPhases(phases)
@@ -96,7 +95,7 @@ class GenerateIPFColorsImpl
9695
}
9796

9897
private:
99-
FloatVec3Type m_ReferenceDir;
98+
Matrix3X1F m_ReferenceDir;
10099
const std::vector<float>& m_CellEulerAngles;
101100
int32_t* m_CellPhases;
102101
std::vector<AngPhase::Pointer> m_PhaseInfos;
@@ -119,7 +118,7 @@ class Ang2IPF
119118
Ang2IPF& operator=(const Ang2IPF&) = delete; // Copy Assignment Not Implemented
120119
Ang2IPF& operator=(Ang2IPF&&) = delete; // Move Assignment Not Implemented
121120

122-
std::array<float, 3> m_ReferenceDir = {0.0F, 0.0F, 1.0F};
121+
Matrix3X1F m_ReferenceDir = {0.0f, 0.0f, 1.0f};
123122

124123
/**
125124
* @brief incrementPhaseWarningCount
@@ -152,8 +151,7 @@ class Ang2IPF
152151
// int32_t numPhase = static_cast<int32_t>(crystalStructures.size());
153152

154153
// Make sure we are dealing with a unit 1 vector.
155-
std::array<float, 3> normRefDir = m_ReferenceDir; // Make a copy of the reference Direction
156-
ebsdlib::EbsdMatrixMath::Normalize3x1(normRefDir[0], normRefDir[1], normRefDir[2]);
154+
Matrix3X1F normRefDir = m_ReferenceDir.normalize(); // Make a copy of the reference Direction and normalize it
157155

158156
float* phi1Ptr = reader.getPhi1Pointer(false);
159157
float* phiPtr = reader.getPhiPointer(false);

Source/EbsdLib/Core/EbsdDataArray.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,8 +1530,6 @@ T* EbsdDataArray<T>::resizeAndExtend(size_t size)
15301530
return m_Array;
15311531
}
15321532

1533-
// -----------------------------------------------------------------------------
1534-
//
15351533
// -----------------------------------------------------------------------------
15361534
#if !defined(__APPLE__) && !defined(_MSC_VER)
15371535
#undef EbsdLib_EXPORT

Source/EbsdLib/Core/EbsdSetGetMacros.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,6 @@ private:
337337
public: \
338338
virtual EBSD_SET_STRING_PROPERTY(prpty, m_##prpty) virtual EBSD_GET_STRING_PROPERTY(prpty, m_##prpty)
339339

340-
// -----------------------------------------------------------------------------
341-
//
342340
// -----------------------------------------------------------------------------
343341
/**
344342
* @brief Creates a "setter" method to set the property.
@@ -422,8 +420,6 @@ public:
422420
} \
423421
}
424422

425-
// -----------------------------------------------------------------------------
426-
//
427423
// -----------------------------------------------------------------------------
428424
// These are simple over-rides from the boost distribution because we don't want the entire boost distribution just
429425
// for a few boost headers

Source/EbsdLib/Core/EbsdTransform.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535

3636
#include "EbsdTransform.h"
3737

38-
// -----------------------------------------------------------------------------
39-
//
4038
// -----------------------------------------------------------------------------
4139
EbsdTransform::EbsdTransform()
4240

@@ -75,8 +73,6 @@ ebsdlib::EbsdToSampleCoordinateMapping EbsdTransform::IdentifyStandardTransforma
7573
return ebsdlib::UnknownCoordinateMapping;
7674
}
7775

78-
// -----------------------------------------------------------------------------
79-
//
8076
// -----------------------------------------------------------------------------
8177
EbsdTransform::~EbsdTransform() = default;
8278

Source/EbsdLib/Core/OrientationMath.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,12 @@
3838
#include <cmath>
3939
using namespace ebsdlib;
4040

41-
// -----------------------------------------------------------------------------
42-
//
4341
// -----------------------------------------------------------------------------
4442
OrientationMath::OrientationMath() = default;
4543

46-
// -----------------------------------------------------------------------------
47-
//
4844
// -----------------------------------------------------------------------------
4945
OrientationMath::~OrientationMath() = default;
5046

51-
// -----------------------------------------------------------------------------
52-
//
5347
// -----------------------------------------------------------------------------
5448
void OrientationMath::MetricTensorFromLatticeParameters(float a, float b, float c, float alpha, float beta, float gamma, float mt[3][3])
5549
{
@@ -64,8 +58,6 @@ void OrientationMath::MetricTensorFromLatticeParameters(float a, float b, float
6458
mt[2][2] = c * c;
6559
}
6660

67-
// -----------------------------------------------------------------------------
68-
//
6961
// -----------------------------------------------------------------------------
7062
void OrientationMath::RootTensorFromLatticeParameters(float a, float b, float c, float alpha, float beta, float gamma, float rt[3][3])
7163
{
@@ -80,8 +72,6 @@ void OrientationMath::RootTensorFromLatticeParameters(float a, float b, float c,
8072
rt[2][2] = c;
8173
}
8274

83-
// -----------------------------------------------------------------------------
84-
//
8575
// -----------------------------------------------------------------------------
8676
void OrientationMath::MillerBravaisToMillerDirection(const int32_t millerBravais[4], int32_t miller[3])
8777
{
@@ -90,8 +80,6 @@ void OrientationMath::MillerBravaisToMillerDirection(const int32_t millerBravais
9080
miller[2] = millerBravais[3];
9181
}
9282
// -----------------------------------------------------------------------------
93-
//
94-
// -----------------------------------------------------------------------------
9583
void OrientationMath::MillerToMillerBravaisDirection(const int32_t miller[3], int32_t millerBravais[4])
9684
{
9785
millerBravais[0] = static_cast<int32_t>(0.33333f * (2 * miller[0] - miller[1]));
@@ -100,17 +88,13 @@ void OrientationMath::MillerToMillerBravaisDirection(const int32_t miller[3], in
10088
millerBravais[3] = miller[2];
10189
}
10290
// -----------------------------------------------------------------------------
103-
//
104-
// -----------------------------------------------------------------------------
10591
void OrientationMath::MillerBravaisToMillerPlane(const int32_t millerBravais[4], int32_t miller[3])
10692
{
10793
miller[0] = millerBravais[0];
10894
miller[1] = millerBravais[1];
10995
miller[2] = millerBravais[3];
11096
}
11197
// -----------------------------------------------------------------------------
112-
//
113-
// -----------------------------------------------------------------------------
11498
void OrientationMath::MillerToMillerBravaisPlane(const int32_t miller[3], int32_t millerBravais[4])
11599
{
116100
millerBravais[0] = miller[0];

Source/EbsdLib/Core/OrientationTransformation.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,6 @@ ResultType st_check(const InputType& st)
493493
return res;
494494
}
495495

496-
// -----------------------------------------------------------------------------
497-
//
498496
// -----------------------------------------------------------------------------
499497
template <typename T>
500498
void Print_OM(const T& om)

Source/EbsdLib/IO/AngleFileLoader.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252

5353
using namespace ebsdlib;
5454

55-
// -----------------------------------------------------------------------------
56-
//
5755
// -----------------------------------------------------------------------------
5856
AngleFileLoader::AngleFileLoader()
5957
: m_ErrorMessage("")
@@ -63,13 +61,9 @@ AngleFileLoader::AngleFileLoader()
6361
{
6462
}
6563

66-
// -----------------------------------------------------------------------------
67-
//
6864
// -----------------------------------------------------------------------------
6965
AngleFileLoader::~AngleFileLoader() = default;
7066

71-
// -----------------------------------------------------------------------------
72-
//
7367
// -----------------------------------------------------------------------------
7468
ebsdlib::FloatArrayType::Pointer AngleFileLoader::loadData()
7569
{

Source/EbsdLib/IO/BrukerNano/EspritPhase.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,21 @@
3636

3737
using namespace ebsdlib;
3838

39-
// -----------------------------------------------------------------------------
40-
//
4139
// -----------------------------------------------------------------------------
4240
EspritPhase::EspritPhase()
4341
: m_PhaseIndex(-1)
4442
{
4543
}
4644

47-
// -----------------------------------------------------------------------------
48-
//
4945
// -----------------------------------------------------------------------------
5046
EspritPhase::~EspritPhase() = default;
5147

52-
// -----------------------------------------------------------------------------
53-
//
5448
// -----------------------------------------------------------------------------
5549
std::string EspritPhase::getMaterialName()
5650
{
5751
return m_Name;
5852
}
5953

60-
// -----------------------------------------------------------------------------
61-
//
6254
// -----------------------------------------------------------------------------
6355
unsigned int EspritPhase::determineOrientationOpsIndex()
6456
{
@@ -118,8 +110,6 @@ unsigned int EspritPhase::determineOrientationOpsIndex()
118110
return ebsdlib::CrystalStructure::UnknownCrystalStructure;
119111
}
120112

121-
// -----------------------------------------------------------------------------
122-
//
123113
// -----------------------------------------------------------------------------
124114
void EspritPhase::parseFormula(std::vector<std::string>& tokens)
125115
{
@@ -130,8 +120,6 @@ void EspritPhase::parseFormula(std::vector<std::string>& tokens)
130120
}
131121
}
132122

133-
// -----------------------------------------------------------------------------
134-
//
135123
// -----------------------------------------------------------------------------
136124
void EspritPhase::parseName(std::vector<std::string>& tokens)
137125
{
@@ -142,8 +130,6 @@ void EspritPhase::parseName(std::vector<std::string>& tokens)
142130
}
143131
}
144132

145-
// -----------------------------------------------------------------------------
146-
//
147133
// -----------------------------------------------------------------------------
148134
void EspritPhase::parseSpaceGroup(std::vector<std::string>& tokens)
149135
{

0 commit comments

Comments
 (0)