www.mooseframework.org
EBSDReader.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 "EulerAngleProvider.h"
13 #include "EBSDAccessFunctors.h"
14 
32 {
33 public:
35 
36  EBSDReader(const InputParameters & params);
37  virtual ~EBSDReader();
38 
39  virtual void readFile();
40 
41  virtual void initialize() {}
42  virtual void execute() {}
43  virtual void finalize() {}
44 
48  const EBSDPointData & getData(const Point & p) const;
49 
53  const EBSDAvgData & getAvgData(unsigned int i) const;
54 
58  const EBSDAvgData & getAvgData(unsigned int phase, unsigned int local_id) const;
59 
63  virtual const EulerAngles & getEulerAngles(unsigned int) const;
64 
68  virtual unsigned int getGrainNum() const;
69 
73  virtual unsigned int getPhaseNum() const { return _global_id.size(); }
74 
78  virtual unsigned int getGrainNum(unsigned int phase) const;
79 
81  unsigned int getFeatureID(unsigned int phase, unsigned int local_id) const
82  {
83  return _avg_data[_global_id[phase][local_id]]._feature_id;
84  }
86  unsigned int getFeatureID(unsigned int global_id) const
87  {
88  return _avg_data[global_id]._feature_id;
89  }
90 
92  virtual unsigned int getGlobalID(unsigned int phase, unsigned int local_id) const
93  {
94  return _global_id[phase][local_id];
95  }
97  virtual unsigned int getGlobalID(unsigned int feature_id) const;
98 
100  MooseSharedPointer<EBSDPointDataFunctor>
101  getPointDataAccessFunctor(const MooseEnum & field_name) const;
103  MooseSharedPointer<EBSDAvgDataFunctor>
104  getAvgDataAccessFunctor(const MooseEnum & field_name) const;
105 
110  const std::map<dof_id_type, std::vector<Real>> & getNodeToGrainWeightMap() const;
111 
116  const std::map<dof_id_type, std::vector<Real>> & getNodeToPhaseWeightMap() const;
117 
119  void meshChanged();
120 
121 protected:
126 
128  unsigned int _grain_num;
130  Point _top_right;
131  Point _range;
133 
135  unsigned int _custom_columns;
136 
138  std::vector<EBSDPointData> _data;
139 
141  std::vector<EBSDAvgData> _avg_data;
142 
144  std::vector<EulerAngles> _avg_angles;
145 
147  std::map<unsigned int, unsigned int> _global_id_map;
148 
150  std::vector<std::vector<unsigned int>> _global_id;
151 
153  std::map<dof_id_type, std::vector<Real>> _node_to_grain_weight_map;
154 
156  std::map<dof_id_type, std::vector<Real>> _node_to_phase_weight_map;
157 
159  const int & _time_step;
160 
162  unsigned int _mesh_dimension;
163 
165  unsigned int _bins;
166 
168  unsigned int _L_norm;
169 
171  unsigned _nx, _ny, _nz;
172 
175 
178 
181 
183  unsigned indexFromPoint(const Point & p) const;
184 
186  unsigned indexFromIndex(unsigned int var) const;
187 
189  void buildNodeWeightMaps();
190 };
Point _bottom_left
Definition: EBSDReader.h:129
const EBSDAvgData & getAvgData(unsigned int i) const
Get the requested type of average data for (global) grain number i.
Definition: EBSDReader.C:356
unsigned indexFromPoint(const Point &p) const
Computes a global index in the _data array given an input centroid point.
Definition: EBSDReader.C:386
std::map< dof_id_type, std::vector< Real > > _node_to_phase_weight_map
Map of phase weights per node.
Definition: EBSDReader.h:156
unsigned int _custom_columns
number of additional custom data columns
Definition: EBSDReader.h:135
Real _minx
Grid origin.
Definition: EBSDReader.h:177
Point _range
Definition: EBSDReader.h:131
Real _maxx
Maximum grid extent.
Definition: EBSDReader.h:180
unsigned _nz
Definition: EBSDReader.h:171
MooseSharedPointer< EBSDPointDataFunctor > getPointDataAccessFunctor(const MooseEnum &field_name) const
Factory function to return a point functor specified by name.
Definition: EBSDReader.C:515
Real _miny
Definition: EBSDReader.h:177
unsigned int getFeatureID(unsigned int global_id) const
Return the EBSD feature id for a given (global) grain number.
Definition: EBSDReader.h:86
unsigned int _grain_num
Variables needed to determine reduced order parameter values.
Definition: EBSDReader.h:128
unsigned int _L_norm
L_norm value for averaging.
Definition: EBSDReader.h:168
unsigned _nx
The number of values in the x, y and z directions.
Definition: EBSDReader.h:171
const EBSDPointData & getData(const Point &p) const
Get the requested type of data at the point p.
Definition: EBSDReader.C:350
virtual void execute()
Definition: EBSDReader.h:42
MooseMesh & _mesh
MooseMesh Variables.
Definition: EBSDReader.h:123
Real _minz
Definition: EBSDReader.h:177
unsigned int getFeatureID(unsigned int phase, unsigned int local_id) const
Return the EBSD feature id for a given phase and phase (local) grain number.
Definition: EBSDReader.h:81
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:437
Mix-in class that adds so called access functors to select a field from an EBSDPointData or EBSDPoint...
std::map< unsigned int, unsigned int > _global_id_map
map from feature_id to global_id
Definition: EBSDReader.h:147
virtual const EulerAngles & getEulerAngles(unsigned int) const
EulerAngleProvider interface implementation to fetch a triplet of Euler angles.
Definition: EBSDReader.C:362
const int & _time_step
current timestep. Maps are only rebuild on mesh change during time step zero
Definition: EBSDReader.h:159
A GeneralUserObject that reads an EBSD file and stores the centroid data in a data structure which in...
Definition: EBSDReader.h:31
unsigned _ny
Definition: EBSDReader.h:171
Real _dx
The spacing of the values in x, y and z directions.
Definition: EBSDReader.h:174
unsigned int _mesh_dimension
Dimension of the problem domain.
Definition: EBSDReader.h:162
virtual unsigned int getGrainNum() const
Return the total number of grains.
Definition: EBSDReader.C:374
EBSDReader(const InputParameters &params)
Definition: EBSDReader.C:40
std::vector< EBSDAvgData > _avg_data
Averages by (global) grain ID.
Definition: EBSDReader.h:141
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned indexFromIndex(unsigned int var) const
Transfer the index into the _avg_data array from given index.
Definition: EBSDReader.C:420
Point _top_right
Definition: EBSDReader.h:130
Real _maxz
Definition: EBSDReader.h:180
std::map< dof_id_type, std::vector< Real > > _node_to_grain_weight_map
Map of grain weights per node.
Definition: EBSDReader.h:153
unsigned int _bins
number of bins for each quaternion component
Definition: EBSDReader.h:165
Euler angle triplet.
Definition: EulerAngles.h:24
virtual ~EBSDReader()
Definition: EBSDReader.C:347
NonlinearSystemBase & _nl
Definition: EBSDReader.h:124
Real _maxy
Definition: EBSDReader.h:180
Abstract base class for user objects that implement the Euler Angle provider interface.
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:443
static InputParameters validParams()
Definition: EBSDReader.C:25
std::vector< EulerAngles > _avg_angles
Euler Angles by (global) grain ID.
Definition: EBSDReader.h:144
void buildNodeWeightMaps()
Build grain and phase weight maps.
Definition: EBSDReader.C:466
virtual unsigned int getPhaseNum() const
Return the total number of phases.
Definition: EBSDReader.h:73
MooseSharedPointer< EBSDAvgDataFunctor > getAvgDataAccessFunctor(const MooseEnum &field_name) const
Factory function to return a average functor specified by name.
Definition: EBSDReader.C:561
void meshChanged()
Maps need to be updated when the mesh changes.
Definition: EBSDReader.C:458
virtual void readFile()
Definition: EBSDReader.C:64
std::vector< std::vector< unsigned int > > _global_id
global ID for given phases and grains
Definition: EBSDReader.h:150
std::vector< EBSDPointData > _data
Logically three-dimensional data indexed by geometric points in a 1D vector.
Definition: EBSDReader.h:138
virtual void initialize()
Definition: EBSDReader.h:41
virtual void finalize()
Definition: EBSDReader.h:43
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:92