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 "MaterialPropertyInterface.h" 13 : 14 : // Forward Declarations 15 : class MaterialData; 16 : 17 : /** 18 : * This interface is designed for DGKernel, InternalSideUserObject, InterfaceUserObject, 19 : * where material properties on a side of both its primary side (face) and its secondary side 20 : * (neighbor) all required. 21 : */ 22 : class TwoMaterialPropertyInterface : public MaterialPropertyInterface 23 : { 24 : public: 25 : TwoMaterialPropertyInterface(const MooseObject * moose_object, 26 : const std::set<SubdomainID> & blocks_ids, 27 : const std::set<BoundaryID> & boundary_ids); 28 : 29 : static InputParameters validParams(); 30 : 31 : /** 32 : * Retrieve the neighbor property deduced from the name \p name 33 : * 34 : * \p state is the property state; 0 = current, 1 = old, 2 = older, etc. 35 : */ 36 : ///@{ 37 : template <typename T, bool is_ad> 38 : const GenericMaterialProperty<T, is_ad> & 39 1801 : getGenericNeighborMaterialProperty(const std::string & name, const unsigned int state = 0) 40 : { 41 1801 : return getGenericMaterialProperty<T, is_ad>(name, _neighbor_material_data, state); 42 : } 43 : template <typename T> 44 1341 : const MaterialProperty<T> & getNeighborMaterialProperty(const std::string & name, 45 : const unsigned int state = 0) 46 : { 47 1341 : return getGenericNeighborMaterialProperty<T, false>(name, state); 48 : } 49 : template <typename T> 50 358 : const ADMaterialProperty<T> & getNeighborADMaterialProperty(const std::string & name) 51 : { 52 358 : return getGenericNeighborMaterialProperty<T, true>(name, 0); 53 : } 54 : template <typename T> 55 24 : const MaterialProperty<T> & getNeighborMaterialPropertyOld(const std::string & name) 56 : { 57 24 : return getGenericNeighborMaterialProperty<T, false>(name, 1); 58 : } 59 : template <typename T> 60 : const MaterialProperty<T> & getNeighborMaterialPropertyOlder(const std::string & name) 61 : { 62 : return getGenericNeighborMaterialProperty<T, false>(name, 2); 63 : } 64 : ///@} 65 : 66 : /** 67 : * Retrieve the neighbor property named "name" without any deduction 68 : * 69 : * \p state is the property state; 0 = current, 1 = old, 2 = older, etc. 70 : */ 71 : ///@{ 72 : template <typename T, bool is_ad> 73 : const GenericMaterialProperty<T, is_ad> & 74 331 : getGenericNeighborMaterialPropertyByName(const std::string & name, const unsigned int state = 0) 75 : { 76 331 : return getGenericMaterialPropertyByName<T, is_ad>(name, _neighbor_material_data, state); 77 : } 78 : template <typename T> 79 : const MaterialProperty<T> & getNeighborMaterialPropertyByName(const std::string & name, 80 : const unsigned int state = 0) 81 : { 82 : return getGenericNeighborMaterialPropertyByName<T, false>(name, state); 83 : } 84 : template <typename T> 85 0 : const ADMaterialProperty<T> & getNeighborADMaterialPropertyByName(const std::string & name) 86 : { 87 0 : return getGenericNeighborMaterialPropertyByName<T, true>(name, 0); 88 : } 89 : ///@} 90 : 91 : protected: 92 : MaterialData & _neighbor_material_data; 93 : };