www.mooseframework.org
EBSDAccessFunctors.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "MooseEnum.h"
14 #include "EulerAngles.h"
15 
16 #include "libmesh/point.h"
17 
24 {
25 public:
28  {
30  Real _phi1;
31  Real _Phi;
32  Real _phi2;
34 
36  Point _p;
37 
39  unsigned int _feature_id;
40  unsigned int _phase;
41  unsigned int _symmetry;
43 
45  std::vector<Real> _custom;
46  };
47 
49  struct EBSDAvgData
50  {
53 
55  unsigned int _feature_id;
56  unsigned int _phase;
57  unsigned int _symmetry;
59 
61  unsigned int _local_id;
62 
64  unsigned int _n;
65 
67  Point _p;
68 
70  std::vector<Real> _custom;
71  };
72 
73  static MooseEnum getPointDataFieldType();
74  static MooseEnum getAvgDataFieldType();
75 
78  {
79  virtual Real operator()(const EBSDPointData &) = 0;
80  virtual ~EBSDPointDataFunctor(){};
81  };
84  {
85  virtual Real operator()(const EBSDAvgData &) = 0;
86  virtual ~EBSDAvgDataFunctor(){};
87  };
88 
89  // List of specialized access functors (one for each field in EBSDPointData)
91  {
92  virtual Real operator()(const EBSDPointData & d) { return d._phi1; };
93  };
95  {
96  virtual Real operator()(const EBSDPointData & d) { return d._Phi; };
97  };
99  {
100  virtual Real operator()(const EBSDPointData & d) { return d._phi2; };
101  };
103  {
104  virtual Real operator()(const EBSDPointData & d) { return d._feature_id; };
105  };
107  {
108  virtual Real operator()(const EBSDPointData & d) { return d._phase; };
109  };
111  {
112  virtual Real operator()(const EBSDPointData & d) { return d._symmetry; };
113  };
115  {
116  EBSDPointDataCustom(unsigned int index) : _index(index) {}
117  virtual Real operator()(const EBSDPointData & d)
118  {
119  mooseAssert(_index < d._custom.size(),
120  "Requesting out of bounds index in EBSDPointDataCustom.");
121  return d._custom[_index];
122  };
123  const unsigned int _index;
124  };
125 
126  // List of specialized access functors (one for each field in EBSDAvgData)
128  {
129  virtual Real operator()(const EBSDAvgData & a) { return a._angles->phi1; };
130  };
132  {
133  virtual Real operator()(const EBSDAvgData & a) { return a._angles->Phi; };
134  };
136  {
137  virtual Real operator()(const EBSDAvgData & a) { return a._angles->phi2; };
138  };
140  {
141  virtual Real operator()(const EBSDAvgData & a) { return a._phase; };
142  };
144  {
145  virtual Real operator()(const EBSDAvgData & a) { return a._symmetry; };
146  };
148  {
149  virtual Real operator()(const EBSDAvgData & a) { return a._local_id; };
150  };
152  {
153  virtual Real operator()(const EBSDAvgData & a) { return a._feature_id; };
154  };
156  {
157  EBSDAvgDataCustom(unsigned int index) : _index(index) {}
158  virtual Real operator()(const EBSDAvgData & a)
159  {
160  mooseAssert(_index < a._custom.size(),
161  "Requesting out of bounds index in EBSDPointDataCustom.");
162  return a._custom[_index];
163  };
164  const unsigned int _index;
165  };
166 };
167 
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)
virtual Real operator()(const EBSDAvgData &)=0
Point _p
Center of mass for the global grain.
std::vector< Real > _custom
Grain averaged custom data columns.
virtual Real operator()(const EBSDPointData &)=0
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:21
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)