www.mooseframework.org
TwoMaterialPropertyInterface.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef TWOMATERIALPROPERTYINTERFACE_H
16 #define TWOMATERIALPROPERTYINTERFACE_H
17 
19 
20 // Forward Declarations
21 class MaterialData;
23 
24 template <>
26 
28 {
29 public:
30  TwoMaterialPropertyInterface(const MooseObject * moose_object);
31 
32  TwoMaterialPropertyInterface(const MooseObject * moose_object,
33  const std::set<SubdomainID> & blocks_ids);
34 
35  TwoMaterialPropertyInterface(const MooseObject * moose_object,
36  const std::set<BoundaryID> & boundary_ids);
37 
38  TwoMaterialPropertyInterface(const MooseObject * moose_object,
39  const std::set<SubdomainID> & blocks_ids,
40  const std::set<BoundaryID> & boundary_ids);
41 
45  template <typename T>
46  const MaterialProperty<T> & getNeighborMaterialProperty(const std::string & name);
47 
48  template <typename T>
49  const MaterialProperty<T> & getNeighborMaterialPropertyOld(const std::string & name);
50 
51  template <typename T>
52  const MaterialProperty<T> & getNeighborMaterialPropertyOlder(const std::string & name);
53 
54 protected:
55  std::shared_ptr<MaterialData> _neighbor_material_data;
56 };
57 
58 template <typename T>
59 const MaterialProperty<T> &
61 {
62  // Check if the supplied parameter is a valid input parameter key
63  std::string prop_name = deducePropertyName(name);
64 
65  // Check if it's just a constant
66  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
67  if (default_property)
68  return *default_property;
69  else
70  return _neighbor_material_data->getProperty<T>(prop_name);
71 }
72 
73 template <typename T>
74 const MaterialProperty<T> &
76 {
77  // Check if the supplied parameter is a valid input parameter key
78  std::string prop_name = deducePropertyName(name);
79 
80  // Check if it's just a constant
81  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
82  if (default_property)
83  return *default_property;
84  else
85  return _neighbor_material_data->getPropertyOld<T>(prop_name);
86 }
87 
88 template <typename T>
89 const MaterialProperty<T> &
91 {
92  // Check if the supplied parameter is a valid input parameter key
93  std::string prop_name = deducePropertyName(name);
94 
95  // Check if it's just a constant
96  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
97  if (default_property)
98  return *default_property;
99  else
100  return _neighbor_material_data->getPropertyOlder<T>(prop_name);
101 }
102 
103 #endif // TWOMATERIALPROPERTYINTERFACE_H
const MaterialProperty< T > & getNeighborMaterialProperty(const std::string &name)
Retrieve the property named "name".
TwoMaterialPropertyInterface(const MooseObject *moose_object)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::string deducePropertyName(const std::string &name)
Small helper to look up a material property name through the input parameter keys.
std::shared_ptr< MaterialData > _neighbor_material_data
const MaterialProperty< T > & getNeighborMaterialPropertyOlder(const std::string &name)
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
An interface for accessing Materials.
Concrete definition of a parameter value for a specified type.
InputParameters validParams< TwoMaterialPropertyInterface >()
Proxy for accessing MaterialPropertyStorage.
Definition: MaterialData.h:33
const MaterialProperty< T > & getNeighborMaterialPropertyOld(const std::string &name)