www.mooseframework.org
EBSDReader.C
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 #include "EBSDReader.h"
11 #include "EBSDMesh.h"
12 #include "MooseMesh.h"
13 #include "Conversion.h"
14 #include "NonlinearSystem.h"
15 #include <Eigen/Dense>
16 
17 #include <fstream>
18 
19 registerMooseObject("PhaseFieldApp", EBSDReader);
20 
21 template <>
22 InputParameters
24 {
25  InputParameters params = validParams<EulerAngleProvider>();
26  params.addClassDescription("Load and manage DREAM.3D EBSD data files for running simulations on "
27  "reconstructed microstructures.");
28  params.addParam<unsigned int>(
29  "custom_columns", 0, "Number of additional custom data columns to read from the EBSD file");
30  params.addParam<unsigned int>("bins", 20, "Number of bins to segregate quaternions");
31  params.addParam<Real>("L_norm", 1, "Specifies the type of average the user intends to perform");
32  return params;
33 }
34 
35 EBSDReader::EBSDReader(const InputParameters & params)
36  : EulerAngleProvider(params),
37  _mesh(_fe_problem.mesh()),
38  _nl(_fe_problem.getNonlinearSystemBase()),
39  _grain_num(0),
40  _custom_columns(getParam<unsigned int>("custom_columns")),
41  _time_step(_fe_problem.timeStep()),
42  _mesh_dimension(_mesh.dimension()),
43  _bins(getParam<unsigned int>("bins")),
44  _L_norm(getParam<Real>("L_norm")),
45  _nx(0),
46  _ny(0),
47  _nz(0),
48  _dx(0.),
49  _dy(0.),
50  _dz(0.)
51 {
52  readFile();
53  // throws an error for zero bins
54  if (_bins == 0)
55  mooseError("One cannot have zero bins");
56 }
57 
58 void
60 {
61  // No need to re-read data upon recovery
62  if (_app.isRecovering())
63  return;
64 
65  // Fetch and check mesh
66  EBSDMesh * mesh = dynamic_cast<EBSDMesh *>(&_mesh);
67  if (mesh == NULL)
68  mooseError("Please use an EBSDMesh in your simulation.");
69  std::ifstream stream_in(mesh->getEBSDFilename().c_str());
70  if (!stream_in)
71  mooseError("Can't open EBSD file: ", mesh->getEBSDFilename());
72 
73  const EBSDMesh::EBSDMeshGeometry & g = mesh->getEBSDGeometry();
74  // Copy file header data from the EBSDMesh
75  _dx = g.d[0];
76  _nx = g.n[0];
77  _minx = g.min[0];
78  _maxx = _minx + _dx * _nx;
79 
80  _dy = g.d[1];
81  _ny = g.n[1];
82  _miny = g.min[1];
83  _maxy = _miny + _dy * _ny;
84 
85  _dz = g.d[2];
86  _nz = g.n[2];
87  _minz = g.min[2];
88  _maxz = _minz + _dz * _nz;
89 
90  // Resize the _data array
91  unsigned total_size = g.dim < 3 ? _nx * _ny : _nx * _ny * _nz;
92  _data.resize(total_size);
93 
94  std::string line;
95  while (std::getline(stream_in, line))
96  {
97  if (line.find("#") != 0)
98  {
99  // Temporary variables to read in on each line
100  EBSDPointData d;
101  Real x, y, z;
102 
103  std::istringstream iss(line);
104  iss >> d._phi1 >> d._Phi >> d._phi2 >> x >> y >> z >> d._feature_id >> d._phase >>
105  d._symmetry;
106 
107  // Transform angles to degrees
108  d._phi1 *= 180.0 / libMesh::pi;
109  d._Phi *= 180.0 / libMesh::pi;
110  d._phi2 *= 180.0 / libMesh::pi;
111 
112  // Custom columns
113  d._custom.resize(_custom_columns);
114  for (unsigned int i = 0; i < _custom_columns; ++i)
115  if (!(iss >> d._custom[i]))
116  mooseError("Unable to read in EBSD custom data column #", i);
117 
118  if (x < _minx || y < _miny || x > _maxx || y > _maxy ||
119  (g.dim == 3 && (z < _minz || z > _maxz)))
120  mooseError("EBSD Data ouside of the domain declared in the header ([",
121  _minx,
122  ':',
123  _maxx,
124  "], [",
125  _miny,
126  ':',
127  _maxy,
128  "], [",
129  _minz,
130  ':',
131  _maxz,
132  "]) dim=",
133  g.dim,
134  "\n",
135  line);
136 
137  d._p = Point(x, y, z);
138 
139  // determine number of grains in the dataset
140  if (_global_id_map.find(d._feature_id) == _global_id_map.end())
141  _global_id_map[d._feature_id] = _grain_num++;
142 
143  unsigned int global_index = indexFromPoint(Point(x, y, z));
144  _data[global_index] = d;
145  }
146  }
147  stream_in.close();
148 
149  // Resize the variables
150  _avg_data.resize(_grain_num);
151  _avg_angles.resize(_grain_num);
152 
153  // clear the averages
154  for (unsigned int i = 0; i < _grain_num; ++i)
155  {
156  EBSDAvgData & a = _avg_data[i];
157  a._symmetry = a._phase = a._n = 0;
158  a._p = 0.0;
159  a._custom.assign(_custom_columns, 0.0);
160 
161  EulerAngles & b = _avg_angles[i];
162  b.phi1 = b.Phi = b.phi2 = 0.0;
163  }
164 
165  // Array of vectors to store quaternions of each grain
166  std::vector<std::vector<Eigen::Quaternion<Real>>> quat(_grain_num);
167 
168  // Iterate through data points to store orientation information for each grain
169  for (auto & j : _data)
170  {
171  EBSDAvgData & a = _avg_data[_global_id_map[j._feature_id]];
172  EulerAngles angles;
173 
174  angles.phi1 = j._phi1;
175  angles.Phi = j._Phi;
176  angles.phi2 = j._phi2;
177 
178  // convert Euler angles to quaternions
179  Eigen::Quaternion<Real> q = angles.toQuaternion();
180 
181  quat[_global_id_map[j._feature_id]].push_back(q);
182 
183  if (a._n == 0)
184  a._phase = j._phase;
185  else if (a._phase != j._phase)
186  mooseError("An EBSD feature needs to have a uniform phase.");
187 
188  if (a._n == 0)
189  a._symmetry = j._symmetry;
190  else if (a._symmetry != j._symmetry)
191  mooseError("An EBSD feature needs to have a uniform symmetry parameter.");
192 
193  for (unsigned int i = 0; i < _custom_columns; ++i)
194  a._custom[i] += j._custom[i];
195 
196  // store the feature (or grain) ID
197  a._feature_id = j._feature_id;
198 
199  a._p += j._p;
200  a._n++;
201  }
202  // creating a vector of maps to store the quaternion count for each bin index
203  std::vector<
204  std::map<std::tuple<unsigned int, unsigned int, unsigned int, unsigned int>, unsigned int>>
205  feature_weights(_grain_num);
206  // creating a vector of vectors to store the bin index corresponding to a quaternion
207  std::vector<std::vector<std::tuple<unsigned int, unsigned int, unsigned int, unsigned int>>>
208  quat_to_bin(_grain_num);
209 
210  for (unsigned int i = 0; i < _grain_num; i++)
211  {
212  EBSDAvgData & a = _avg_data[i];
213  EulerAngles & b = _avg_angles[i];
214 
215  if (a._n == 0)
216  continue;
217 
218  Real w_index, x_index, y_index, z_index;
219  Real w, x, y, z;
220  std::vector<std::tuple<double, Eigen::VectorXd>> eigen_vectors_and_values;
221 
222  // creating an empty map
223  feature_weights.push_back(
224  std::map<std::tuple<unsigned int, unsigned int, unsigned int, unsigned int>,
225  unsigned int>());
226 
227  // looping through quaternions of each grain
228  for (unsigned int k = 0; k < quat[i].size(); k++)
229  {
230  std::tuple<unsigned int, unsigned int, unsigned int, unsigned int> bin;
231  w_index = int((quat[i][k].w() + 1) * 0.5 * _bins);
232  x_index = int((quat[i][k].x() + 1) * 0.5 * _bins);
233  y_index = int((quat[i][k].y() + 1) * 0.5 * _bins);
234  z_index = int((quat[i][k].z() + 1) * 0.5 * _bins);
235 
236  bin = std::make_tuple(w_index, x_index, y_index, z_index);
237 
238  // storing the bincorresponding to the quaternion quat[i][k]
239  quat_to_bin[i].push_back(bin);
240 
241  // storing the bin name and its corresponding size value
242  auto j = feature_weights[i].find(bin);
243  if (j == feature_weights[i].end())
244  feature_weights[i].emplace_hint(j, bin, 1);
245  else
246  j->second++;
247  }
248 
258  // creating a quaternion matrix
259  Eigen::MatrixXd quat_mat(4, quat[i].size());
260  // creating the weight matrix
261  Eigen::MatrixXd weight = Eigen::MatrixXd::Identity(quat[i].size(), quat[i].size());
262 
263  unsigned int bin_size;
264  bool data_quality_ok = false;
265  Real total_weight = 0.0;
266 
267  for (unsigned int j = 0; j < quat[i].size(); j++)
268  {
269  bin_size = feature_weights[i][quat_to_bin[i][j]];
270  w = quat[i][j].w();
271  x = quat[i][j].x();
272  y = quat[i][j].y();
273  z = quat[i][j].z();
274 
275  // instantiating columns of the matrix
276  quat_mat.col(j) << w, x, y, z;
277  // assigning weights to each quaternion
278  weight(j, j) = std::pow(bin_size, _L_norm);
279  total_weight += weight(j, j);
285  if (bin_size / quat[i].size() > 0.5)
286  data_quality_ok = true;
287  }
288 
289  weight = weight / total_weight;
290 
291  // throws a warning if EBSD data is not reliable
292  if (!data_quality_ok)
293  _console << COLOR_YELLOW << "EBSD data may not be reliable"
294  << "\n"
295  << COLOR_DEFAULT;
296 
297  // compute eigen values and eigen vectors
298  Eigen::EigenSolver<Eigen::MatrixXd> EigenSolver(quat_mat * weight * quat_mat.transpose());
299  Eigen::VectorXd eigen_values = EigenSolver.eigenvalues().real();
300  Eigen::MatrixXd eigen_vectors = EigenSolver.eigenvectors().real();
301 
302  // creating a tuple of eigen values and eigen vectors
303  for (unsigned int i = 0; i < eigen_values.size(); i++)
304  {
305  std::tuple<double, Eigen::VectorXd> vec_and_val(eigen_values[i], eigen_vectors.col(i));
306  eigen_vectors_and_values.push_back(vec_and_val);
307  }
308  // Sorting the eigen values and vectors in ascending order of eigen values
309  auto j = std::max_element(eigen_vectors_and_values.begin(),
310  eigen_vectors_and_values.end(),
311  [&](const std::tuple<double, Eigen::VectorXd> & a,
312  const std::tuple<double, Eigen::VectorXd> & b) -> bool {
313  return std::get<0>(a) < std::get<0>(b);
314  });
315  // Selecting eigen vector corresponding to max eigen value to compute average euler angle
316  Eigen::Quaternion<Real> q(
317  std::get<1>(*j)(0), std::get<1>(*j)(1), std::get<1>(*j)(2), std::get<1>(*j)(3));
318 
319  b = EulerAngles(q);
320 
321  // link the EulerAngles into the EBSDAvgData for access via the functors
322  a._angles = &b;
323 
324  if (a._phase >= _global_id.size())
325  _global_id.resize(a._phase + 1);
326 
327  // The averaged per grain data locally contains the phase id, local id, and
328  // original feature id. It is stored contiguously indexed by global id.
329  a._local_id = _global_id[a._phase].size();
330  _global_id[a._phase].push_back(i);
331 
332  a._p *= 1.0 / Real(a._n);
333 
334  for (unsigned int i = 0; i < _custom_columns; ++i)
335  a._custom[i] /= Real(a._n);
336  }
337  // Build maps to indicate the weights with which grain and phase data
338  // from the surrounding elements contributes to a node fo IC purposes
340 }
341 
343 
345 EBSDReader::getData(const Point & p) const
346 {
347  return _data[indexFromPoint(p)];
348 }
349 
351 EBSDReader::getAvgData(unsigned int var) const
352 {
353  return _avg_data[indexFromIndex(var)];
354 }
355 
356 const EulerAngles &
357 EBSDReader::getEulerAngles(unsigned int var) const
358 {
359  return _avg_angles[indexFromIndex(var)];
360 }
361 
363 EBSDReader::getAvgData(unsigned int phase, unsigned int local_id) const
364 {
365  return _avg_data[indexFromIndex(_global_id[phase][local_id])];
366 }
367 
368 unsigned int
370 {
371  return _grain_num;
372 }
373 
374 unsigned int
375 EBSDReader::getGrainNum(unsigned int phase) const
376 {
377  return _global_id[phase].size();
378 }
379 
380 unsigned int
381 EBSDReader::indexFromPoint(const Point & p) const
382 {
383  // Don't assume an ordering on the input data, use the (x, y,
384  // z) values of this centroid to determine the index.
385  unsigned int x_index, y_index, z_index, global_index;
386 
387  x_index = (unsigned int)((p(0) - _minx) / _dx);
388  y_index = (unsigned int)((p(1) - _miny) / _dy);
389  if (p(0) <= _minx || p(0) >= _maxx || p(1) <= _miny || p(1) >= _maxy)
390  mooseError("Data points must be on the interior of the mesh elements. In EBSDReader ", name());
391 
392  if (_mesh_dimension == 3)
393  {
394  z_index = (unsigned int)((p(2) - _minz) / _dz);
395  global_index = z_index * _ny;
396  if (p(2) <= _minz || p(2) >= _maxz)
397  mooseError("Data points must be on the interior of the mesh elements. In EBSDReader ",
398  name());
399  }
400  else
401  global_index = 0;
402 
403  // Compute the global index into the _data array. This stores points
404  // in a [z][y][x] ordering.
405  global_index = (global_index + y_index) * _nx + x_index;
406 
407  // Don't access out of range!
408  mooseAssert(global_index < _data.size(),
409  "global_index " << global_index << " points out of _data range: " << _data.size());
410 
411  return global_index;
412 }
413 
414 unsigned int
415 EBSDReader::indexFromIndex(unsigned int var) const
416 {
417 
418  // Transfer the index into the _avg_data array.
419  unsigned avg_index = var;
420 
421  // Don't access out of range!
422  if (avg_index >= _avg_data.size())
423  mooseError("Error! Index out of range in EBSDReader::indexFromIndex(), index: ",
424  avg_index,
425  " size: ",
426  _avg_data.size());
427 
428  return avg_index;
429 }
430 
431 const std::map<dof_id_type, std::vector<Real>> &
433 {
435 }
436 
437 const std::map<dof_id_type, std::vector<Real>> &
439 {
441 }
442 
443 unsigned int
444 EBSDReader::getGlobalID(unsigned int feature_id) const
445 {
446  auto it = _global_id_map.find(feature_id);
447  if (it == _global_id_map.end())
448  mooseError("Invalid Feature ID");
449  return it->second;
450 }
451 
452 void
454 {
455  // maps are only rebuild for use in initial conditions, which happens in time step zero
456  if (_time_step == 0)
458 }
459 
460 void
462 {
463  // Import nodeToElemMap from MooseMesh for current node
464  // This map consists of the node index followed by a vector of element indices that are associated
465  // with that node
466  const std::map<dof_id_type, std::vector<dof_id_type>> & node_to_elem_map =
467  _mesh.nodeToActiveSemilocalElemMap();
468  libMesh::MeshBase & mesh = _mesh.getMesh();
469 
470  // Loop through each node in mesh and calculate eta values for each grain associated with the node
471  for (const auto & node : as_range(mesh.active_nodes_begin(), mesh.active_nodes_end()))
472  {
473  // Get node_id
474  const dof_id_type node_id = node->id();
475 
476  // Initialize map entries for current node
477  _node_to_grain_weight_map[node_id].assign(getGrainNum(), 0.0);
478  _node_to_phase_weight_map[node_id].assign(getPhaseNum(), 0.0);
479 
480  // Loop through element indices associated with the current node and record weighted eta value
481  // in new map
482  const auto & node_to_elem_pair = node_to_elem_map.find(node_id);
483  if (node_to_elem_pair != node_to_elem_map.end())
484  {
485  unsigned int n_elems =
486  node_to_elem_pair->second
487  .size(); // n_elems can range from 1 to 4 for 2D and 1 to 8 for 3D problems
488 
489  for (unsigned int ne = 0; ne < n_elems; ++ne)
490  {
491  // Current element index
492  unsigned int elem_id = (node_to_elem_pair->second)[ne];
493 
494  // Retrieve EBSD grain number for the current element index
495  const Elem * elem = mesh.elem_ptr(elem_id);
496  const EBSDReader::EBSDPointData & d = getData(elem->centroid());
497 
498  // get the (global) grain ID for the EBSD feature ID
499  const unsigned int global_id = getGlobalID(d._feature_id);
500 
501  // Calculate eta value and add to map
502  _node_to_grain_weight_map[node_id][global_id] += 1.0 / n_elems;
503  _node_to_phase_weight_map[node_id][d._phase] += 1.0 / n_elems;
504  }
505  }
506  }
507 }
508 
509 MooseSharedPointer<EBSDAccessFunctors::EBSDPointDataFunctor>
510 EBSDReader::getPointDataAccessFunctor(const MooseEnum & field_name) const
511 {
512  EBSDPointDataFunctor * ret_val = NULL;
513 
514  switch (field_name)
515  {
516  case 0: // phi1
517  ret_val = new EBSDPointDataPhi1();
518  break;
519  case 1: // phi
520  ret_val = new EBSDPointDataPhi();
521  break;
522  case 2: // phi2
523  ret_val = new EBSDPointDataPhi2();
524  break;
525  case 3: // grain
526  ret_val = new EBSDPointDataFeatureID();
527  break;
528  case 4: // phase
529  ret_val = new EBSDPointDataPhase();
530  break;
531  case 5: // symmetry
532  ret_val = new EBSDPointDataSymmetry();
533  break;
534  default:
535  {
536  // check for custom columns
537  for (unsigned int i = 0; i < _custom_columns; ++i)
538  if (field_name == "CUSTOM" + Moose::stringify(i))
539  {
540  ret_val = new EBSDPointDataCustom(i);
541  break;
542  }
543  }
544  }
545 
546  // If ret_val was not set by any of the above cases, throw an error.
547  if (!ret_val)
548  mooseError("Error: Please input supported EBSD_param");
549 
550  // If we made it here, wrap up the the ret_val in a
551  // MooseSharedPointer and ship it off.
552  return MooseSharedPointer<EBSDPointDataFunctor>(ret_val);
553 }
554 
555 MooseSharedPointer<EBSDAccessFunctors::EBSDAvgDataFunctor>
556 EBSDReader::getAvgDataAccessFunctor(const MooseEnum & field_name) const
557 {
558  EBSDAvgDataFunctor * ret_val = NULL;
559 
560  switch (field_name)
561  {
562  case 0: // phi1
563  ret_val = new EBSDAvgDataPhi1();
564  break;
565  case 1: // phi
566  ret_val = new EBSDAvgDataPhi();
567  break;
568  case 2: // phi2
569  ret_val = new EBSDAvgDataPhi2();
570  break;
571  case 3: // phase
572  ret_val = new EBSDAvgDataPhase();
573  break;
574  case 4: // symmetry
575  ret_val = new EBSDAvgDataSymmetry();
576  break;
577  case 5: // local_id
578  ret_val = new EBSDAvgDataLocalID();
579  break;
580  case 6: // feature_id
581  ret_val = new EBSDAvgDataFeatureID();
582  break;
583  default:
584  {
585  // check for custom columns
586  for (unsigned int i = 0; i < _custom_columns; ++i)
587  if (field_name == "CUSTOM" + Moose::stringify(i))
588  {
589  ret_val = new EBSDAvgDataCustom(i);
590  break;
591  }
592  }
593  }
594 
595  // If ret_val was not set by any of the above cases, throw an error.
596  if (!ret_val)
597  mooseError("Error: Please input supported EBSD_param");
598 
599  // If we made it here, wrap up the the ret_val in a
600  // MooseSharedPointer and ship it off.
601  return MooseSharedPointer<EBSDAvgDataFunctor>(ret_val);
602 }
EBSDAccessFunctors::EBSDAvgData::_n
unsigned int _n
Number of EBSD data points in the global grain.
Definition: EBSDAccessFunctors.h:64
EBSDReader::_bins
unsigned int _bins
number of bins for each quaternion component
Definition: EBSDReader.h:168
EBSDAccessFunctors::EBSDAvgDataSymmetry
Definition: EBSDAccessFunctors.h:143
EBSDReader::meshChanged
void meshChanged()
Maps need to be updated when the mesh changes.
Definition: EBSDReader.C:453
EBSDReader::_maxz
Real _maxz
Definition: EBSDReader.h:183
EBSDReader::_data
std::vector< EBSDPointData > _data
Logically three-dimensional data indexed by geometric points in a 1D vector.
Definition: EBSDReader.h:141
EBSDAccessFunctors::EBSDAvgDataLocalID
Definition: EBSDAccessFunctors.h:147
EBSDReader::~EBSDReader
virtual ~EBSDReader()
Definition: EBSDReader.C:342
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
EBSDAccessFunctors::EBSDAvgDataFunctor
Access functor base class for EBSDAvgData.
Definition: EBSDAccessFunctors.h:83
EulerAngles::phi1
Real phi1
Definition: EulerAngles.h:25
EBSDReader::getGlobalID
virtual unsigned int getGlobalID(unsigned int phase, unsigned int local_id) const
Return the (global) grain id for a given phase and (local) grain number.
Definition: EBSDReader.h:95
EBSDAccessFunctors::EBSDAvgData
Averaged EBSD data.
Definition: EBSDAccessFunctors.h:49
EBSDAccessFunctors::EBSDAvgData::_phase
unsigned int _phase
Definition: EBSDAccessFunctors.h:56
EulerAngles::toQuaternion
Eigen::Quaternion< Real > toQuaternion()
Definition: EulerAngles.C:44
EBSDReader::_mesh
MooseMesh & _mesh
MooseMesh Variables.
Definition: EBSDReader.h:126
EulerAngles::Phi
Real Phi
Definition: EulerAngles.h:25
EBSDReader::indexFromIndex
unsigned indexFromIndex(unsigned int var) const
Transfer the index into the _avg_data array from given index.
Definition: EBSDReader.C:415
EBSDReader::_time_step
const int & _time_step
current timestep. Maps are only rebuild on mesh change during time step zero
Definition: EBSDReader.h:162
EBSDReader::_dz
Real _dz
Definition: EBSDReader.h:177
EBSDReader::getNodeToGrainWeightMap
const std::map< dof_id_type, std::vector< Real > > & getNodeToGrainWeightMap() const
Returns a map consisting of the node index followd by a vector of all grain weights for that node.
Definition: EBSDReader.C:432
EBSDAccessFunctors::EBSDAvgData::_custom
std::vector< Real > _custom
Grain averaged custom data columns.
Definition: EBSDAccessFunctors.h:70
EBSDReader::getNodeToPhaseWeightMap
const std::map< dof_id_type, std::vector< Real > > & getNodeToPhaseWeightMap() const
Returns a map consisting of the node index followd by a vector of all phase weights for that node.
Definition: EBSDReader.C:438
EBSDReader::_node_to_grain_weight_map
std::map< dof_id_type, std::vector< Real > > _node_to_grain_weight_map
Map of grain weights per node.
Definition: EBSDReader.h:156
EBSDReader::_ny
unsigned _ny
Definition: EBSDReader.h:174
EBSDReader.h
validParams< EBSDReader >
InputParameters validParams< EBSDReader >()
Definition: EBSDReader.C:23
EBSDReader::_dy
Real _dy
Definition: EBSDReader.h:177
EBSDReader::_custom_columns
unsigned int _custom_columns
number of additional custom data columns
Definition: EBSDReader.h:138
EBSDReader::_mesh_dimension
unsigned int _mesh_dimension
Dimension of the problem domain.
Definition: EBSDReader.h:165
EBSDReader::getGrainNum
virtual unsigned int getGrainNum() const
Return the total number of grains.
Definition: EBSDReader.C:369
EBSDAccessFunctors::EBSDAvgDataCustom
Definition: EBSDAccessFunctors.h:155
registerMooseObject
registerMooseObject("PhaseFieldApp", EBSDReader)
EBSDReader::_avg_angles
std::vector< EulerAngles > _avg_angles
Euler Angles by (global) grain ID.
Definition: EBSDReader.h:147
EulerAngleProvider
Abstract base class for user objects that implement the Euler Angle provider interface.
Definition: EulerAngleProvider.h:24
EBSDReader
A GeneralUserObject that reads an EBSD file and stores the centroid data in a data structure which in...
Definition: EBSDReader.h:36
EBSDReader::_global_id
std::vector< std::vector< unsigned int > > _global_id
global ID for given phases and grains
Definition: EBSDReader.h:153
EBSDReader::_maxx
Real _maxx
Maximum grid extent.
Definition: EBSDReader.h:183
EBSDReader::_grain_num
unsigned int _grain_num
Variables needed to determine reduced order parameter values.
Definition: EBSDReader.h:131
EBSDAccessFunctors::EBSDAvgDataPhi1
Definition: EBSDAccessFunctors.h:127
validParams< EulerAngleProvider >
InputParameters validParams< EulerAngleProvider >()
EBSDMesh
Mesh generated from parameters.
Definition: EBSDMesh.h:24
EBSDReader::_minx
Real _minx
Grid origin.
Definition: EBSDReader.h:180
EBSDReader::readFile
virtual void readFile()
Definition: EBSDReader.C:59
EBSDReader::_maxy
Real _maxy
Definition: EBSDReader.h:183
EBSDAccessFunctors::EBSDPointDataPhase
Definition: EBSDAccessFunctors.h:106
EBSDReader::buildNodeWeightMaps
void buildNodeWeightMaps()
Build grain and phase weight maps.
Definition: EBSDReader.C:461
EBSDAccessFunctors::EBSDPointDataPhi
Definition: EBSDAccessFunctors.h:94
EBSDReader::getPhaseNum
virtual unsigned int getPhaseNum() const
Return the total number of phases.
Definition: EBSDReader.h:76
EBSDReader::_nz
unsigned _nz
Definition: EBSDReader.h:174
EBSDAccessFunctors::EBSDAvgDataPhase
Definition: EBSDAccessFunctors.h:139
EBSDAccessFunctors::EBSDPointDataCustom
Definition: EBSDAccessFunctors.h:114
EBSDAccessFunctors::EBSDAvgData::_p
Point _p
Center of mass for the global grain.
Definition: EBSDAccessFunctors.h:67
EBSDAccessFunctors::EBSDAvgData::_feature_id
unsigned int _feature_id
EBSD grain, symmetry, and phase data.
Definition: EBSDAccessFunctors.h:55
name
const std::string name
Definition: Setup.h:21
EBSDMesh::getEBSDFilename
const std::string & getEBSDFilename() const
Definition: EBSDMesh.h:46
EBSDAccessFunctors::EBSDPointDataFunctor
Access functor base class for EBSDPointData.
Definition: EBSDAccessFunctors.h:77
EBSDReader::_minz
Real _minz
Definition: EBSDReader.h:180
EBSDReader::_miny
Real _miny
Definition: EBSDReader.h:180
EBSDAccessFunctors::EBSDPointData::_feature_id
unsigned int _feature_id
EBSD feature id, (gklobal) grain number, symmetry, and phase data.
Definition: EBSDAccessFunctors.h:39
EBSDAccessFunctors::EBSDPointDataFeatureID
Definition: EBSDAccessFunctors.h:102
EBSDAccessFunctors::EBSDAvgDataPhi2
Definition: EBSDAccessFunctors.h:135
EBSDMesh::EBSDMeshGeometry
Definition: EBSDMesh.h:32
EBSDAccessFunctors::EBSDPointData
Per element EBSD data point.
Definition: EBSDAccessFunctors.h:27
EBSDMesh.h
EBSDReader::getEulerAngles
virtual const EulerAngles & getEulerAngles(unsigned int) const
EulerAngleProvider interface implementation to fetch a triplet of Euler angles.
Definition: EBSDReader.C:357
EBSDAccessFunctors::EBSDPointDataPhi2
Definition: EBSDAccessFunctors.h:98
EBSDReader::getAvgData
const EBSDAvgData & getAvgData(unsigned int i) const
Get the requested type of average data for (global) grain number i.
Definition: EBSDReader.C:351
EBSDReader::getAvgDataAccessFunctor
MooseSharedPointer< EBSDAvgDataFunctor > getAvgDataAccessFunctor(const MooseEnum &field_name) const
Factory function to return a average functor specified by name.
Definition: EBSDReader.C:556
EBSDAccessFunctors::EBSDAvgData::_symmetry
unsigned int _symmetry
Definition: EBSDAccessFunctors.h:57
EBSDAccessFunctors::EBSDAvgDataPhi
Definition: EBSDAccessFunctors.h:131
EBSDReader::getData
const EBSDPointData & getData(const Point &p) const
Get the requested type of data at the point p.
Definition: EBSDReader.C:345
EBSDReader::getPointDataAccessFunctor
MooseSharedPointer< EBSDPointDataFunctor > getPointDataAccessFunctor(const MooseEnum &field_name) const
Factory function to return a point functor specified by name.
Definition: EBSDReader.C:510
EBSDReader::_dx
Real _dx
The spacing of the values in x, y and z directions.
Definition: EBSDReader.h:177
EBSDReader::_nx
unsigned _nx
The number of values in the x, y and z directions.
Definition: EBSDReader.h:174
EBSDReader::_node_to_phase_weight_map
std::map< dof_id_type, std::vector< Real > > _node_to_phase_weight_map
Map of phase weights per node.
Definition: EBSDReader.h:159
EulerAngles
Euler angle triplet.
Definition: EulerAngles.h:22
EulerAngles::phi2
Real phi2
Definition: EulerAngles.h:25
EBSDAccessFunctors::EBSDPointData::_phase
unsigned int _phase
Definition: EBSDAccessFunctors.h:40
EBSDReader::indexFromPoint
unsigned indexFromPoint(const Point &p) const
Computes a global index in the _data array given an input centroid point.
Definition: EBSDReader.C:381
EBSDAccessFunctors::EBSDPointDataPhi1
Definition: EBSDAccessFunctors.h:90
EBSDReader::EBSDReader
EBSDReader(const InputParameters &params)
Definition: EBSDReader.C:35
EBSDReader::_L_norm
unsigned int _L_norm
L_norm value for averaging.
Definition: EBSDReader.h:171
EBSDReader::_avg_data
std::vector< EBSDAvgData > _avg_data
Averages by (global) grain ID.
Definition: EBSDReader.h:144
EBSDAccessFunctors::EBSDAvgDataFeatureID
Definition: EBSDAccessFunctors.h:151
EBSDMesh::getEBSDGeometry
const EBSDMeshGeometry & getEBSDGeometry() const
Definition: EBSDMesh.h:45
EBSDAccessFunctors::EBSDPointDataSymmetry
Definition: EBSDAccessFunctors.h:110
EBSDReader::_global_id_map
std::map< unsigned int, unsigned int > _global_id_map
map from feature_id to global_id
Definition: EBSDReader.h:150