www.mooseframework.org
EulerAngleVariables2RGBAux.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 
11 #include "Euler2RGB.h"
12 
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<AuxKernel>();
20  MooseEnum sd_enum = MooseEnum("100=1 010=2 001=3", "001");
21  params.addParam<MooseEnum>("sd", sd_enum, "Reference sample direction");
22  MooseEnum output_types = MooseEnum("red green blue scalar", "scalar");
23  params.addParam<MooseEnum>("output_type", output_types, "Type of value that will be outputted");
24  params.addCoupledVar("phi1", "Euler angle 1");
25  params.addCoupledVar("phi", "Euler angle 2");
26  params.addCoupledVar("phi2", "Euler angle 3");
27  params.addCoupledVar("phase", "Grain phase index");
28  params.addCoupledVar("symmetry", "Grain symmetry identifier");
29  return params;
30 }
31 
32 EulerAngleVariables2RGBAux::EulerAngleVariables2RGBAux(const InputParameters & parameters)
33  : AuxKernel(parameters),
34  _sd(getParam<MooseEnum>("sd")),
35  _output_type(getParam<MooseEnum>("output_type")),
36  _phi1(coupledValue("phi1")),
37  _phi(coupledValue("phi")),
38  _phi2(coupledValue("phi2")),
39  _phase(coupledValue("phase")),
40  _sym(coupledValue("symmetry"))
41 {
42 }
43 
44 Real
46 {
47  // Call Euler2RGB Function to get RGB vector
48  Point RGB = euler2RGB(_sd,
49  _phi1[0] / 180.0 * libMesh::pi,
50  _phi[0] / 180.0 * libMesh::pi,
51  _phi2[0] / 180.0 * libMesh::pi,
52  _phase[0],
53  _sym[0]);
54 
55  // Create correct scalar output
56  if (_output_type < 3)
57  return RGB(_output_type);
58  else if (_output_type == 3)
59  {
60  Real RGBint = 0.0;
61  for (unsigned int i = 0; i < 3; ++i)
62  RGBint = 256 * RGBint + (RGB(i) >= 1 ? 255 : std::floor(RGB(i) * 256.0));
63 
64  return RGBint;
65  }
66  else
67  mooseError("Incorrect value for output_type in EulerAngleVariables2RGBAux");
68 }
EulerAngleVariables2RGBAux::_output_type
const unsigned int _output_type
Type of value to be outputted.
Definition: EulerAngleVariables2RGBAux.h:37
EulerAngleVariables2RGBAux::computeValue
virtual Real computeValue()
Definition: EulerAngleVariables2RGBAux.C:45
EulerAngleVariables2RGBAux::_phi1
const VariableValue & _phi1
Euler angles to visualize.
Definition: EulerAngleVariables2RGBAux.h:40
validParams< EulerAngleVariables2RGBAux >
InputParameters validParams< EulerAngleVariables2RGBAux >()
Definition: EulerAngleVariables2RGBAux.C:17
Euler2RGB.h
EulerAngleVariables2RGBAux::_sd
const unsigned int _sd
Reference direction of the sample.
Definition: EulerAngleVariables2RGBAux.h:34
euler2RGB
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
EulerAngleVariables2RGBAux
Create an encoded RGB triplet from Euler angle data.
Definition: EulerAngleVariables2RGBAux.h:24
EulerAngleVariables2RGBAux::EulerAngleVariables2RGBAux
EulerAngleVariables2RGBAux(const InputParameters &parameters)
Definition: EulerAngleVariables2RGBAux.C:32
EulerAngleVariables2RGBAux.h
registerMooseObject
registerMooseObject("PhaseFieldApp", EulerAngleVariables2RGBAux)
EulerAngleVariables2RGBAux::_phase
const VariableValue & _phase
EBSD Phase index.
Definition: EulerAngleVariables2RGBAux.h:46
EulerAngleVariables2RGBAux::_phi
const VariableValue & _phi
Definition: EulerAngleVariables2RGBAux.h:41
EulerAngleVariables2RGBAux::_sym
const VariableValue & _sym
EBSD Crystal symmetry identifier.
Definition: EulerAngleVariables2RGBAux.h:49
EulerAngleVariables2RGBAux::_phi2
const VariableValue & _phi2
Definition: EulerAngleVariables2RGBAux.h:42