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

Constructor & Destructor Documentation

GuaranteeConsumer::GuaranteeConsumer ( MooseObject *  moose_object)

Definition at line 18 of file GuaranteeConsumer.C.

19  : _gc_params(moose_object->parameters()),
20  _gc_feproblem(_gc_params.get<FEProblemBase *>("_fe_problem_base")),
21  _gc_block_restrict(dynamic_cast<BlockRestrictable *>(moose_object))
22 {
23 }
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

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

Definition at line 26 of file GuaranteeConsumer.C.

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

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

BlockRestrictable* const GuaranteeConsumer::_gc_block_restrict
private

Access block restrictions of the object with this interface.

Definition at line 40 of file GuaranteeConsumer.h.

Referenced by hasGuaranteedMaterialProperty().

FEProblemBase* const GuaranteeConsumer::_gc_feproblem
private

Reference to the FEProblemBase class.

Definition at line 37 of file GuaranteeConsumer.h.

Referenced by hasGuaranteedMaterialProperty().

const InputParameters& GuaranteeConsumer::_gc_params
private

Parameters of the object with this interface.

Definition at line 34 of file GuaranteeConsumer.h.


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