LCOV - code coverage report
Current view: top level - src/ics - SpecifiedSmoothSuperellipsoidIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 41 42 97.6 %
Date: 2025-09-04 07:55:36 Functions: 5 5 100.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 "SpecifiedSmoothSuperellipsoidIC.h"
      11             : #include "MooseRandom.h"
      12             : 
      13             : registerMooseObject("PhaseFieldApp", SpecifiedSmoothSuperellipsoidIC);
      14             : 
      15             : InputParameters
      16          33 : SpecifiedSmoothSuperellipsoidIC::validParams()
      17             : {
      18          33 :   InputParameters params = SmoothSuperellipsoidBaseIC::validParams();
      19          33 :   params.addClassDescription("Multiple smooth superellipsoids with manually specified center "
      20             :                              "points; semiaxes a,b,c; and exponents n");
      21          66 :   params.addRequiredParam<std::vector<Real>>("x_positions",
      22             :                                              "The x-coordinate for each superellipsoid center");
      23          66 :   params.addRequiredParam<std::vector<Real>>("y_positions",
      24             :                                              "The y-coordinate for each superellipsoid center");
      25          66 :   params.addRequiredParam<std::vector<Real>>("z_positions",
      26             :                                              "The z-coordinate for each superellipsoid center");
      27          66 :   params.addRequiredParam<std::vector<Real>>("as", "Semiaxis a for each superellipsoid");
      28          66 :   params.addRequiredParam<std::vector<Real>>("bs", "Semiaxis b for each superellipsoid");
      29          66 :   params.addRequiredParam<std::vector<Real>>("cs", "Semiaxis c for each superellipsoid");
      30          66 :   params.addRequiredParam<std::vector<Real>>("ns", "Exponent n for each superellipsoid");
      31             : 
      32          33 :   return params;
      33           0 : }
      34             : 
      35          18 : SpecifiedSmoothSuperellipsoidIC::SpecifiedSmoothSuperellipsoidIC(const InputParameters & parameters)
      36             :   : SmoothSuperellipsoidBaseIC(parameters),
      37          18 :     _x_positions(getParam<std::vector<Real>>("x_positions")),
      38          36 :     _y_positions(getParam<std::vector<Real>>("y_positions")),
      39          36 :     _z_positions(getParam<std::vector<Real>>("z_positions")),
      40          36 :     _input_as(getParam<std::vector<Real>>("as")),
      41          36 :     _input_bs(getParam<std::vector<Real>>("bs")),
      42          36 :     _input_cs(getParam<std::vector<Real>>("cs")),
      43          54 :     _input_ns(getParam<std::vector<Real>>("ns"))
      44             : {
      45          18 : }
      46             : 
      47             : void
      48           6 : SpecifiedSmoothSuperellipsoidIC::computeSuperellipsoidCenters()
      49             : {
      50           6 :   _centers.resize(_x_positions.size());
      51             : 
      52          18 :   for (unsigned int circ = 0; circ < _x_positions.size(); ++circ)
      53             :   {
      54          12 :     _centers[circ](0) = _x_positions[circ];
      55          12 :     _centers[circ](1) = _y_positions[circ];
      56          12 :     _centers[circ](2) = _z_positions[circ];
      57             :   }
      58           6 : }
      59             : 
      60             : void
      61           6 : SpecifiedSmoothSuperellipsoidIC::computeSuperellipsoidSemiaxes()
      62             : {
      63           6 :   _as.resize(_input_as.size());
      64           6 :   _bs.resize(_input_bs.size());
      65           6 :   _cs.resize(_input_cs.size());
      66             : 
      67          18 :   for (unsigned int circ = 0; circ < _input_as.size(); ++circ)
      68             :   {
      69          12 :     _as[circ] = _input_as[circ];
      70          12 :     _bs[circ] = _input_bs[circ];
      71          12 :     _cs[circ] = _input_cs[circ];
      72             :   }
      73           6 : }
      74             : 
      75             : void
      76           6 : SpecifiedSmoothSuperellipsoidIC::computeSuperellipsoidExponents()
      77             : {
      78           6 :   _ns.resize(_input_ns.size());
      79             : 
      80          18 :   for (unsigned int circ = 0; circ < _input_ns.size(); ++circ)
      81          12 :     _ns[circ] = _input_ns[circ];
      82           6 : }

Generated by: LCOV version 1.14