LCOV - code coverage report
Current view: top level - src/userobjects - OpenMCCellTransform.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: ddd5f2 Lines: 23 25 92.0 %
Date: 2026-06-07 19:35:24 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /********************************************************************/
       2             : /*                  SOFTWARE COPYRIGHT NOTIFICATION                 */
       3             : /*                             Cardinal                             */
       4             : /*                                                                  */
       5             : /*                  (c) 2021 UChicago Argonne, LLC                  */
       6             : /*                        ALL RIGHTS RESERVED                       */
       7             : /*                                                                  */
       8             : /*                 Prepared by UChicago Argonne, LLC                */
       9             : /*               Under Contract No. DE-AC02-06CH11357               */
      10             : /*                With the U. S. Department of Energy               */
      11             : /*                                                                  */
      12             : /*             Prepared by Battelle Energy Alliance, LLC            */
      13             : /*               Under Contract No. DE-AC07-05ID14517               */
      14             : /*                With the U. S. Department of Energy               */
      15             : /*                                                                  */
      16             : /*                 See LICENSE for full restrictions                */
      17             : /********************************************************************/
      18             : 
      19             : #ifdef ENABLE_OPENMC_COUPLING
      20             : 
      21             : #include "OpenMCCellTransform.h"
      22             : #include "UserErrorChecking.h"
      23             : #include "MooseUtils.h"
      24             : 
      25             : registerMooseObject("CardinalApp", OpenMCCellTransform);
      26             : 
      27             : InputParameters
      28         116 : OpenMCCellTransform::validParams()
      29             : {
      30         116 :   InputParameters params = GeneralUserObject::validParams();
      31         116 :   params += OpenMCCellTransformBase::validParams();
      32             : 
      33         232 :   params.addParam<MooseEnum>("transform_type",
      34             :                              OpenMCCellTransformBase::transform_type,
      35             :                              "Type of transform to apply: 'translation' (dx,dy,dz) or 'rotation'"
      36         116 :                              "(" +
      37         116 :                                  OpenMCCellTransformBase::rotation_vector_symbols_list +
      38             :                                  ") in degrees, where the angles are the rotations about the "
      39             :                                  "x, y, and z axes, respectively.");
      40             : 
      41         232 :   params.addRequiredParam<std::vector<PostprocessorName>>(
      42             :       "vector_value",
      43             :       "An array of three values/postprocessors. For translation this array expects (dx, dy, dz) in "
      44             :       "mesh"
      45         116 :       " units. For rotation this array expects '" +
      46         116 :           OpenMCCellTransformBase::rotation_vector_symbols_list + "' in degrees.");
      47             : 
      48         116 :   params.addClassDescription(
      49             :       "UserObject that applies either translation or rotation on one or more OpenMC cells. "
      50             :       "The transform is driven by a transform array of three MOOSE postprocessors/scalar values");
      51             : 
      52         116 :   return params;
      53           0 : }
      54             : 
      55          60 : OpenMCCellTransform::OpenMCCellTransform(const InputParameters & parameters)
      56             :   : GeneralUserObject(parameters),
      57             :     OpenMCCellTransformBase(static_cast<MooseObject &>(*this)),
      58         116 :     _transform_type(getParam<MooseEnum>("transform_type"))
      59             : {
      60         112 :   const auto & pp_name_vector = getParam<std::vector<PostprocessorName>>("vector_value");
      61          56 :   if (pp_name_vector.size() != 3)
      62           2 :     paramError("vector_value",
      63             :                "Provide exactly 3 values/postprocessors: 'dx dy dz' in mesh units for translation"
      64           2 :                "transform or '" +
      65           0 :                    OpenMCCellTransformBase::rotation_vector_symbols_list +
      66             :                    "' in degrees for rotation transform.");
      67             : 
      68         216 :   for (const auto i : index_range(_t_pp))
      69         162 :     _t_pp[i] = &getPostprocessorValue("vector_value", i);
      70          54 : }
      71             : 
      72             : void
      73         118 : OpenMCCellTransform::execute()
      74             : {
      75         118 :   transform(_transform_type, Point(*_t_pp[0], *_t_pp[1], *_t_pp[2]));
      76         112 : }
      77             : 
      78             : #endif

Generated by: LCOV version 1.14