www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EulerAngleProvider2RGBAux Class Reference

Output euler angles from user object to an AuxVariable. More...

#include <EulerAngleProvider2RGBAux.h>

Inheritance diagram for EulerAngleProvider2RGBAux:
[legend]

Public Member Functions

 EulerAngleProvider2RGBAux (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeValue ()
 
virtual void precalculateValue ()
 

Protected Attributes

const unsigned int _sd
 Reference direction of the sample. More...
 
const unsigned int _xtal_class
 Crystal structure of the sample. More...
 
const unsigned int _output_type
 Type of value to be outputted. More...
 
const EulerAngleProvider_euler
 Object providing the Euler angles. More...
 
const GrainTracker_grain_tracker
 Grain tracker object. More...
 
Real _value
 precalculated element value More...
 
const Point _no_grain_color
 Vector containing values for color in regions without grains. More...
 

Detailed Description

Output euler angles from user object to an AuxVariable.

Definition at line 25 of file EulerAngleProvider2RGBAux.h.

Constructor & Destructor Documentation

EulerAngleProvider2RGBAux::EulerAngleProvider2RGBAux ( const InputParameters &  parameters)

Definition at line 39 of file EulerAngleProvider2RGBAux.C.

40  : AuxKernel(parameters),
41  _sd(getParam<MooseEnum>("sd")),
42  _xtal_class(getParam<MooseEnum>("crystal_structure")),
43  _output_type(getParam<MooseEnum>("output_type")),
44  _euler(getUserObject<EulerAngleProvider>("euler_angle_provider")),
45  _grain_tracker(getUserObject<GrainTracker>("grain_tracker")),
46  _no_grain_color(getParam<Point>("no_grain_color"))
47 {
48 }
const unsigned int _sd
Reference direction of the sample.
const unsigned int _xtal_class
Crystal structure of the sample.
const unsigned int _output_type
Type of value to be outputted.
const Point _no_grain_color
Vector containing values for color in regions without grains.
const EulerAngleProvider & _euler
Object providing the Euler angles.
const GrainTracker & _grain_tracker
Grain tracker object.

Member Function Documentation

Real EulerAngleProvider2RGBAux::computeValue ( )
protectedvirtual

Definition at line 91 of file EulerAngleProvider2RGBAux.C.

92 {
93  return _value;
94 }
Real _value
precalculated element value
void EulerAngleProvider2RGBAux::precalculateValue ( )
protectedvirtual

Definition at line 51 of file EulerAngleProvider2RGBAux.C.

52 {
53  // ID of unique grain at current point
54  const Real grain_id =
55  _grain_tracker.getEntityValue((isNodal() ? _current_node->id() : _current_elem->id()),
57  0);
58 
59  // Recover Euler angles for current grain and assign correct
60  // RGB value either from euler2RGB or from _no_grain_color
61  Point RGB;
62  if (grain_id >= 0 && grain_id < _euler.getGrainNum())
63  {
64  const RealVectorValue & angles = _euler.getEulerAngles(grain_id);
65  RGB = euler2RGB(_sd,
66  angles(0) / 180.0 * libMesh::pi,
67  angles(1) / 180.0 * libMesh::pi,
68  angles(2) / 180.0 * libMesh::pi,
69  1.0,
70  _xtal_class);
71  }
72  else
73  RGB = _no_grain_color;
74 
75  // Create correct scalar output
76  if (_output_type < 3)
77  _value = RGB(_output_type);
78  else if (_output_type == 3)
79  {
80  Real RGBint = 0.0;
81  for (unsigned int i = 0; i < 3; ++i)
82  RGBint = 256 * RGBint + (RGB(i) >= 1 ? 255 : std::floor(RGB(i) * 256.0));
83 
84  _value = RGBint;
85  }
86  else
87  mooseError("Incorrect value for output_type in EulerAngleProvider2RGBAux");
88 }
const unsigned int _sd
Reference direction of the sample.
Point euler2RGB(unsigned int sd, Real phi1, Real PHI, Real phi2, unsigned int phase, unsigned int sym)
This function rotates a set of three Bunge Euler angles into the standard Stereographic triangle...
Definition: Euler2RGB.C:43
virtual unsigned int getGrainNum() const =0
const unsigned int _xtal_class
Crystal structure of the sample.
const unsigned int _output_type
Type of value to be outputted.
const Point _no_grain_color
Vector containing values for color in regions without grains.
const EulerAngleProvider & _euler
Object providing the Euler angles.
Real _value
precalculated element value
virtual Real getEntityValue(dof_id_type node_id, FieldType field_type, std::size_t var_index=0) const override
Definition: GrainTracker.C:84
const GrainTracker & _grain_tracker
Grain tracker object.
virtual const EulerAngles & getEulerAngles(unsigned int) const =0

Member Data Documentation

const EulerAngleProvider& EulerAngleProvider2RGBAux::_euler
protected

Object providing the Euler angles.

Definition at line 44 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

const GrainTracker& EulerAngleProvider2RGBAux::_grain_tracker
protected

Grain tracker object.

Definition at line 47 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

const Point EulerAngleProvider2RGBAux::_no_grain_color
protected

Vector containing values for color in regions without grains.

Definition at line 53 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

const unsigned int EulerAngleProvider2RGBAux::_output_type
protected

Type of value to be outputted.

Definition at line 41 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

const unsigned int EulerAngleProvider2RGBAux::_sd
protected

Reference direction of the sample.

Definition at line 35 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

Real EulerAngleProvider2RGBAux::_value
protected

precalculated element value

Definition at line 50 of file EulerAngleProvider2RGBAux.h.

Referenced by computeValue(), and precalculateValue().

const unsigned int EulerAngleProvider2RGBAux::_xtal_class
protected

Crystal structure of the sample.

Definition at line 38 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().


The documentation for this class was generated from the following files: