LCOV - code coverage report
Current view: top level - include/materials - LayerParameter.h (source / functions) Hit Total Coverage
Test: idaholab/mastodon: 55510a Lines: 6 8 75.0 %
Date: 2025-08-26 23:09:31 Functions: 2 6 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*************************************************/
       2             : /*           DO NOT MODIFY THIS HEADER           */
       3             : /*                                               */
       4             : /*                     MASTODON                  */
       5             : /*                                               */
       6             : /*    (c) 2015 Battelle Energy Alliance, LLC     */
       7             : /*            ALL RIGHTS RESERVED                */
       8             : /*                                               */
       9             : /*   Prepared by Battelle Energy Alliance, LLC   */
      10             : /*     With the U. S. Department of Energy       */
      11             : /*                                               */
      12             : /*     See COPYRIGHT for full restrictions       */
      13             : /*************************************************/
      14             : 
      15             : #ifndef LAYERPARAMETER_H
      16             : #define LAYERPARAMETER_H
      17             : 
      18             : // STL includes
      19             : #include <vector>
      20             : 
      21             : // MOOSE includes
      22             : #include "MooseArray.h"
      23             : 
      24             : /*
      25             :  * Base for defining an interface to update MooseArray<T> referenced from
      26             :  * getLayerParam method of LayeredMaterialInterface. This allows the same
      27             :  * storage structure to store a variety of parameter types.
      28             :  *
      29             :  * It also defines a container that cannot be copied, which is the case with
      30             :  * MooseArray objects
      31             :  * that are stored in the parent version (LayerParameter).
      32             :  */
      33             : class LayerParameterBase
      34             : {
      35             : public:
      36             :   LayerParameterBase() = default;
      37             :   virtual ~LayerParameterBase() = default;
      38             : 
      39             :   LayerParameterBase(const LayerParameterBase &) = delete;
      40             :   LayerParameterBase & operator=(const LayerParameterBase &) = delete;
      41             : 
      42             :   LayerParameterBase(LayerParameterBase &&) = default;
      43             :   LayerParameterBase & operator=(LayerParameterBase &&) = default;
      44             : 
      45           0 :   virtual void resize(const unsigned int & /*n*/){};                                // = 0;
      46           0 :   virtual void reinit(const unsigned int & /*qp*/, const unsigned int & /*idx*/){}; // = 0;
      47             : };
      48             : 
      49             : /**
      50             :  * Class for storing a MooseArray to which the data from getLayerParam
      51             :  * references. This
      52             :  * data is updated with the input parameter data via LayeredMaterialInterface.
      53             :  */
      54             : template <class P>
      55             : class LayerParameter : public LayerParameterBase
      56             : {
      57             : public:
      58        3181 :   LayerParameter(const std::vector<P> & data) : _param_data(data) {}
      59             : 
      60             :   /**
      61             :    * Resizes the MooseArray that will be referenced by calls to getLayerParam.
      62             :    */
      63     4160182 :   virtual void resize(const unsigned int & n) override { _array_data.resize(n); }
      64             : 
      65             :   /**
      66             :    * Updates the MooseArray data at a quadrature point given the input parameter
      67             :    * vector index.
      68             :    * see LayeredMaterialInterface::computeProperties
      69             :    */
      70    29447004 :   virtual void reinit(const unsigned int & qp, const unsigned int & idx) override
      71             :   {
      72    29447004 :     _array_data[qp] = _param_data[idx];
      73    29447004 :   }
      74             : 
      75             :   /**
      76             :    * Return a reference to the MooseArray object (see getLayerParam).
      77             :    */
      78        3181 :   const MooseArray<P> & array() { return _array_data; }
      79             : 
      80             : private:
      81             :   /// Reference to the input parameter data for the problem.
      82             :   const std::vector<P> & _param_data;
      83             : 
      84             :   /// Data that will be referenced in calls to getLayerParam
      85             :   MooseArray<P> _array_data;
      86             : };
      87             : 
      88             : #endif

Generated by: LCOV version 1.14