https://mooseframework.inl.gov
EBSDAccessFunctorsTest.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "EBSDAccessFunctorsTest.h"
11 
13 {
14  RealVectorValue reference_angle(0.1, 0.2, 0.3);
15  Point reference_point1 = Point(9.0, 10.0, 11.0);
16  Point reference_point2 = Point(6.0, 7.0, 8.0);
17 
18  // Test point data access
19  {
20  EBSDPointDataPhi1 phi1;
21  EXPECT_EQ(phi1(_point), _point._phi1);
22  EBSDPointDataPhi phi;
23  EXPECT_EQ(phi(_point), _point._Phi);
24  EBSDPointDataPhi2 phi2;
25  EXPECT_EQ(phi2(_point), _point._phi2);
26 
27  EBSDPointDataPhase phase;
28  EXPECT_EQ(phase(_point), _point._phase);
29  EBSDPointDataSymmetry symmetry;
30  EXPECT_EQ(symmetry(_point), _point._symmetry);
31  EBSDPointDataFeatureID feature_id;
32  EXPECT_EQ(feature_id(_point), _point._feature_id);
33 
34  for (unsigned int i = 0; i < 3; ++i)
35  {
36  EBSDPointDataCustom custom(i);
37  EXPECT_EQ(custom(_point), _point._custom[i]);
38  }
39  }
40 
41  // Test average data access
42  {
43  RealVectorValue angle = *(_avg._angles);
44  EXPECT_EQ((angle - reference_angle).norm(), 0);
45 
46  EBSDAvgDataPhi1 phi1;
47  EXPECT_EQ(phi1(_avg), angle(0));
48  EBSDAvgDataPhi phi;
49  EXPECT_EQ(phi(_avg), angle(1));
50  EBSDAvgDataPhi2 phi2;
51  EXPECT_EQ(phi2(_avg), angle(2));
52 
53  EBSDAvgDataPhase phase;
54  EXPECT_EQ(phase(_avg), _avg._phase);
55  EBSDAvgDataSymmetry symmetry;
56  EXPECT_EQ(symmetry(_avg), _avg._symmetry);
57  EBSDAvgDataFeatureID feature_id;
58  EXPECT_EQ(feature_id(_avg), _avg._feature_id);
59  EBSDAvgDataLocalID local;
60  EXPECT_EQ(local(_avg), _avg._local_id);
61 
62  for (unsigned int i = 0; i < 3; ++i)
63  {
64  EBSDAvgDataCustom custom(i);
65  EXPECT_EQ(custom(_avg), _avg._custom[i]);
66  }
67  }
68 }
TEST_F(EBSDAccessFunctorsTest, test)
auto norm(const T &a) -> decltype(std::abs(a))