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 25 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 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
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.
const InputParameters & parameters() const

Member Function Documentation

◆ hasGuaranteedMaterialProperty()

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

Definition at line 28 of file GuaranteeConsumer.C.

Referenced by ComputeFiniteStrainElasticStress::computeQpStress(), ADComputeSmearedCrackingStress::initialSetup(), ComputeSmearedCrackingStress::initialSetup(), ComputeLinearElasticPFFractureStress::initialSetup(), ComputeSimoHughesJ2PlasticityStress::initialSetup(), CriticalTimeStep::initialSetup(), ComputeStVenantKirchhoffStress::initialSetup(), ComputeMultipleInelasticStressBase::initialSetup(), and ADComputeMultipleInelasticStress::initialSetup().

30 {
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())
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<MaterialBase>> & 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 }
void mooseError(Args &&... args)
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.
virtual const std::set< SubdomainID > & blockIDs() const
virtual bool blockRestricted() const
const MaterialWarehouse & getMaterialWarehouse() const
FEProblemBase *const _gc_feproblem
Reference to the FEProblemBase class.
virtual MooseMesh & mesh() override
virtual bool startedInitialSetup()
const std::set< SubdomainID > & meshSubdomains() const

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 41 of file GuaranteeConsumer.h.

Referenced by hasGuaranteedMaterialProperty().

◆ _gc_feproblem

FEProblemBase* const GuaranteeConsumer::_gc_feproblem
private

Reference to the FEProblemBase class.

Definition at line 38 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 35 of file GuaranteeConsumer.h.


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