www.mooseframework.org
EBSDAccessFunctors.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #ifndef EBSDACCESSFUNCTORS_H
8 #define EBSDACCESSFUNCTORS_H
9 
10 #include "MooseObject.h"
11 #include "MooseEnum.h"
12 #include "EulerAngles.h"
13 
20 {
21 public:
24  {
26  Real _phi1;
27  Real _Phi;
28  Real _phi2;
30 
32  Point _p;
33 
35  unsigned int _feature_id;
36  unsigned int _phase;
37  unsigned int _symmetry;
39 
41  std::vector<Real> _custom;
42  };
43 
45  struct EBSDAvgData
46  {
49 
51  unsigned int _feature_id;
52  unsigned int _phase;
53  unsigned int _symmetry;
55 
57  unsigned int _local_id;
58 
60  unsigned int _n;
61 
63  Point _p;
64 
66  std::vector<Real> _custom;
67  };
68 
69  static MooseEnum getPointDataFieldType();
70  static MooseEnum getAvgDataFieldType();
71 
74  {
75  virtual Real operator()(const EBSDPointData &) = 0;
76  virtual ~EBSDPointDataFunctor(){};
77  };
80  {
81  virtual Real operator()(const EBSDAvgData &) = 0;
82  virtual ~EBSDAvgDataFunctor(){};
83  };
84 
85  // List of specialized access functors (one for each field in EBSDPointData)
87  {
88  virtual Real operator()(const EBSDPointData & d) { return d._phi1; };
89  };
91  {
92  virtual Real operator()(const EBSDPointData & d) { return d._Phi; };
93  };
95  {
96  virtual Real operator()(const EBSDPointData & d) { return d._phi2; };
97  };
99  {
100  virtual Real operator()(const EBSDPointData & d) { return d._feature_id; };
101  };
103  {
104  virtual Real operator()(const EBSDPointData & d) { return d._phase; };
105  };
107  {
108  virtual Real operator()(const EBSDPointData & d) { return d._symmetry; };
109  };
111  {
112  EBSDPointDataCustom(unsigned int index) : _index(index) {}
113  virtual Real operator()(const EBSDPointData & d)
114  {
115  mooseAssert(_index < d._custom.size(),
116  "Requesting out of bounds index in EBSDPointDataCustom.");
117  return d._custom[_index];
118  };
119  const unsigned int _index;
120  };
121 
122  // List of specialized access functors (one for each field in EBSDAvgData)
124  {
125  virtual Real operator()(const EBSDAvgData & a) { return a._angles->phi1; };
126  };
128  {
129  virtual Real operator()(const EBSDAvgData & a) { return a._angles->Phi; };
130  };
132  {
133  virtual Real operator()(const EBSDAvgData & a) { return a._angles->phi2; };
134  };
136  {
137  virtual Real operator()(const EBSDAvgData & a) { return a._phase; };
138  };
140  {
141  virtual Real operator()(const EBSDAvgData & a) { return a._symmetry; };
142  };
144  {
145  virtual Real operator()(const EBSDAvgData & a) { return a._local_id; };
146  };
148  {
149  virtual Real operator()(const EBSDAvgData & a) { return a._feature_id; };
150  };
152  {
153  EBSDAvgDataCustom(unsigned int index) : _index(index) {}
154  virtual Real operator()(const EBSDAvgData & a)
155  {
156  mooseAssert(_index < a._custom.size(),
157  "Requesting out of bounds index in EBSDPointDataCustom.");
158  return a._custom[_index];
159  };
160  const unsigned int _index;
161  };
162 };
163 
164 #endif // EBSDACCESSFUNCTORS_H
unsigned int _local_id
Index in the per-phase list of global IDs.
static MooseEnum getAvgDataFieldType()
virtual Real operator()(const EBSDPointData &d)
virtual Real operator()(const EBSDPointData &d)
virtual Real operator()(const EBSDPointData &d)
virtual Real operator()(const EBSDAvgData &a)
std::vector< Real > _custom
Custom data columns.
virtual Real operator()(const EBSDAvgData &a)
Point _p
Center of mass for the global grain.
std::vector< Real > _custom
Grain averaged custom data columns.
virtual Real operator()(const EBSDPointData &d)
unsigned int _feature_id
EBSD feature id, (gklobal) grain number, symmetry, and phase data.
Point _p
Element centroid position.
Per element EBSD data point.
Mix-in class that adds so called access functors to select a field from an EBSDPointData or EBSDPoint...
virtual Real operator()(const EBSDPointData &d)
EulerAngles * _angles
Averaged Euler angles.
Access functor base class for EBSDAvgData.
unsigned int _feature_id
EBSD grain, symmetry, and phase data.
virtual Real operator()(const EBSDAvgData &a)
virtual Real operator()(const EBSDAvgData &a)
virtual Real operator()(const EBSDAvgData &a)
Euler angle triplet.
Definition: EulerAngles.h:20
virtual Real operator()(const EBSDPointData &d)
virtual Real operator()(const EBSDAvgData &a)
virtual Real operator()(const EBSDPointData &d)
virtual Real operator()(const EBSDAvgData &a)
static MooseEnum getPointDataFieldType()
Access functor base class for EBSDPointData.
unsigned int _n
Number of EBSD data points in the global grain.
virtual Real operator()(const EBSDAvgData &a)