LCOV - code coverage report
Current view: top level - src/mesh - InterWrapperMesh.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 22 36 61.1 %
Date: 2025-09-04 07:58:06 Functions: 4 5 80.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 "InterWrapperMesh.h"
      11             : 
      12             : InputParameters
      13         198 : InterWrapperMesh::validParams()
      14             : {
      15         198 :   InputParameters params = MooseMesh::validParams();
      16         198 :   params.addClassDescription("Creates an inter-wrappper mesh container");
      17         198 :   return params;
      18           0 : }
      19             : 
      20          99 : InterWrapperMesh::InterWrapperMesh(const InputParameters & params) : MooseMesh(params) {}
      21             : 
      22           0 : InterWrapperMesh::InterWrapperMesh(const InterWrapperMesh & other_mesh)
      23             :   : MooseMesh(other_mesh),
      24           0 :     _unheated_length_entry(other_mesh._unheated_length_entry),
      25           0 :     _heated_length(other_mesh._heated_length),
      26           0 :     _unheated_length_exit(other_mesh._unheated_length_exit),
      27           0 :     _z_grid(other_mesh._z_grid),
      28           0 :     _k_grid(other_mesh._k_grid),
      29           0 :     _kij(other_mesh._kij),
      30           0 :     _assembly_pitch(other_mesh._assembly_pitch),
      31           0 :     _assembly_side_x(other_mesh._assembly_side_x),
      32           0 :     _assembly_side_y(other_mesh._assembly_side_y),
      33           0 :     _n_cells(other_mesh._n_cells)
      34             : {
      35           0 : }
      36             : 
      37             : void
      38          48 : InterWrapperMesh::generateZGrid(Real unheated_length_entry,
      39             :                                 Real heated_length,
      40             :                                 Real unheated_length_exit,
      41             :                                 unsigned int n_cells,
      42             :                                 std::vector<Real> & z_grid)
      43             : {
      44          48 :   Real L = unheated_length_entry + heated_length + unheated_length_exit;
      45          48 :   Real dz = L / n_cells;
      46         936 :   for (unsigned int i = 0; i < n_cells + 1; i++)
      47         888 :     z_grid.push_back(dz * i);
      48          48 : }
      49             : 
      50             : unsigned int
      51       38280 : InterWrapperMesh::getZIndex(const Point & point) const
      52             : {
      53       38280 :   if (_z_grid.size() == 0)
      54           0 :     mooseError("_z_grid is empty.");
      55             : 
      56       38280 :   if (point(2) <= _z_grid[0])
      57             :     return 0;
      58       34800 :   if (point(2) >= _z_grid[_z_grid.size() - 1])
      59        3480 :     return _z_grid.size() - 1;
      60             : 
      61             :   unsigned int lo = 0;
      62       31320 :   unsigned int hi = _z_grid.size();
      63      118320 :   while (lo < hi)
      64             :   {
      65       87000 :     unsigned int mid = (lo + hi) / 2;
      66       87000 :     if (std::abs(_z_grid[mid] - point(2)) < 1e-5)
      67       31320 :       return mid;
      68       55680 :     else if (_z_grid[mid] < point(2))
      69             :       lo = mid;
      70             :     else
      71             :       hi = mid;
      72             :   }
      73             :   return lo;
      74             : }

Generated by: LCOV version 1.14