https://mooseframework.inl.gov
Loading...
Searching...
No Matches
EulerAngleVariables2RGBAux.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
17{
19 params.addClassDescription("Outputs one color or a scalar for the RGB-encoding of the local "
20 "Euler angles for the grain orientation");
21 MooseEnum sd_enum = MooseEnum("100=1 010=2 001=3", "001");
22 params.addParam<MooseEnum>("sd", sd_enum, "Reference sample direction");
23 MooseEnum output_types = MooseEnum("red green blue scalar", "scalar");
24 params.addParam<MooseEnum>("output_type", output_types, "Type of value that will be outputted");
25 params.addCoupledVar("phi1", "Euler angle 1");
26 params.addCoupledVar("phi", "Euler angle 2");
27 params.addCoupledVar("phi2", "Euler angle 3");
28 params.addCoupledVar("phase", "Grain phase index");
29 params.addCoupledVar("symmetry", "Grain symmetry identifier");
30 return params;
31}
32
34 : AuxKernel(parameters),
35 _sd(getParam<MooseEnum>("sd")),
36 _output_type(getParam<MooseEnum>("output_type")),
37 _phi1(coupledValue("phi1")),
38 _phi(coupledValue("phi")),
39 _phi2(coupledValue("phi2")),
40 _phase(coupledValue("phase")),
41 _sym(coupledValue("symmetry"))
42{
43}
44
45Real
47{
48 // Call Euler2RGB Function to get RGB vector
49 Point RGB = euler2RGB(_sd,
50 _phi1[0] / 180.0 * libMesh::pi,
51 _phi[0] / 180.0 * libMesh::pi,
52 _phi2[0] / 180.0 * libMesh::pi,
53 _phase[0],
54 _sym[0]);
55
56 // Create correct scalar output
57 if (_output_type < 3)
58 return RGB(_output_type);
59 else if (_output_type == 3)
60 {
61 Real RGBint = 0.0;
62 for (unsigned int i = 0; i < 3; ++i)
63 RGBint = 256 * RGBint + (RGB(i) >= 1 ? 255 : std::floor(RGB(i) * 256.0));
64
65 return RGBint;
66 }
67 else
68 mooseError("Incorrect value for output_type in EulerAngleVariables2RGBAux");
69}
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
registerMooseObject("PhaseFieldApp", EulerAngleVariables2RGBAux)
static InputParameters validParams()
Create an encoded RGB triplet from Euler angle data.
EulerAngleVariables2RGBAux(const InputParameters &parameters)
const unsigned int _output_type
Type of value to be outputted.
const VariableValue & _phi1
Euler angles to visualize.
static InputParameters validParams()
const unsigned int _sd
Reference direction of the sample.
const VariableValue & _phase
EBSD Phase index.
const VariableValue & _sym
EBSD Crystal symmetry identifier.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void mooseError(Args &&... args) const
const Real pi