https://mooseframework.inl.gov
Functions
Euler2RGBTest.C File Reference

Go to the source code of this file.

Functions

 TEST (Euler2RGBTest, test)
 

Function Documentation

◆ TEST()

TEST ( Euler2RGBTest  ,
test   
)

Definition at line 15 of file Euler2RGBTest.C.

16 {
17  const unsigned int nsamples = 23;
18 
19  struct Samples
20  {
21  Real phi1, phi, phi2;
22  unsigned int phase, sym;
23  Real expect[3];
24  } samples[nsamples] = {
25  // symmetries 43 62 42 32 22 2 0
26  {0.1, 1.5, 0.7, 1, 43, {6225789, 16738084, 5635933}},
27  {2.1, 2.5, 1.4, 1, 43, {2251519, 10534399, 9240454}},
28  {5.9, 0.5, 4.4, 1, 43, {7536546, 3112447, 16776397}},
29 
30  {0.1, 1.5, 0.7, 1, 62, {5422335, 16729118, 4521910}},
31  {2.1, 2.5, 1.4, 1, 62, {16711664, 9043825, 16756345}},
32  {5.9, 0.5, 4.4, 1, 62, {7012242, 14211583, 16740231}},
33 
34  {0.1, 1.5, 0.7, 1, 42, {4609535, 16729625, 3889663}},
35  {2.1, 2.5, 1.4, 1, 42, {12264959, 9406975, 16759651}},
36  {5.9, 0.5, 4.4, 1, 42, {6648831, 11091455, 16746350}},
37 
38  {0.1, 1.5, 0.7, 1, 32, {5353983, 16729877, 4027391}},
39  {2.1, 2.5, 1.4, 1, 32, {13929983, 8604927, 16761430}},
40  {5.9, 0.5, 4.4, 1, 32, {6487904, 12844963, 16736146}},
41 
42  {0.1, 1.5, 0.7, 1, 22, {5963751, 16730129, 4908543}},
43  {2.1, 2.5, 1.4, 1, 22, {16774907, 10603519, 16762950}},
44  {5.9, 0.5, 4.4, 1, 22, {7919615, 14876658, 16751694}},
45 
46  {0.1, 1.5, 0.7, 1, 2, {4980617, 16730380, 4325278}},
47  {2.1, 2.5, 1.4, 1, 2, {14155669, 9961385, 16764465}},
48  {5.9, 0.5, 4.4, 1, 2, {7185663, 12357375, 16725925}},
49 
50  // phase 0 or unknown sym
51  {0.1, 1.5, 0.7, 0, 2, {0, 0, 0}},
52  {2.1, 2.5, 1.4, 1, 0, {0, 0, 0}},
53 
54  // out of bounds angle
55  {6.9, 0.5, 4.4, 1, 2, {0, 0, 0}},
56  {5.9, 4.5, 4.4, 1, 2, {0, 0, 0}},
57  {5.9, 0.5, 8.4, 1, 2, {0, 0, 0}}
58 
59  // TODO: negative angles are not checked yet!
60  };
61 
62  for (unsigned int i = 0; i < nsamples; ++i)
63  for (unsigned int sd = 1; i <= 3; ++i)
64  {
65  Point RGB = euler2RGB(
66  sd, samples[i].phi1, samples[i].phi, samples[i].phi2, samples[i].phase, samples[i].sym);
67 
68  Real RGBint = 0.0;
69  for (unsigned int j = 0; j < 3; ++j)
70  RGBint = 256 * RGBint + (RGB(j) >= 1 ? 255 : std::floor(RGB(j) * 256.0));
71 
72  EXPECT_NEAR(samples[i].expect[sd - 1], RGBint, 0.00001) << "case " << i + 1 << " failed";
73  }
74 }
Point euler2RGB(unsigned int sd, Real phi1, Real PHI, Real phi2, unsigned int phase, unsigned int sym)
This function rotates a set of three Bunge Euler angles into the standard Stereographic triangle...
Definition: Euler2RGB.C:46
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")