LCOV - code coverage report
Current view: top level - include/materials - XFEMCutSwitchingMaterial.h (source / functions) Hit Total Coverage
Test: idaholab/moose xfem: #31405 (292dce) with base fef103 Lines: 1 2 50.0 %
Date: 2025-09-04 07:58:55 Functions: 1 16 6.2 %
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             : #pragma once
      11             : 
      12             : #include "Material.h"
      13             : #include "XFEM.h"
      14             : #include "ADRankTwoTensorForward.h"
      15             : #include "ADRankThreeTensorForward.h"
      16             : #include "ADRankFourTensorForward.h"
      17             : 
      18             : /**
      19             :  * Switches between materials in a multi-material system where the
      20             :  * interfaces are defined by multiple geometric cut userobjects.
      21             :  */
      22             : template <typename T, bool is_ad>
      23             : class XFEMCutSwitchingMaterialTempl : public Material
      24             : {
      25             : public:
      26             :   static InputParameters validParams();
      27             : 
      28             :   XFEMCutSwitchingMaterialTempl(const InputParameters & parameters);
      29             : 
      30             : protected:
      31             :   // At the time of initializing this switching material, the initQpStatefulProperties methods of
      32             :   // the base materials are already called. So we only need to assign the current values at _qp to
      33             :   // the switching material property.
      34           0 :   virtual void initQpStatefulProperties() override { computeProperties(); }
      35             : 
      36             :   virtual void computeProperties() override;
      37             : 
      38        3159 :   virtual void computeQpProperties() override { _prop[_qp] = (*_mapped_prop)[_qp]; }
      39             : 
      40             : private:
      41             :   /// The geometric cut userobject that provides the cut subdomain IDs
      42             :   const GeometricCutUserObject * _cut;
      43             : 
      44             :   ///{@ map keys and values
      45             :   const std::vector<CutSubdomainID> _keys;
      46             :   const std::vector<std::string> _vals;
      47             :   ///@}
      48             : 
      49             :   /// global material property base name
      50             :   const std::string _base_name;
      51             : 
      52             :   /// property name
      53             :   const std::string _prop_name;
      54             : 
      55             :   /// map of keys to material property
      56             :   std::unordered_map<unsigned int, const GenericMaterialProperty<T, is_ad> *> _prop_map;
      57             : 
      58             :   /// the global material property
      59             :   GenericMaterialProperty<T, is_ad> & _prop;
      60             : 
      61             :   /// shared pointer to XFEM
      62             :   std::shared_ptr<XFEM> _xfem;
      63             : 
      64             :   /// current mapped material property
      65             :   const GenericMaterialProperty<T, is_ad> * _mapped_prop;
      66             : };
      67             : 
      68             : typedef XFEMCutSwitchingMaterialTempl<Real, false> XFEMCutSwitchingMaterialReal;
      69             : typedef XFEMCutSwitchingMaterialTempl<RankTwoTensor, false> XFEMCutSwitchingMaterialRankTwoTensor;
      70             : typedef XFEMCutSwitchingMaterialTempl<RankThreeTensor, false>
      71             :     XFEMCutSwitchingMaterialRankThreeTensor;
      72             : typedef XFEMCutSwitchingMaterialTempl<RankFourTensor, false> XFEMCutSwitchingMaterialRankFourTensor;
      73             : 
      74             : typedef XFEMCutSwitchingMaterialTempl<Real, true> ADXFEMCutSwitchingMaterialReal;
      75             : typedef XFEMCutSwitchingMaterialTempl<RankTwoTensor, true> ADXFEMCutSwitchingMaterialRankTwoTensor;
      76             : typedef XFEMCutSwitchingMaterialTempl<RankThreeTensor, true>
      77             :     ADXFEMCutSwitchingMaterialRankThreeTensor;
      78             : typedef XFEMCutSwitchingMaterialTempl<RankFourTensor, true>
      79             :     ADXFEMCutSwitchingMaterialRankFourTensor;

Generated by: LCOV version 1.14