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 28 of file EulerAngleProvider2RGBAux.h.

Constructor & Destructor Documentation

◆ EulerAngleProvider2RGBAux()

EulerAngleProvider2RGBAux::EulerAngleProvider2RGBAux ( const InputParameters &  parameters)

Definition at line 44 of file EulerAngleProvider2RGBAux.C.

45  : AuxKernel(parameters),
46  _sd(getParam<MooseEnum>("sd")),
47  _xtal_class(getParam<MooseEnum>("crystal_structure")),
48  _output_type(getParam<MooseEnum>("output_type")),
49  _euler(getUserObject<EulerAngleProvider>("euler_angle_provider")),
50  _grain_tracker(getUserObject<GrainTracker>("grain_tracker")),
51  _no_grain_color(getParam<Point>("no_grain_color"))
52 {
53 }
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

◆ computeValue()

Real EulerAngleProvider2RGBAux::computeValue ( )
protectedvirtual

Definition at line 96 of file EulerAngleProvider2RGBAux.C.

97 {
98  return _value;
99 }
Real _value
precalculated element value

◆ precalculateValue()

void EulerAngleProvider2RGBAux::precalculateValue ( )
protectedvirtual

Definition at line 56 of file EulerAngleProvider2RGBAux.C.

57 {
58  // ID of unique grain at current point
59  const Real grain_id =
60  _grain_tracker.getEntityValue((isNodal() ? _current_node->id() : _current_elem->id()),
62  0);
63 
64  // Recover Euler angles for current grain and assign correct
65  // RGB value either from euler2RGB or from _no_grain_color
66  Point RGB;
67  if (grain_id >= 0 && grain_id < _euler.getGrainNum())
68  {
69  const RealVectorValue & angles = _euler.getEulerAngles(grain_id);
70  RGB = euler2RGB(_sd,
71  angles(0) / 180.0 * libMesh::pi,
72  angles(1) / 180.0 * libMesh::pi,
73  angles(2) / 180.0 * libMesh::pi,
74  1.0,
75  _xtal_class);
76  }
77  else
78  RGB = _no_grain_color;
79 
80  // Create correct scalar output
81  if (_output_type < 3)
82  _value = RGB(_output_type);
83  else if (_output_type == 3)
84  {
85  Real RGBint = 0.0;
86  for (unsigned int i = 0; i < 3; ++i)
87  RGBint = 256 * RGBint + (RGB(i) >= 1 ? 255 : std::floor(RGB(i) * 256.0));
88 
89  _value = RGBint;
90  }
91  else
92  mooseError("Incorrect value for output_type in EulerAngleProvider2RGBAux");
93 }
virtual unsigned int getGrainNum() const =0
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:46
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 const EulerAngles & getEulerAngles(unsigned int) const =0
const GrainTracker & _grain_tracker
Grain tracker object.
virtual Real getEntityValue(dof_id_type node_id, FieldType field_type, std::size_t var_index=0) const override
Definition: GrainTracker.C:108

Member Data Documentation

◆ _euler

const EulerAngleProvider& EulerAngleProvider2RGBAux::_euler
protected

Object providing the Euler angles.

Definition at line 47 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

◆ _grain_tracker

const GrainTracker& EulerAngleProvider2RGBAux::_grain_tracker
protected

Grain tracker object.

Definition at line 50 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

◆ _no_grain_color

const Point EulerAngleProvider2RGBAux::_no_grain_color
protected

Vector containing values for color in regions without grains.

Definition at line 56 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

◆ _output_type

const unsigned int EulerAngleProvider2RGBAux::_output_type
protected

Type of value to be outputted.

Definition at line 44 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

◆ _sd

const unsigned int EulerAngleProvider2RGBAux::_sd
protected

Reference direction of the sample.

Definition at line 38 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().

◆ _value

Real EulerAngleProvider2RGBAux::_value
protected

precalculated element value

Definition at line 53 of file EulerAngleProvider2RGBAux.h.

Referenced by computeValue(), and precalculateValue().

◆ _xtal_class

const unsigned int EulerAngleProvider2RGBAux::_xtal_class
protected

Crystal structure of the sample.

Definition at line 41 of file EulerAngleProvider2RGBAux.h.

Referenced by precalculateValue().


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