Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
EBSDReaderAvgDataAux.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 
10 #include "EBSDReaderAvgDataAux.h"
11 #include "EBSDReader.h"
12 #include "GrainTrackerInterface.h"
13 
15 
18 {
20  params.addClassDescription("Outputs the requested EBSD reader average data, for a given phase if "
21  "specified, for the grain at the local node/element.");
22  params.addParam<unsigned int>("phase", "The phase to use for all queries.");
23  params.addRequiredParam<UserObjectName>("ebsd_reader", "The EBSDReader GeneralUserObject");
24  params.addRequiredParam<UserObjectName>("grain_tracker", "The GrainTracker UserObject");
27  "data_name",
28  field_types,
29  "The averaged data to be extracted from the EBSD data by this AuxKernel");
30  params.addParam<Real>("invalid", -1.0, "Value to return for points without active grains.");
31  return params;
32 }
33 
35  : AuxKernel(parameters),
36  _phase(isParamValid("phase") ? getParam<unsigned int>("phase") : libMesh::invalid_uint),
37  _ebsd_reader(getUserObject<EBSDReader>("ebsd_reader")),
38  _grain_tracker(dynamic_cast<const GrainTrackerInterface &>(getUserObjectBase("grain_tracker"))),
39  _data_name(getParam<MooseEnum>("data_name")),
40  _val(_ebsd_reader.getAvgDataAccessFunctor(_data_name)),
41  _invalid(getParam<Real>("invalid"))
42 {
43 }
44 
45 void
47 {
48  // get the dominant grain for the current element/node
49  const int grain_id =
52  0);
53 
54  // no grain found
55  if (grain_id < 0)
56  _value = _invalid;
57 
58  // get the data for the grain
59  else
61  : (*_val)(_ebsd_reader.getAvgData(grain_id));
62 }
63 
64 Real
66 {
67  return _value;
68 }
static MooseEnum getAvgDataFieldType()
MooseSharedPointer< EBSDAvgDataFunctor > _val
Accessor functor to fetch the selected data field form the EBSD data point.
registerMooseObject("PhaseFieldApp", EBSDReaderAvgDataAux)
const EBSDAvgData & getAvgData(unsigned int i) const
Get the requested type of average data for (global) grain number i.
Definition: EBSDReader.C:356
This class defines the interface for the GrainTracking objects.
const unsigned int invalid_uint
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const Node *const & _current_node
This kernel makes data from the EBSDReader GeneralUserObject available as AuxVariables.
Real _value
precalculated element value
const EBSDReader & _ebsd_reader
EBSD reader user object.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
const GrainTrackerInterface & _grain_tracker
Grain tracker user object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
EBSDReaderAvgDataAux(const InputParameters &parameters)
A GeneralUserObject that reads an EBSD file and stores the centroid data in a data structure which in...
Definition: EBSDReader.h:31
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned int _phase
Optional phase number needed for global grain index retrieval.
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
virtual void precalculateValue()
void ErrorVector unsigned int
static InputParameters validParams()
const Real _invalid
Value to return for points without active grains.
virtual Real getEntityValue(dof_id_type entity_id, FeatureFloodCount::FieldType, std::size_t var_index=0) const =0
Accessor for retrieving either nodal or elemental information (unique grains or variable indicies) ...