www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TwoMaterialPropertyInterface Class Reference

#include <TwoMaterialPropertyInterface.h>

Inheritance diagram for TwoMaterialPropertyInterface:
[legend]

Public Member Functions

 TwoMaterialPropertyInterface (const MooseObject *moose_object, const std::set< SubdomainID > &blocks_ids, const std::set< BoundaryID > &boundary_ids)
 
template<typename T >
const MaterialProperty< T > & getNeighborMaterialProperty (const std::string &name)
 Retrieve the property named "name". More...
 
template<typename T >
const MaterialProperty< T > & getNeighborMaterialPropertyOld (const std::string &name)
 
template<typename T >
const MaterialProperty< T > & getNeighborMaterialPropertyOlder (const std::string &name)
 
template<typename T >
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty (const MaterialPropertyName &name)
 Retrieve pointer to a material property with the mesh blocks where it is defined The name required by this method is the name defined in the input file. More...
 
template<typename T >
const MaterialProperty< T > & getZeroMaterialProperty (const std::string &prop_name)
 Return a material property that is initialized to zero by default and does not need to (but can) be declared by another material. More...
 
std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &name)
 Retrieve the block ids that the material property is defined. More...
 
std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &name)
 Retrieve the block names that the material property is defined. More...
 
std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &name)
 Retrieve the boundary ids that the material property is defined. More...
 
std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &name)
 Retrieve the boundary namess that the material property is defined. More...
 
void checkBlockAndBoundaryCompatibility (std::shared_ptr< Material > discrete)
 Check if block and boundary restrictions of a given material are compatible with the current material. More...
 
template<>
MaterialgetMaterialByName (const std::string &name, bool no_warn)
 
template<>
MaterialgetMaterialByName (const std::string &name, bool no_warn)
 
void statefulPropertiesAllowed (bool)
 Derived classes can declare whether or not they work with stateful material properties. More...
 
bool getMaterialPropertyCalled () const
 Returns true if getMaterialProperty() has been called, false otherwise. More...
 
const std::set< unsigned int > & getMatPropDependencies () const
 Retrieve the set of material properties that this object depends on. More...
 
template<>
const MaterialProperty< Real > * defaultMaterialProperty (const std::string &name)
 
template<typename T >
const MaterialProperty< T > & getMaterialProperty (const std::string &name)
 Retrieve reference to material property or one of it's old or older values. More...
 
template<typename T >
const ADMaterialPropertyObject< T > & getADMaterialProperty (const std::string &name)
 
template<typename T >
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
template<typename T >
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
template<typename T >
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name)
 Retrieve reference to material property or its old or older value The name required by this method is the name defined in the input file. More...
 
template<typename T >
const ADMaterialPropertyObject< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
template<typename T >
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
template<typename T >
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
MaterialgetMaterial (const std::string &name)
 Return a Material reference - usable for computing directly. More...
 
template<ComputeStage >
MaterialgetMaterial (const std::string &name)
 
MaterialgetMaterialByName (const std::string &name, bool no_warn=false)
 
template<ComputeStage >
MaterialgetMaterialByName (const std::string &name, bool no_warn=false)
 
template<typename T >
bool hasMaterialProperty (const std::string &name)
 Check if the material property exists. More...
 
template<typename T >
bool hasMaterialPropertyByName (const std::string &name)
 

Protected Member Functions

void checkMaterialProperty (const std::string &name)
 A helper method for checking material properties This method was required to avoid a compiler problem with the template getMaterialProperty method. More...
 
void markMatPropRequested (const std::string &)
 A proxy method for _mi_feproblem.markMatPropRequested(name) More...
 
std::string deducePropertyName (const std::string &name)
 Small helper to look up a material property name through the input parameter keys. More...
 
template<typename T >
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 Helper function to parse default material property values. More...
 
template<typename T >
const ADMaterialPropertyObject< T > * defaultADMaterialProperty (const std::string &name)
 Helper function to parse default material property values. More...
 
template<>
const ADMaterialPropertyObject< Real > * defaultADMaterialProperty (const std::string &name)
 
template<>
const ADMaterialPropertyObject< RealVectorValue > * defaultADMaterialProperty (const std::string &name)
 

Protected Attributes

std::shared_ptr< MaterialData_neighbor_material_data
 
const InputParameters_mi_params
 Parameters of the object with this interface. More...
 
const std::string _mi_name
 The name of the object that this interface belongs to. More...
 
Moose::MaterialDataType _material_data_type
 The type of data. More...
 
std::shared_ptr< MaterialData_material_data
 Pointer to the material data class that stores properties. More...
 
FEProblemBase_mi_feproblem
 Reference to the FEProblemBase class. More...
 
const THREAD_ID _mi_tid
 Current threaded it. More...
 
bool _stateful_allowed
 True by default. More...
 
bool _get_material_property_called
 Initialized to false. More...
 
std::vector< std::unique_ptr< MaterialProperty< Real > > > _default_real_properties
 Storage vector for MaterialProperty<Real> default objects. More...
 
std::vector< std::unique_ptr< ADMaterialPropertyObject< Real > > > _default_ad_real_properties
 Storage vector for ADMaterialPropertyObject<Real> default objects. More...
 
std::vector< std::unique_ptr< ADMaterialPropertyObject< RealVectorValue > > > _default_ad_real_vector_properties
 Storage vector for ADMaterialPropertyObject<RealVectorValue> default objects. More...
 
std::set< unsigned int > _material_property_dependencies
 The set of material properties (as given by their IDs) that this object depends on. More...
 

Detailed Description

Definition at line 22 of file TwoMaterialPropertyInterface.h.

Constructor & Destructor Documentation

◆ TwoMaterialPropertyInterface()

TwoMaterialPropertyInterface::TwoMaterialPropertyInterface ( const MooseObject moose_object,
const std::set< SubdomainID > &  blocks_ids,
const std::set< BoundaryID > &  boundary_ids 
)

Definition at line 24 of file TwoMaterialPropertyInterface.C.

28  : MaterialPropertyInterface(moose_object, blocks_ids, boundary_ids),
30  _mi_params.get<THREAD_ID>("_tid")))
31 {
32 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
MaterialPropertyInterface(const MooseObject *moose_object, const std::set< SubdomainID > &block_ids, const std::set< BoundaryID > &boundary_ids)
std::shared_ptr< MaterialData > _neighbor_material_data
const InputParameters & _mi_params
Parameters of the object with this interface.
std::shared_ptr< MaterialData > getMaterialData(Moose::MaterialDataType type, THREAD_ID tid=0)
unsigned int THREAD_ID
Definition: MooseTypes.h:126

Member Function Documentation

◆ checkBlockAndBoundaryCompatibility()

void MaterialPropertyInterface::checkBlockAndBoundaryCompatibility ( std::shared_ptr< Material discrete)
inherited

Check if block and boundary restrictions of a given material are compatible with the current material.

Error out otherwise.

Definition at line 205 of file MaterialPropertyInterface.C.

Referenced by MaterialPropertyInterface::getMaterialByName().

206 {
207  // Check block compatibility
208  if (!discrete->hasBlocks(_mi_block_ids))
209  {
210  std::ostringstream oss;
211  oss << "The Material object '" << discrete->name()
212  << "' is defined on blocks that are incompatible with the retrieving object '" << _mi_name
213  << "':\n";
214  oss << " " << discrete->name();
215  for (const auto & sbd_id : discrete->blockIDs())
216  oss << " " << sbd_id;
217  oss << "\n";
218  oss << " " << _mi_name;
219  for (const auto & block_id : _mi_block_ids)
220  oss << " " << block_id;
221  oss << "\n";
222  mooseError(oss.str());
223  }
224 
225  // Check boundary compatibility
226  if (!discrete->hasBoundary(_mi_boundary_ids))
227  {
228  std::ostringstream oss;
229  oss << "The Material object '" << discrete->name()
230  << "' is defined on boundaries that are incompatible with the retrieving object '"
231  << _mi_name << "':\n";
232  oss << " " << discrete->name();
233  for (const auto & bnd_id : discrete->boundaryIDs())
234  oss << " " << bnd_id;
235  oss << "\n";
236  oss << " " << _mi_name;
237  for (const auto & bnd_id : _mi_boundary_ids)
238  oss << " " << bnd_id;
239  oss << "\n";
240  mooseError(oss.str());
241  }
242 }
const std::set< SubdomainID > & _mi_block_ids
Storage for the block ids created by BlockRestrictable.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
const std::set< BoundaryID > & _mi_boundary_ids
Storage for the boundary ids created by BoundaryRestrictable.
const std::string _mi_name
The name of the object that this interface belongs to.

◆ checkMaterialProperty()

void MaterialPropertyInterface::checkMaterialProperty ( const std::string &  name)
protectedinherited

A helper method for checking material properties This method was required to avoid a compiler problem with the template getMaterialProperty method.

Definition at line 173 of file MaterialPropertyInterface.C.

Referenced by MaterialPropertyInterface::getADMaterialPropertyByName(), and MaterialPropertyInterface::getMaterialPropertyByName().

174 {
175  // If the material property is boundary restrictable, add to the list of materials to check
177  for (const auto & bnd_id : _mi_boundary_ids)
179 
180  // The default is to assume block restrictions
181  else
182  for (const auto & blk_ids : _mi_block_ids)
184 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
const std::set< SubdomainID > & _mi_block_ids
Storage for the block ids created by BlockRestrictable.
virtual void storeSubdomainDelayedCheckMatProp(const std::string &requestor, SubdomainID block_id, const std::string &name)
Adds to a map based on block ids of material properties to validate.
Definition: SubProblem.C:420
const bool _mi_boundary_restricted
BoundaryRestricted flag.
virtual void storeBoundaryDelayedCheckMatProp(const std::string &requestor, BoundaryID boundary_id, const std::string &name)
Adds to a map based on boundary ids of material properties to validate.
Definition: SubProblem.C:428
const std::set< BoundaryID > & _mi_boundary_ids
Storage for the boundary ids created by BoundaryRestrictable.
const std::string _mi_name
The name of the object that this interface belongs to.

◆ deducePropertyName()

std::string MaterialPropertyInterface::deducePropertyName ( const std::string &  name)
protectedinherited

◆ defaultADMaterialProperty() [1/3]

template<typename T >
const ADMaterialPropertyObject< T > * MaterialPropertyInterface::defaultADMaterialProperty ( const std::string &  name)
protectedinherited

Helper function to parse default material property values.

This is implemented as a specialization for supported types and returns NULL in all other cases.

Definition at line 394 of file MaterialPropertyInterface.h.

395 {
396  return NULL;
397 }

◆ defaultADMaterialProperty() [2/3]

const ADMaterialPropertyObject< Real > * MaterialPropertyInterface::defaultADMaterialProperty ( const std::string &  name)
protectedinherited

Definition at line 93 of file MaterialPropertyInterface.C.

94 {
95  std::istringstream ss(name);
96  Real real_value;
97 
98  // check if the string parsed cleanly into a Real number
99  if (ss >> real_value && ss.eof())
100  {
101  _default_ad_real_properties.emplace_back(libmesh_make_unique<ADMaterialPropertyObject<Real>>());
102  auto & default_property = _default_ad_real_properties.back();
103 
104  // resize to accomodate maximum number obf qpoints
105  auto nqp = _mi_feproblem.getMaxQps();
106  default_property->resize(nqp);
107 
108  // set values for all qpoints to the given default
109  for (decltype(nqp) qp = 0; qp < nqp; ++qp)
110  (*default_property)[qp] = real_value;
111 
112  // return the raw pointer inside the shared pointer
113  return default_property.get();
114  }
115 
116  return nullptr;
117 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
std::vector< std::unique_ptr< ADMaterialPropertyObject< Real > > > _default_ad_real_properties
Storage vector for ADMaterialPropertyObject<Real> default objects.
unsigned int getMaxQps() const

◆ defaultADMaterialProperty() [3/3]

const ADMaterialPropertyObject< RealVectorValue > * MaterialPropertyInterface::defaultADMaterialProperty ( const std::string &  name)
protectedinherited

Definition at line 121 of file MaterialPropertyInterface.C.

122 {
123  std::istringstream ss(name);
124  Real real_value;
125 
126  // check if the string parsed cleanly into a Real number
127  if (ss >> real_value && ss.eof())
128  {
130  libmesh_make_unique<ADMaterialPropertyObject<RealVectorValue>>());
131  auto & default_property = _default_ad_real_vector_properties.back();
132 
133  // resize to accomodate maximum number obf qpoints
134  auto nqp = _mi_feproblem.getMaxQps();
135  default_property->resize(nqp);
136 
137  // set values for all qpoints to the given default
138  for (decltype(nqp) qp = 0; qp < nqp; ++qp)
139  (*default_property)[qp] = real_value;
140 
141  // return the raw pointer inside the shared pointer
142  return default_property.get();
143  }
144 
145  return nullptr;
146 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
std::vector< std::unique_ptr< ADMaterialPropertyObject< RealVectorValue > > > _default_ad_real_vector_properties
Storage vector for ADMaterialPropertyObject<RealVectorValue> default objects.
unsigned int getMaxQps() const

◆ defaultMaterialProperty() [1/2]

template<typename T >
const MaterialProperty< T > * MaterialPropertyInterface::defaultMaterialProperty ( const std::string &  name)
protectedinherited

Helper function to parse default material property values.

This is implemented as a specialization for supported types and returns NULL in all other cases.

Definition at line 386 of file MaterialPropertyInterface.h.

387 {
388  return NULL;
389 }

◆ defaultMaterialProperty() [2/2]

const MaterialProperty< Real > * MaterialPropertyInterface::defaultMaterialProperty ( const std::string &  name)
inherited

Definition at line 65 of file MaterialPropertyInterface.C.

66 {
67  std::istringstream ss(name);
68  Real real_value;
69 
70  // check if the string parsed cleanly into a Real number
71  if (ss >> real_value && ss.eof())
72  {
73  _default_real_properties.emplace_back(libmesh_make_unique<MaterialProperty<Real>>());
74  auto & default_property = _default_real_properties.back();
75 
76  // resize to accomodate maximum number obf qpoints
77  auto nqp = _mi_feproblem.getMaxQps();
78  default_property->resize(nqp);
79 
80  // set values for all qpoints to the given default
81  for (decltype(nqp) qp = 0; qp < nqp; ++qp)
82  (*default_property)[qp] = real_value;
83 
84  // return the raw pointer inside the shared pointer
85  return default_property.get();
86  }
87 
88  return nullptr;
89 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
std::vector< std::unique_ptr< MaterialProperty< Real > > > _default_real_properties
Storage vector for MaterialProperty<Real> default objects.
unsigned int getMaxQps() const

◆ getADMaterialProperty()

template<typename T >
const ADMaterialPropertyObject< T > & MaterialPropertyInterface::getADMaterialProperty ( const std::string &  name)
inherited

Definition at line 328 of file MaterialPropertyInterface.h.

329 {
330  // Check if the supplied parameter is a valid input parameter key
331  std::string prop_name = deducePropertyName(name);
332 
333  // Check if it's just a constant
334  const ADMaterialPropertyObject<T> * default_property = defaultADMaterialProperty<T>(prop_name);
335  if (default_property)
336  return *default_property;
337 
338  return getADMaterialPropertyByName<T>(prop_name);
339 }
std::string deducePropertyName(const std::string &name)
Small helper to look up a material property name through the input parameter keys.

◆ getADMaterialPropertyByName()

template<typename T >
const ADMaterialPropertyObject< T > & MaterialPropertyInterface::getADMaterialPropertyByName ( const MaterialPropertyName &  name)
inherited

Definition at line 432 of file MaterialPropertyInterface.h.

433 {
435 
437  checkMaterialProperty(name);
438 
439  // mark property as requested
440  markMatPropRequested(name);
441 
442  // Update the boolean flag.
444 
445  _material_property_dependencies.insert(_material_data->getPropertyId(name));
446 
447  return _material_data->getADProperty<T>(name);
448 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
std::set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.
void markMatPropRequested(const std::string &)
A proxy method for _mi_feproblem.markMatPropRequested(name)
void usingADMatProps(bool using_ad_mat_props)
Set the global automatic differentiaion (AD) flag which indicates whether any consumer has requested ...
std::shared_ptr< MaterialData > _material_data
Pointer to the material data class that stores properties.
void checkMaterialProperty(const std::string &name)
A helper method for checking material properties This method was required to avoid a compiler problem...
bool _get_material_property_called
Initialized to false.
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.

◆ getBlockMaterialProperty()

template<typename T >
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > MaterialPropertyInterface::getBlockMaterialProperty ( const MaterialPropertyName &  name)
inherited

Retrieve pointer to a material property with the mesh blocks where it is defined The name required by this method is the name defined in the input file.

This function can be thought as the combination of getMaterialPropertyByName and getMaterialPropertyBlocks. It can be called after the action of all actions.

Parameters
nameThe name of the material property to retrieve
Returns
Pointer to the material property with the name 'name' and the set of blocks where the property is valid

Definition at line 488 of file MaterialPropertyInterface.h.

489 {
490  if (_mi_block_ids.empty())
491  mooseError("getBlockMaterialProperty must be called by a block restrictable object");
492 
493  if (!hasMaterialPropertyByName<T>(name))
494  return std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>(NULL,
495  std::set<SubdomainID>());
496 
497  _material_property_dependencies.insert(_material_data->getPropertyId(name));
498 
499  return std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>(
500  &_material_data->getProperty<T>(name), _mi_feproblem.getMaterialPropertyBlocks(name));
501 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
const std::set< SubdomainID > & _mi_block_ids
Storage for the block ids created by BlockRestrictable.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.
std::shared_ptr< MaterialData > _material_data
Pointer to the material data class that stores properties.
virtual std::set< SubdomainID > getMaterialPropertyBlocks(const std::string &prop_name)
Get a vector containing the block ids the material property is defined on.
Definition: SubProblem.C:281
Concrete definition of a parameter value for a specified type.

◆ getMaterial() [1/2]

template Material & MaterialPropertyInterface::getMaterial< JACOBIAN > ( const std::string &  name)
inherited

Return a Material reference - usable for computing directly.

Parameters
nameThe name of the input parameter or explicit material name.
no_warnIf true, suppress warning about retrieving the material potentially during its calculation. If you don't know what this is/means, then you don't need it.

Definition at line 199 of file MaterialPropertyInterface.C.

Referenced by MaterialPropertyInterface::getMaterialByName().

200 {
201  return getMaterialByName(_mi_params.get<MaterialName>(name));
202 }
Material & getMaterialByName(const std::string &name, bool no_warn=false)
const InputParameters & _mi_params
Parameters of the object with this interface.

◆ getMaterial() [2/2]

template<ComputeStage compute_stage>
Material & MaterialPropertyInterface::getMaterial ( const std::string &  name)
inherited

Definition at line 255 of file MaterialPropertyInterface.C.

256 {
257  return getMaterialByName<compute_stage>(_mi_params.get<MaterialName>(name));
258 }
const InputParameters & _mi_params
Parameters of the object with this interface.

◆ getMaterialByName() [1/4]

Material & MaterialPropertyInterface::getMaterialByName ( const std::string &  name,
bool  no_warn = false 
)
inherited

Definition at line 245 of file MaterialPropertyInterface.C.

Referenced by MaterialPropertyInterface::getMaterial(), and MaterialVectorPostprocessor::MaterialVectorPostprocessor().

246 {
247  std::shared_ptr<Material> discrete =
250  return *discrete;
251 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
const THREAD_ID _mi_tid
Current threaded it.
void checkBlockAndBoundaryCompatibility(std::shared_ptr< Material > discrete)
Check if block and boundary restrictions of a given material are compatible with the current material...
Moose::MaterialDataType _material_data_type
The type of data.
std::shared_ptr< Material > getMaterial(std::string name, Moose::MaterialDataType type, THREAD_ID tid=0, bool no_warn=false)
Return a pointer to a Material object.

◆ getMaterialByName() [2/4]

template<ComputeStage >
Material& MaterialPropertyInterface::getMaterialByName ( const std::string &  name,
bool  no_warn = false 
)
inherited

◆ getMaterialByName() [3/4]

template<>
Material& MaterialPropertyInterface::getMaterialByName ( const std::string &  name,
bool  no_warn 
)
inherited

Definition at line 262 of file MaterialPropertyInterface.C.

263 {
264  return getMaterialByName(name, no_warn);
265 }
Material & getMaterialByName(const std::string &name, bool no_warn=false)

◆ getMaterialByName() [4/4]

template<>
Material& MaterialPropertyInterface::getMaterialByName ( const std::string &  name,
bool  no_warn 
)
inherited

Definition at line 269 of file MaterialPropertyInterface.C.

270 {
271  std::shared_ptr<Material> discrete =
272  _mi_feproblem.getMaterial(name + "_jacobian", _material_data_type, _mi_tid, no_warn);
274  return *discrete;
275 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
const THREAD_ID _mi_tid
Current threaded it.
void checkBlockAndBoundaryCompatibility(std::shared_ptr< Material > discrete)
Check if block and boundary restrictions of a given material are compatible with the current material...
Moose::MaterialDataType _material_data_type
The type of data.
std::shared_ptr< Material > getMaterial(std::string name, Moose::MaterialDataType type, THREAD_ID tid=0, bool no_warn=false)
Return a pointer to a Material object.

◆ getMaterialProperty()

template<typename T >
const MaterialProperty< T > & MaterialPropertyInterface::getMaterialProperty ( const std::string &  name)
inherited

Retrieve reference to material property or one of it's old or older values.

The name required by this method is the name that is hard-coded into your source code as the input parameter key. If no input parameter is found this behaves like the getMaterialPropertyByName family as a fall back.

Parameters
nameThe name of the parameter key of the material property to retrieve
Returns
Reference to the desired material property

Definition at line 313 of file MaterialPropertyInterface.h.

314 {
315  // Check if the supplied parameter is a valid input parameter key
316  std::string prop_name = deducePropertyName(name);
317 
318  // Check if it's just a constant
319  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
320  if (default_property)
321  return *default_property;
322 
323  return getMaterialPropertyByName<T>(prop_name);
324 }
std::string deducePropertyName(const std::string &name)
Small helper to look up a material property name through the input parameter keys.
Concrete definition of a parameter value for a specified type.

◆ getMaterialPropertyBlockNames()

std::vector< SubdomainName > MaterialPropertyInterface::getMaterialPropertyBlockNames ( const std::string &  name)
inherited

Retrieve the block names that the material property is defined.

Parameters
nameThe name of the material property
Returns
A vector the the block names for the property

Definition at line 155 of file MaterialPropertyInterface.C.

156 {
158 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
virtual std::vector< SubdomainName > getMaterialPropertyBlockNames(const std::string &prop_name)
Get a vector of block id equivalences that the material property is defined on.
Definition: SubProblem.C:297

◆ getMaterialPropertyBlocks()

std::set< SubdomainID > MaterialPropertyInterface::getMaterialPropertyBlocks ( const std::string &  name)
inherited

Retrieve the block ids that the material property is defined.

Parameters
nameThe name of the material property
Returns
A vector the the block ids for the property

Definition at line 149 of file MaterialPropertyInterface.C.

150 {
152 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
virtual std::set< SubdomainID > getMaterialPropertyBlocks(const std::string &prop_name)
Get a vector containing the block ids the material property is defined on.
Definition: SubProblem.C:281

◆ getMaterialPropertyBoundaryIDs()

std::set< BoundaryID > MaterialPropertyInterface::getMaterialPropertyBoundaryIDs ( const std::string &  name)
inherited

Retrieve the boundary ids that the material property is defined.

Parameters
nameThe name of the material property
Returns
A vector the the boundary ids for the property

Definition at line 161 of file MaterialPropertyInterface.C.

162 {
164 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
virtual std::set< BoundaryID > getMaterialPropertyBoundaryIDs(const std::string &prop_name)
Get a vector containing the block ids the material property is defined on.
Definition: SubProblem.C:338

◆ getMaterialPropertyBoundaryNames()

std::vector< BoundaryName > MaterialPropertyInterface::getMaterialPropertyBoundaryNames ( const std::string &  name)
inherited

Retrieve the boundary namess that the material property is defined.

Parameters
nameThe name of the material property
Returns
A vector the the boundary names for the property

Definition at line 167 of file MaterialPropertyInterface.C.

168 {
170 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
virtual std::vector< BoundaryName > getMaterialPropertyBoundaryNames(const std::string &prop_name)
Get a vector of block id equivalences that the material property is defined on.
Definition: SubProblem.C:354

◆ getMaterialPropertyByName()

template<typename T >
const MaterialProperty< T > & MaterialPropertyInterface::getMaterialPropertyByName ( const MaterialPropertyName &  name)
inherited

Retrieve reference to material property or its old or older value The name required by this method is the name defined in the input file.

Parameters
nameThe name of the material property to retrieve
Returns
Reference to the material property with the name 'name'

Definition at line 414 of file MaterialPropertyInterface.h.

415 {
417  checkMaterialProperty(name);
418 
419  // mark property as requested
420  markMatPropRequested(name);
421 
422  // Update the boolean flag.
424 
425  _material_property_dependencies.insert(_material_data->getPropertyId(name));
426 
427  return _material_data->getProperty<T>(name);
428 }
std::set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.
void markMatPropRequested(const std::string &)
A proxy method for _mi_feproblem.markMatPropRequested(name)
std::shared_ptr< MaterialData > _material_data
Pointer to the material data class that stores properties.
void checkMaterialProperty(const std::string &name)
A helper method for checking material properties This method was required to avoid a compiler problem...
bool _get_material_property_called
Initialized to false.
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.

◆ getMaterialPropertyCalled()

bool MaterialPropertyInterface::getMaterialPropertyCalled ( ) const
inlineinherited

Returns true if getMaterialProperty() has been called, false otherwise.

Definition at line 187 of file MaterialPropertyInterface.h.

bool _get_material_property_called
Initialized to false.

◆ getMaterialPropertyOld()

template<typename T >
const MaterialProperty< T > & MaterialPropertyInterface::getMaterialPropertyOld ( const std::string &  name)
inherited

Definition at line 343 of file MaterialPropertyInterface.h.

344 {
345  if (!_stateful_allowed)
346  mooseError("Stateful material properties not allowed for this object."
347  " Old property for \"",
348  name,
349  "\" was requested.");
350 
351  // Check if the supplied parameter is a valid input parameter key
352  std::string prop_name = deducePropertyName(name);
353 
354  // Check if it's just a constant
355  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
356  if (default_property)
357  return *default_property;
358 
359  return getMaterialPropertyOldByName<T>(prop_name);
360 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::string deducePropertyName(const std::string &name)
Small helper to look up a material property name through the input parameter keys.
Concrete definition of a parameter value for a specified type.
bool _stateful_allowed
True by default.

◆ getMaterialPropertyOldByName()

template<typename T >
const MaterialProperty< T > & MaterialPropertyInterface::getMaterialPropertyOldByName ( const MaterialPropertyName &  name)
inherited

Definition at line 452 of file MaterialPropertyInterface.h.

453 {
454  if (!_stateful_allowed)
455  mooseError("Stateful material properties not allowed for this object."
456  " Old property for \"",
457  name,
458  "\" was requested.");
459 
460  // mark property as requested
461  markMatPropRequested(name);
462 
463  _material_property_dependencies.insert(_material_data->getPropertyId(name));
464 
465  return _material_data->getPropertyOld<T>(name);
466 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.
void markMatPropRequested(const std::string &)
A proxy method for _mi_feproblem.markMatPropRequested(name)
std::shared_ptr< MaterialData > _material_data
Pointer to the material data class that stores properties.
bool _stateful_allowed
True by default.

◆ getMaterialPropertyOlder()

template<typename T >
const MaterialProperty< T > & MaterialPropertyInterface::getMaterialPropertyOlder ( const std::string &  name)
inherited

Definition at line 364 of file MaterialPropertyInterface.h.

365 {
366  if (!_stateful_allowed)
367  mooseError("Stateful material properties not allowed for this object."
368  " Older property for \"",
369  name,
370  "\" was requested.");
371 
372  // Check if the supplied parameter is a valid input parameter key
373  std::string prop_name = deducePropertyName(name);
374 
375  // Check if it's just a constant
376  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
377  if (default_property)
378  return *default_property;
379 
380  return getMaterialPropertyOlderByName<T>(prop_name);
381 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::string deducePropertyName(const std::string &name)
Small helper to look up a material property name through the input parameter keys.
Concrete definition of a parameter value for a specified type.
bool _stateful_allowed
True by default.

◆ getMaterialPropertyOlderByName()

template<typename T >
const MaterialProperty< T > & MaterialPropertyInterface::getMaterialPropertyOlderByName ( const MaterialPropertyName &  name)
inherited

Definition at line 470 of file MaterialPropertyInterface.h.

471 {
472  if (!_stateful_allowed)
473  mooseError("Stateful material properties not allowed for this object."
474  " Older property for \"",
475  name,
476  "\" was requested.");
477 
478  // mark property as requested
479  markMatPropRequested(name);
480 
481  _material_property_dependencies.insert(_material_data->getPropertyId(name));
482 
483  return _material_data->getPropertyOlder<T>(name);
484 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.
void markMatPropRequested(const std::string &)
A proxy method for _mi_feproblem.markMatPropRequested(name)
std::shared_ptr< MaterialData > _material_data
Pointer to the material data class that stores properties.
bool _stateful_allowed
True by default.

◆ getMatPropDependencies()

const std::set<unsigned int>& MaterialPropertyInterface::getMatPropDependencies ( ) const
inlineinherited

Retrieve the set of material properties that this object depends on.

Returns
The IDs corresponding to the material properties that MUST be reinited before evaluating this object

Definition at line 195 of file MaterialPropertyInterface.h.

Referenced by NodalPatchRecovery::reinitPatch().

196  {
198  }
std::set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.

◆ getNeighborMaterialProperty()

template<typename T >
const MaterialProperty< T > & TwoMaterialPropertyInterface::getNeighborMaterialProperty ( const std::string &  name)

Retrieve the property named "name".

Definition at line 47 of file TwoMaterialPropertyInterface.h.

48 {
49  // Check if the supplied parameter is a valid input parameter key
50  std::string prop_name = deducePropertyName(name);
51 
52  // Check if it's just a constant
53  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
54  if (default_property)
55  return *default_property;
56  else
57  return _neighbor_material_data->getProperty<T>(prop_name);
58 }
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
Concrete definition of a parameter value for a specified type.

◆ getNeighborMaterialPropertyOld()

template<typename T >
const MaterialProperty< T > & TwoMaterialPropertyInterface::getNeighborMaterialPropertyOld ( const std::string &  name)

Definition at line 62 of file TwoMaterialPropertyInterface.h.

63 {
64  // Check if the supplied parameter is a valid input parameter key
65  std::string prop_name = deducePropertyName(name);
66 
67  // Check if it's just a constant
68  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
69  if (default_property)
70  return *default_property;
71  else
72  return _neighbor_material_data->getPropertyOld<T>(prop_name);
73 }
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
Concrete definition of a parameter value for a specified type.

◆ getNeighborMaterialPropertyOlder()

template<typename T >
const MaterialProperty< T > & TwoMaterialPropertyInterface::getNeighborMaterialPropertyOlder ( const std::string &  name)

Definition at line 77 of file TwoMaterialPropertyInterface.h.

78 {
79  // Check if the supplied parameter is a valid input parameter key
80  std::string prop_name = deducePropertyName(name);
81 
82  // Check if it's just a constant
83  const MaterialProperty<T> * default_property = defaultMaterialProperty<T>(prop_name);
84  if (default_property)
85  return *default_property;
86  else
87  return _neighbor_material_data->getPropertyOlder<T>(prop_name);
88 }
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
Concrete definition of a parameter value for a specified type.

◆ getZeroMaterialProperty()

template<typename T >
const MaterialProperty< T > & MaterialPropertyInterface::getZeroMaterialProperty ( const std::string &  prop_name)
inherited

Return a material property that is initialized to zero by default and does not need to (but can) be declared by another material.

Definition at line 521 of file MaterialPropertyInterface.h.

522 {
523  // static zero property storage
524  static MaterialProperty<T> zero;
525 
526  // resize to accomodate maximum number of qpoints
527  // (in multiapp scenarios getMaxQps can return different values in each app; we need the max)
528  unsigned int nqp = _mi_feproblem.getMaxQps();
529  if (nqp > zero.size())
530  zero.resize(nqp);
531 
532  // set values for all qpoints to zero
533  for (unsigned int qp = 0; qp < nqp; ++qp)
534  mooseSetToZero<T>(zero[qp]);
535 
536  return zero;
537 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
virtual void resize(int n) override
Resizes the property to the size n.
Concrete definition of a parameter value for a specified type.
virtual unsigned int size() const override
unsigned int getMaxQps() const

◆ hasMaterialProperty()

template<typename T >
bool MaterialPropertyInterface::hasMaterialProperty ( const std::string &  name)
inherited

Check if the material property exists.

Parameters
namethe name of the property to query
Returns
true if the property exists, otherwise false

Definition at line 505 of file MaterialPropertyInterface.h.

506 {
507  // Check if the supplied parameter is a valid input parameter key
508  std::string prop_name = deducePropertyName(name);
509  return _material_data->haveProperty<T>(prop_name);
510 }
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 > _material_data
Pointer to the material data class that stores properties.

◆ hasMaterialPropertyByName()

template<typename T >
bool MaterialPropertyInterface::hasMaterialPropertyByName ( const std::string &  name)
inherited

Definition at line 514 of file MaterialPropertyInterface.h.

515 {
516  return _material_data->haveProperty<T>(name);
517 }
std::shared_ptr< MaterialData > _material_data
Pointer to the material data class that stores properties.

◆ markMatPropRequested()

void MaterialPropertyInterface::markMatPropRequested ( const std::string &  name)
protectedinherited

A proxy method for _mi_feproblem.markMatPropRequested(name)

Definition at line 187 of file MaterialPropertyInterface.C.

Referenced by MaterialPropertyInterface::getADMaterialPropertyByName(), MaterialPropertyInterface::getMaterialPropertyByName(), MaterialPropertyInterface::getMaterialPropertyOldByName(), and MaterialPropertyInterface::getMaterialPropertyOlderByName().

188 {
190 }
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
virtual void markMatPropRequested(const std::string &)
Helper method for adding a material property name to the _material_property_requested set...
Definition: SubProblem.C:536

◆ statefulPropertiesAllowed()

void MaterialPropertyInterface::statefulPropertiesAllowed ( bool  stateful_allowed)
inherited

Derived classes can declare whether or not they work with stateful material properties.

See, for example, DiracKernel. By default, they are allowed.

Definition at line 193 of file MaterialPropertyInterface.C.

Referenced by DiracKernel::DiracKernel().

194 {
195  _stateful_allowed = stateful_allowed;
196 }
bool _stateful_allowed
True by default.

Member Data Documentation

◆ _default_ad_real_properties

std::vector<std::unique_ptr<ADMaterialPropertyObject<Real> > > MaterialPropertyInterface::_default_ad_real_properties
protectedinherited

Storage vector for ADMaterialPropertyObject<Real> default objects.

Definition at line 266 of file MaterialPropertyInterface.h.

Referenced by MaterialPropertyInterface::defaultADMaterialProperty().

◆ _default_ad_real_vector_properties

std::vector<std::unique_ptr<ADMaterialPropertyObject<RealVectorValue> > > MaterialPropertyInterface::_default_ad_real_vector_properties
protectedinherited

Storage vector for ADMaterialPropertyObject<RealVectorValue> default objects.

Definition at line 269 of file MaterialPropertyInterface.h.

Referenced by MaterialPropertyInterface::defaultADMaterialProperty().

◆ _default_real_properties

std::vector<std::unique_ptr<MaterialProperty<Real> > > MaterialPropertyInterface::_default_real_properties
protectedinherited

Storage vector for MaterialProperty<Real> default objects.

Definition at line 264 of file MaterialPropertyInterface.h.

Referenced by MaterialPropertyInterface::defaultMaterialProperty().

◆ _get_material_property_called

bool MaterialPropertyInterface::_get_material_property_called
protectedinherited

Initialized to false.

Gets set to true when getMaterialProperty() is called. Clients of this class can inquire whether getMaterialProperty() has been called by calling getMaterialPropertyCalled().

Definition at line 261 of file MaterialPropertyInterface.h.

Referenced by MaterialPropertyInterface::getADMaterialPropertyByName(), MaterialPropertyInterface::getMaterialPropertyByName(), and MaterialPropertyInterface::getMaterialPropertyCalled().

◆ _material_data

std::shared_ptr<MaterialData> MaterialPropertyInterface::_material_data
protectedinherited

◆ _material_data_type

Moose::MaterialDataType MaterialPropertyInterface::_material_data_type
protectedinherited

◆ _material_property_dependencies

std::set<unsigned int> MaterialPropertyInterface::_material_property_dependencies
protectedinherited

◆ _mi_feproblem

FEProblemBase& MaterialPropertyInterface::_mi_feproblem
protectedinherited

◆ _mi_name

const std::string MaterialPropertyInterface::_mi_name
protectedinherited

The name of the object that this interface belongs to.

Definition at line 205 of file MaterialPropertyInterface.h.

Referenced by MaterialPropertyInterface::checkBlockAndBoundaryCompatibility(), and MaterialPropertyInterface::checkMaterialProperty().

◆ _mi_params

const InputParameters& MaterialPropertyInterface::_mi_params
protectedinherited

◆ _mi_tid

const THREAD_ID MaterialPropertyInterface::_mi_tid
protectedinherited

Current threaded it.

Definition at line 217 of file MaterialPropertyInterface.h.

Referenced by MaterialPropertyInterface::getMaterialByName().

◆ _neighbor_material_data

std::shared_ptr<MaterialData> TwoMaterialPropertyInterface::_neighbor_material_data
protected

◆ _stateful_allowed

bool MaterialPropertyInterface::_stateful_allowed
protectedinherited

The documentation for this class was generated from the following files: