LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - GrainTextureVectorPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 0 39 0.0 %
Date: 2025-09-04 07:55:36 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "GrainTextureVectorPostprocessor.h"
      11             : #include "EulerAngleProvider.h"
      12             : #include "Assembly.h"
      13             : 
      14             : registerMooseObject("PhaseFieldApp", GrainTextureVectorPostprocessor);
      15             : 
      16             : InputParameters
      17           0 : GrainTextureVectorPostprocessor::validParams()
      18             : {
      19           0 :   InputParameters params = ElementVectorPostprocessor::validParams();
      20           0 :   params += SamplerBase::validParams();
      21           0 :   params.addClassDescription("Gives out info on the grain boundary properties");
      22           0 :   params.addRequiredParam<UserObjectName>("euler_angle_provider",
      23             :                                           "The EulerAngleProvider User object");
      24           0 :   params.addRequiredCoupledVar("unique_grains", "The grain number");
      25           0 :   params.addRequiredParam<unsigned int>("grain_num", "the number of grains");
      26           0 :   return params;
      27           0 : }
      28             : 
      29           0 : GrainTextureVectorPostprocessor::GrainTextureVectorPostprocessor(const InputParameters & parameters)
      30             :   : ElementVectorPostprocessor(parameters),
      31             :     SamplerBase(parameters, this, _communicator),
      32           0 :     _euler(getUserObject<EulerAngleProvider>("euler_angle_provider")),
      33           0 :     _unique_grains(coupledValue("unique_grains")),
      34           0 :     _grain_num(getParam<unsigned int>("grain_num")),
      35           0 :     _sample(4)
      36             : {
      37           0 :   if (_euler.getGrainNum() < _grain_num)
      38           0 :     mooseError("Euler angle provider has too few angles.");
      39             : 
      40           0 :   std::vector<std::string> output_variables(4);
      41             :   output_variables[0] = "unique_grain";
      42             :   output_variables[1] = "euler_angle_z";
      43             :   output_variables[2] = "euler_angle_x\'";
      44             :   output_variables[3] = "euler_angle_z\"";
      45           0 :   SamplerBase::setupVariables(output_variables);
      46           0 : }
      47             : 
      48             : void
      49           0 : GrainTextureVectorPostprocessor::initialize()
      50             : {
      51           0 :   SamplerBase::initialize();
      52           0 : }
      53             : 
      54             : void
      55           0 : GrainTextureVectorPostprocessor::execute()
      56             : {
      57           0 :   _sample[0] =
      58           0 :       _unique_grains[0] + 1; // Index starts at 0, but we want to display first grain as grain 1.
      59             : 
      60           0 :   const EulerAngles & angle = _euler.getEulerAngles(_unique_grains[0]);
      61           0 :   _sample[1] = angle.phi1; // Get the Z   rotation
      62           0 :   _sample[2] = angle.Phi;  // Get the X'  rotation
      63           0 :   _sample[3] = angle.phi2; // Get the Z'' rotation
      64           0 :   SamplerBase::addSample(_current_elem->vertex_average() /* x,y,z coordinates of elem centroid */,
      65           0 :                          _current_elem->id(),
      66           0 :                          _sample);
      67           0 : }
      68             : 
      69             : void
      70           0 : GrainTextureVectorPostprocessor::threadJoin(const UserObject & y)
      71             : {
      72             :   const auto & vpp = static_cast<const GrainTextureVectorPostprocessor &>(y);
      73           0 :   SamplerBase::threadJoin(vpp);
      74           0 : }
      75             : 
      76             : void
      77           0 : GrainTextureVectorPostprocessor::finalize()
      78             : {
      79           0 :   SamplerBase::finalize();
      80           0 : }

Generated by: LCOV version 1.14