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

Add-on class that provides the functionality to check if guarantees for material properties are provided. More...

#include <GuaranteeConsumer.h>

Inheritance diagram for GuaranteeConsumer:
[legend]

Public Member Functions

 GuaranteeConsumer (MooseObject *moose_object)
 

Protected Member Functions

bool hasGuaranteedMaterialProperty (const MaterialPropertyName &prop, Guarantee guarantee)
 

Private Attributes

const InputParameters & _gc_params
 Parameters of the object with this interface. More...
 
FEProblemBase *const _gc_feproblem
 Reference to the FEProblemBase class. More...
 
BlockRestrictable *const _gc_block_restrict
 Access block restrictions of the object with this interface. More...
 

Detailed Description

Add-on class that provides the functionality to check if guarantees for material properties are provided.

The types of guarantees are listed in Guarantees.h

Definition at line 26 of file GuaranteeConsumer.h.

Constructor & Destructor Documentation

◆ GuaranteeConsumer()

GuaranteeConsumer::GuaranteeConsumer ( MooseObject *  moose_object)

Definition at line 20 of file GuaranteeConsumer.C.

21  : _gc_params(moose_object->parameters()),
22  _gc_feproblem(_gc_params.get<FEProblemBase *>("_fe_problem_base")),
23  _gc_block_restrict(dynamic_cast<BlockRestrictable *>(moose_object))
24 {
25 }
BlockRestrictable *const _gc_block_restrict
Access block restrictions of the object with this interface.
const InputParameters & _gc_params
Parameters of the object with this interface.
FEProblemBase *const _gc_feproblem
Reference to the FEProblemBase class.

Member Function Documentation

◆ hasGuaranteedMaterialProperty()

bool GuaranteeConsumer::hasGuaranteedMaterialProperty ( const MaterialPropertyName &  prop,
Guarantee  guarantee 
)
protected

Definition at line 28 of file GuaranteeConsumer.C.

Referenced by ComputeFiniteStrainElasticStress::initialSetup(), ComputeSmearedCrackingStress::initialSetup(), and ComputeMultipleInelasticStress::initialSetup().

30 {
31  if (!_gc_feproblem->startedInitialSetup())
32  mooseError("hasGuaranteedMaterialProperty() needs to be called in initialSetup()");
33 
34  // Reference to MaterialWarehouse for testing and retrieving block ids
35  const auto & warehouse = _gc_feproblem->getMaterialWarehouse();
36 
37  // Complete set of ids that this object is active
38  const auto & ids = (_gc_block_restrict && _gc_block_restrict->blockRestricted())
39  ? _gc_block_restrict->blockIDs()
40  : _gc_feproblem->mesh().meshSubdomains();
41 
42  // Loop over each id for this object
43  for (const auto & id : ids)
44  {
45  // If block materials exist, look if any issue the required guarantee
46  if (warehouse.hasActiveBlockObjects(id))
47  {
48  const std::vector<std::shared_ptr<Material>> & mats = warehouse.getActiveBlockObjects(id);
49  for (const auto & mat : mats)
50  {
51  const auto & mat_props = mat->getSuppliedItems();
52  if (mat_props.count(prop_name))
53  {
54  auto guarantee_mat = dynamic_cast<GuaranteeProvider *>(mat.get());
55  if (guarantee_mat && !guarantee_mat->hasGuarantee(prop_name, guarantee))
56  {
57  // we found at least one material on the set of block we operate on
58  // that does _not_ provide the requested guarantee
59  return false;
60  }
61  }
62  }
63  }
64  }
65 
66  return true;
67 }
Add-on class that provides the functionality to issue guarantees for declared material properties...
BlockRestrictable *const _gc_block_restrict
Access block restrictions of the object with this interface.
FEProblemBase *const _gc_feproblem
Reference to the FEProblemBase class.

Member Data Documentation

◆ _gc_block_restrict

BlockRestrictable* const GuaranteeConsumer::_gc_block_restrict
private

Access block restrictions of the object with this interface.

Definition at line 42 of file GuaranteeConsumer.h.

Referenced by hasGuaranteedMaterialProperty().

◆ _gc_feproblem

FEProblemBase* const GuaranteeConsumer::_gc_feproblem
private

Reference to the FEProblemBase class.

Definition at line 39 of file GuaranteeConsumer.h.

Referenced by hasGuaranteedMaterialProperty().

◆ _gc_params

const InputParameters& GuaranteeConsumer::_gc_params
private

Parameters of the object with this interface.

Definition at line 36 of file GuaranteeConsumer.h.


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