https://mooseframework.inl.gov
MaterialPropertyInterface.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // MOOSE includes
13 #include "MaterialProperty.h"
14 #include "MooseTypes.h"
15 #include "MaterialData.h"
16 #include "MathUtils.h"
17 #include "MooseObjectName.h"
18 #include "InputParameters.h"
19 
20 #include <unordered_map>
21 
22 #define usingMaterialPropertyInterfaceMembers \
23  using MaterialPropertyInterface::_material_data_type; \
24  using MaterialPropertyInterface::_material_data
25 
26 // Forward declarations
27 class MooseObject;
28 class FEProblemBase;
29 class SubProblem;
30 
39 template <class M>
41 {
42 public:
43  OptionalMaterialPropertyProxyBase(const std::string & name, const unsigned int state)
44  : _name(name), _state(state)
45  {
46  }
48  virtual void resolve(M & material) = 0;
49 
50 protected:
51  const std::string _name;
52  const unsigned int _state;
53 };
54 
66 {
67 public:
68  MaterialPropertyInterface(const MooseObject * moose_object,
69  const std::set<SubdomainID> & block_ids,
70  const std::set<BoundaryID> & boundary_ids);
71 
73 
79 
81 
90  template <typename T, bool is_ad>
92  const unsigned int state = 0)
93  {
94  return getGenericMaterialProperty<T, is_ad>(name, _material_data, state);
95  }
96  template <typename T>
97  const MaterialProperty<T> & getMaterialProperty(const std::string & name,
98  const unsigned int state = 0)
99  {
100  return getGenericMaterialProperty<T, false>(name, state);
101  }
102  template <typename T>
103  const ADMaterialProperty<T> & getADMaterialProperty(const std::string & name)
104  {
105  return getGenericMaterialProperty<T, true>(name, 0);
106  }
107  template <typename T>
108  const MaterialProperty<T> & getMaterialPropertyOld(const std::string & name)
109  {
110  return getMaterialProperty<T>(name, 1);
111  }
112  template <typename T>
113  const MaterialProperty<T> & getMaterialPropertyOlder(const std::string & name)
114  {
115  return getMaterialProperty<T>(name, 2);
116  }
118 
120 
127  template <typename T, bool is_ad>
129  getGenericMaterialPropertyByName(const MaterialPropertyName & name, const unsigned int state = 0)
130  {
131  return getGenericMaterialPropertyByName<T, is_ad>(name, _material_data, state);
132  }
133  template <typename T>
134  const MaterialProperty<T> & getMaterialPropertyByName(const MaterialPropertyName & name,
135  const unsigned int state = 0)
136  {
137  return getGenericMaterialPropertyByName<T, false>(name, state);
138  }
139  template <typename T>
140  const ADMaterialProperty<T> & getADMaterialPropertyByName(const MaterialPropertyName & name)
141  {
142  return getGenericMaterialPropertyByName<T, true>(name, 0);
143  }
144  template <typename T>
145  const MaterialProperty<T> & getMaterialPropertyOldByName(const MaterialPropertyName & name)
146  {
147  return getMaterialPropertyByName<T>(name, 1);
148  }
149  template <typename T>
150  const MaterialProperty<T> & getMaterialPropertyOlderByName(const MaterialPropertyName & name)
151  {
152  return getMaterialPropertyByName<T>(name, 2);
153  }
155 
158  template <typename T, bool is_ad>
160  getGenericOptionalMaterialProperty(const std::string & name, const unsigned int state = 0);
161 
162  template <typename T>
164  const unsigned int state = 0)
165  {
166  return getGenericOptionalMaterialProperty<T, false>(name, state);
167  }
168  template <typename T>
170  {
171  return getGenericOptionalMaterialProperty<T, true>(name);
172  }
173 
174  template <typename T>
176  {
177  return getOptionalMaterialProperty<T>(name, 1);
178  }
179  template <typename T>
181  {
182  return getOptionalMaterialProperty<T>(name, 2);
183  }
185 
196  template <typename T>
197  std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>
198  getBlockMaterialProperty(const MaterialPropertyName & name);
199 
204  template <typename T, bool is_ad>
206  getGenericZeroMaterialProperty(const std::string & name);
207  template <typename T, bool is_ad>
209  getGenericZeroMaterialPropertyByName(const std::string & prop_name);
210 
214  template <typename T, bool is_ad>
216 
218  template <typename T, typename... Ts>
220  {
221  return getGenericZeroMaterialProperty<T, false>(args...);
222  }
223 
229  std::set<SubdomainID> getMaterialPropertyBlocks(const std::string & name);
230 
236  std::vector<SubdomainName> getMaterialPropertyBlockNames(const std::string & name);
237 
243  std::set<BoundaryID> getMaterialPropertyBoundaryIDs(const std::string & name);
244 
250  std::vector<BoundaryName> getMaterialPropertyBoundaryNames(const std::string & name);
251 
256  void checkBlockAndBoundaryCompatibility(std::shared_ptr<MaterialBase> discrete);
257 
259 
267  MaterialBase & getMaterial(const std::string & name);
268  MaterialBase & getMaterialByName(const std::string & name, bool no_warn = false);
270 
272  std::unordered_map<SubdomainID, std::vector<MaterialBase *>>
273  buildRequiredMaterials(bool allow_stateful = true);
274 
276 
281  template <typename T>
282  bool hasMaterialProperty(const std::string & name);
283  template <typename T>
284  bool hasMaterialPropertyByName(const std::string & name);
285  template <typename T>
286  bool hasADMaterialProperty(const std::string & name);
287  template <typename T>
288  bool hasADMaterialPropertyByName(const std::string & name);
290 
292  template <typename T, bool is_ad>
293  bool hasGenericMaterialProperty(const std::string & name)
294  {
295  if constexpr (is_ad)
296  return hasADMaterialProperty<T>(name);
297  else
298  return hasMaterialProperty<T>(name);
299  }
300  template <typename T, bool is_ad>
301  bool hasGenericMaterialPropertyByName(const std::string & name)
302  {
303  if constexpr (is_ad)
304  return hasADMaterialPropertyByName<T>(name);
305  else
306  return hasMaterialPropertyByName<T>(name);
307  }
309 
315  void statefulPropertiesAllowed(bool);
316 
321 
328  virtual const std::unordered_set<unsigned int> & getMatPropDependencies() const
329  {
331  }
332 
334  virtual void resolveOptionalProperties();
335 
339  template <typename T, bool is_ad>
341  const std::string & name, MaterialData & material_data, const unsigned int state = 0);
342 
348  template <typename T>
349  const MaterialProperty<T> & getMaterialProperty(const std::string & name,
350  MaterialData & material_data,
351  const unsigned int state = 0)
352  {
353  return getGenericMaterialProperty<T, false>(name, material_data, state);
354  }
355 
361  template <typename T>
362  const ADMaterialProperty<T> & getADMaterialProperty(const std::string & name,
363  MaterialData & material_data)
364  {
365  return getGenericMaterialProperty<T, true>(name, material_data, 0);
366  }
367 
372  template <typename T, bool is_ad>
374  const MaterialPropertyName & name, MaterialData & material_data, const unsigned int state);
375 
381  template <typename T, bool is_ad>
383  getPossiblyConstantGenericMaterialPropertyByName(const MaterialPropertyName & prop_name,
384  MaterialData & material_data,
385  const unsigned int state);
386 
392  template <typename T>
393  const MaterialProperty<T> & getMaterialPropertyByName(const MaterialPropertyName & name,
394  MaterialData & material_data,
395  const unsigned int state = 0)
396  {
397  return getGenericMaterialPropertyByName<T, false>(name, material_data, state);
398  }
399 
404  template <typename T>
405  const ADMaterialProperty<T> & getADMaterialPropertyByName(const MaterialPropertyName & name,
406  MaterialData & material_data)
407  {
408  return getGenericMaterialPropertyByName<T, true>(name, material_data, 0);
409  }
410 
414  template <typename T>
415  const MaterialProperty<T> & getMaterialPropertyOld(const std::string & name,
416  MaterialData & material_data)
417  {
418  return getMaterialProperty<T>(name, material_data, 1);
419  }
420 
425  template <typename T>
426  const MaterialProperty<T> & getMaterialPropertyOlder(const std::string & name,
427  MaterialData & material_data)
428  {
429  return getMaterialProperty<T>(name, material_data, 2);
430  }
431 
436  template <typename T>
437  const MaterialProperty<T> & getMaterialPropertyOldByName(const MaterialPropertyName & name,
438  MaterialData & material_data)
439  {
440  return getMaterialPropertyByName<T>(name, material_data, 1);
441  }
442 
447  template <typename T>
448  const MaterialProperty<T> & getMaterialPropertyOlderByName(const MaterialPropertyName & name,
449  MaterialData & material_data)
450  {
451  return getMaterialPropertyByName<T>(name, material_data, 2);
452  }
453 
454 private:
457 
458 protected:
461 
463  const std::string _mi_name;
464 
467 
470 
473 
476 
479 
482 
488  virtual void checkMaterialProperty(const std::string & name, const unsigned int state);
489 
493  void markMatPropRequested(const std::string &);
494 
502  MaterialPropertyName getMaterialPropertyName(const std::string & name) const;
503 
511  template <typename T, bool is_ad>
514  defaultGenericMaterialProperty(const std::string & name);
515  template <typename T>
516  const MaterialProperty<T> * defaultMaterialProperty(const std::string & name)
517  {
518  return defaultGenericMaterialProperty<T, false>(name);
519  }
520  template <typename T>
521  const ADMaterialProperty<T> * defaultADMaterialProperty(const std::string & name)
522  {
523  return defaultGenericMaterialProperty<T, true>(name);
524  }
526 
530  void checkExecutionStage();
531 
537 
544 
546  std::vector<std::unique_ptr<PropertyValue>> _default_properties;
547 
549  std::unordered_set<unsigned int> _material_property_dependencies;
550 
551  const MaterialPropertyName _get_suffix;
552 
555 
557  static const std::string _interpolated_old;
558  static const std::string _interpolated_older;
560 
561 private:
565  Moose::MaterialDataType getMaterialDataType(const std::set<BoundaryID> & boundary_ids) const;
566 
567  /*
568  * A proxy method for _mi_feproblem.getMaxQps()
569  */
570  unsigned int getMaxQps() const;
571 
572  /*
573  * A proxy method for _mi_feproblem.addConsumedPropertyName()
574  */
575  void addConsumedPropertyName(const MooseObjectName & obj_name, const std::string & prop_name);
576 
579 
581  const std::set<SubdomainID> & _mi_block_ids;
582 
584  const std::set<BoundaryID> & _mi_boundary_ids;
585 
587  std::vector<std::unique_ptr<OptionalMaterialPropertyProxyBase<MaterialPropertyInterface>>>
589 };
590 
591 template <class M, typename T, bool is_ad>
593 {
594 public:
595  OptionalMaterialPropertyProxy(const std::string & name, const unsigned int state)
597  {
598  }
600  void resolve(M & mpi) override
601  {
602  if (mpi.template hasGenericMaterialProperty<T, is_ad>(this->_name))
603  {
604  if constexpr (is_ad)
605  if (this->_state > 0)
606  mooseError("Non-current (state > 0) material properties are not available as AD");
607 
608  _value.set(&mpi.template getGenericMaterialProperty<T, is_ad>(this->_name, this->_state));
609  }
610  }
611 
612 private:
614 };
615 
616 template <typename T, bool is_ad>
619 {
620  if constexpr (std::is_same_v<T, Real> || std::is_same_v<T, RealVectorValue>)
621  {
622  std::istringstream ss(name);
623  Real real_value;
624 
625  // check if the string parsed cleanly into a Real number
626  if (ss >> real_value && ss.eof())
627  {
628  using prop_type = GenericMaterialProperty<T, is_ad>;
629 
630  const auto nqp = Moose::constMaxQpsPerElem;
631  auto & property =
632  _default_properties.emplace_back(std::make_unique<prop_type>(default_property_id));
633  auto & T_property = static_cast<prop_type &>(*property);
634 
635  T_property.resize(nqp);
636  for (const auto qp : make_range(nqp))
637  T_property[qp] = real_value;
638 
639  return &T_property;
640  }
641  }
642 
643  return nullptr;
644 }
645 
646 template <typename T>
647 std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>
648 MaterialPropertyInterface::getBlockMaterialProperty(const MaterialPropertyName & name_in)
649 {
650  const auto name = _get_suffix.empty()
651  ? static_cast<const std::string &>(name_in)
652  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
653 
654  if (_mi_block_ids.empty())
655  mooseError("getBlockMaterialProperty must be called by a block restrictable object");
656 
657  using pair_type = std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>;
658 
659  if (!hasMaterialPropertyByName<T>(name))
660  return pair_type(nullptr, {});
661 
662  // Call first so that the ID gets registered
663  const auto & prop = _material_data.getProperty<T, false>(name, 0, _mi_moose_object);
665  auto prop_blocks_pair = pair_type(&prop, std::move(blocks));
666 
668 
669  // Update consumed properties in MaterialPropertyDebugOutput
671 
672  return prop_blocks_pair;
673 }
674 
675 template <typename T>
676 bool
678 {
679  // Check if the supplied parameter is a valid input parameter key
680  const auto prop_name = getMaterialPropertyName(name);
681  return hasMaterialPropertyByName<T>(prop_name);
682 }
683 
684 template <typename T>
685 bool
687 {
688  const auto name = _get_suffix.empty()
689  ? name_in
690  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
691  return _material_data.haveProperty<T>(name);
692 }
693 
694 template <typename T, bool is_ad>
697 {
698  const auto prop_name = getMaterialPropertyName(name);
699  return getGenericZeroMaterialPropertyByName<T, is_ad>(prop_name);
700 }
701 
702 template <typename T, bool is_ad>
705 {
706  // if found return the requested property
707  if (hasGenericMaterialPropertyByName<T, is_ad>(prop_name))
708  return getGenericMaterialPropertyByName<T, is_ad>(prop_name);
709 
710  return getGenericZeroMaterialProperty<T, is_ad>();
711 }
712 
713 template <typename T, bool is_ad>
716 {
717  // static zero property storage
719 
720  // resize to accomodate maximum number of qpoints
721  // (in multiapp scenarios getMaxQps can return different values in each app; we need the max)
722  unsigned int nqp = getMaxQps();
723  if (nqp > zero.size())
724  zero.resize(nqp);
725 
726  // set values for all qpoints to zero
727  for (unsigned int qp = 0; qp < nqp; ++qp)
729 
730  return zero;
731 }
732 
733 template <typename T>
734 bool
736 {
737  // Check if the supplied parameter is a valid input parameter key
738  const auto prop_name = getMaterialPropertyName(name);
739  return hasADMaterialPropertyByName<T>(prop_name);
740 }
741 
742 template <typename T>
743 bool
745 {
746  const auto name = _get_suffix.empty()
747  ? name_in
748  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
750 }
751 
752 template <typename T, bool is_ad>
755  const unsigned int state)
756 {
757  auto proxy = std::make_unique<OptionalMaterialPropertyProxy<MaterialPropertyInterface, T, is_ad>>(
758  name, state);
759  auto & optional_property = proxy->value();
760  _optional_property_proxies.push_back(std::move(proxy));
761  return optional_property;
762 }
763 
764 template <typename T, bool is_ad>
767  const MaterialPropertyName & prop_name, MaterialData & material_data, const unsigned int state)
768 {
769  // Check if it's just a constant
770  if (const auto * default_property = defaultGenericMaterialProperty<T, is_ad>(prop_name))
771  return *default_property;
772 
773  if (state > 0 && !_stateful_allowed)
774  mooseError("Stateful material properties not allowed for this object."
775  " State ",
776  state,
777  " property for \"",
778  prop_name,
779  "\" was requested.");
780 
781  return this->getGenericMaterialPropertyByName<T, is_ad>(prop_name, material_data, state);
782 }
783 
784 template <typename T, bool is_ad>
787  MaterialData & material_data,
788  const unsigned int state)
789 {
790  // Check if the supplied parameter is a valid input parameter key
791  const auto prop_name = getMaterialPropertyName(name);
792 
793  return getPossiblyConstantGenericMaterialPropertyByName<T, is_ad>(
794  prop_name, material_data, state);
795 }
796 
797 template <typename T, bool is_ad>
800  MaterialData & material_data,
801  const unsigned int state)
802 {
804  {
805  if (state == 1)
806  return getGenericMaterialPropertyByName<T, is_ad>(
807  name_in + _interpolated_old, material_data, 0);
808  if (state == 2)
809  return getGenericMaterialPropertyByName<T, is_ad>(
810  name_in + _interpolated_older, material_data, 0);
811  }
812 
813  const auto name = _get_suffix.empty()
814  ? static_cast<const std::string &>(name_in)
815  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
816 
818  checkMaterialProperty(name, state);
819 
820  // mark property as requested
822 
823  // Update the boolean flag.
825 
826  // Call first so that the ID gets registered
827  auto & prop = material_data.getProperty<T, is_ad>(name, state, _mi_moose_object);
828 
829  // Does the material data used here matter?
830  _material_property_dependencies.insert(material_data.getPropertyId(name));
831 
832  if (state == 0)
834 
835  return prop;
836 }
virtual const std::unordered_set< unsigned int > & getMatPropDependencies() const
Retrieve the set of material properties that this object depends on.
std::string name(const ElemQuality q)
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
const THREAD_ID _mi_tid
Current threaded it.
const OptionalMaterialProperty< T > & getOptionalMaterialProperty(const std::string &name, const unsigned int state=0)
const MaterialProperty< T > * defaultMaterialProperty(const std::string &name)
virtual void resolveOptionalProperties()
resolve all optional properties
static const std::string _interpolated_old
name suffixes for interpolated old and older properties
std::string join(Iterator begin, Iterator end, const std::string &delimiter)
Python-like join function for strings over an iterator range.
Definition: MooseUtils.h:142
virtual void checkMaterialProperty(const std::string &name, const unsigned int state)
A helper method for checking material properties This method was required to avoid a compiler problem...
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
Definition: MathUtils.h:372
const MooseObjectName _mi_moose_object_name
The "complete" name of the object that this interface belongs for material property output...
static constexpr PropertyValue::id_type default_property_id
The material property ID for a default (parsed from input) property.
const std::set< SubdomainID > & _mi_block_ids
Storage for the block ids created by BlockRestrictable.
std::vector< BoundaryName > getMaterialPropertyBoundaryNames(const std::string &name)
Retrieve the boundary namess that the material property is defined.
bool haveProperty(const std::string &prop_name) const
Returns true if the regular material property exists - defined by any material.
Definition: MaterialData.h:89
const ADMaterialProperty< T > & getADMaterialProperty(const std::string &name)
char ** blocks
bool hasMaterialPropertyByName(const std::string &name)
MaterialPropertyInterface(const MooseObject *moose_object, const std::set< SubdomainID > &block_ids, const std::set< BoundaryID > &boundary_ids)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName(const std::string &prop_name)
const MaterialProperty< T > & getMaterialPropertyOlderByName(const MaterialPropertyName &name)
constexpr std::size_t constMaxQpsPerElem
This is used for places where we initialize some qp-sized data structures that would end up being siz...
Definition: MooseTypes.h:230
const MaterialProperty< T > & getMaterialPropertyByName(const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state=0)
Retrieve the property named "name" without any deduction for the specified material_data.
static const std::string _interpolated_older
bool hasGenericMaterialPropertyByName(const std::string &name)
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...
MaterialDataType
MaterialData types.
Definition: MooseTypes.h:691
std::vector< SubdomainName > getMaterialPropertyBlockNames(const std::string &name)
Retrieve the block names that the material property is defined.
std::vector< std::unique_ptr< PropertyValue > > _default_properties
Storage vector for default properties.
unsigned int getPropertyId(const std::string &prop_name) const
Wrapper for MaterialStorage::getPropertyId.
Definition: MaterialData.C:80
const MaterialProperty< T > & getMaterialPropertyOld(const std::string &name, MaterialData &material_data)
Retrieve the old property deduced from the name name for the specified material_data.
const bool _mi_boundary_restricted
BoundaryRestricted flag.
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty(const std::string &name, const unsigned int state=0)
Retrieve reference to material property or one of it&#39;s old or older values.
std::set< BoundaryID > getMaterialPropertyBoundaryIDs(const std::string &name)
Retrieve the boundary ids that the material property is defined.
unsigned int id_type
The type for a material property ID.
const MaterialProperty< T > & getMaterialPropertyOldByName(const MaterialPropertyName &name)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
SubProblem & _mi_subproblem
Reference to the subproblem.
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.
const Number zero
const MaterialProperty< T > & getMaterialPropertyOldByName(const MaterialPropertyName &name, MaterialData &material_data)
Retrieve the old property named name without any deduction for the specified material_data.
const ADMaterialProperty< T > & getADMaterialProperty(const std::string &name, MaterialData &material_data)
Retrieve the AD property named "name" for the specified material_data.
MaterialPropertyName getMaterialPropertyName(const std::string &name) const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const MaterialProperty< T > & getMaterialPropertyOld(const std::string &name)
void markMatPropRequested(const std::string &)
A proxy method for _mi_feproblem.markMatPropRequested(name)
Helper class for deferred getting of material properties after the construction phase for materials...
MaterialData & _material_data
The material data class that stores properties.
bool hasADMaterialPropertyByName(const std::string &name)
const GenericOptionalMaterialProperty< T, is_ad > & value() const
std::set< SubdomainID > getMaterialPropertyBlocks(const std::string &name)
Retrieve the block ids that the material property is defined.
const MaterialProperty< T > & getMaterialPropertyOlder(const std::string &name)
virtual void resolve(M &material)=0
Wrapper around a material property pointer.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
Moose::MaterialDataType getMaterialDataType(const std::set< BoundaryID > &boundary_ids) const
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty(const std::string &name, const unsigned int state=0)
const ADMaterialProperty< T > & getADMaterialPropertyByName(const MaterialPropertyName &name)
const MaterialProperty< T > & getMaterialPropertyOlderByName(const MaterialPropertyName &name, MaterialData &material_data)
Retrieve the older property named name without any deduction for the specified material_data.
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
const MaterialProperty< T > & getMaterialPropertyOlder(const std::string &name, MaterialData &material_data)
Retrieve the older property deduced from the name name for the specified material_data.
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName(const MaterialPropertyName &name, const unsigned int state=0)
Retrieve reference to material property or its old or older value The name required by this method is...
const MaterialPropertyName _get_suffix
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty()
Return a constant zero anonymous material property.
const MaterialProperty< T > & getZeroMaterialProperty(Ts... args)
for backwards compatibility
const InputParameters & _mi_params
Parameters of the object with this interface.
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder(const std::string &name)
const ADMaterialProperty< T > & getADMaterialPropertyByName(const MaterialPropertyName &name, MaterialData &material_data)
Retrieve the AD property named "name" without any deduction for the specified material_data.
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty(const std::string &name)
bool hasMaterialProperty(const std::string &name)
Check if the material property exists.
static constexpr PropertyValue::id_type zero_property_id
The material property ID for a zero property.
MaterialBase & getMaterialByName(const std::string &name, bool no_warn=false)
void statefulPropertiesAllowed(bool)
Derived classes can declare whether or not they work with stateful material properties.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool haveADProperty(const std::string &prop_name) const
Returns true if the AD material property exists - defined by any material.
Definition: MaterialData.h:96
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty(const std::string &name)
An interface for accessing Materials.
const MaterialProperty< T > & getMaterialProperty(const std::string &name, MaterialData &material_data, const unsigned int state=0)
Retrieve the property named "name" for the specified material_data.
GenericMaterialProperty< T, is_ad > & getProperty(const std::string &prop_name, const unsigned int state, const MooseObject &requestor)
Retrieves a material property.
Definition: MaterialData.h:111
bool getMaterialPropertyCalled() const
Returns true if getMaterialProperty() has been called, false otherwise.
IntRange< T > make_range(T beg, T end)
const bool _use_interpolated_state
Use the interpolated state set up through the ProjectedStatefulMaterialStorageAction.
void addConsumedPropertyName(const MooseObjectName &obj_name, const std::string &prop_name)
GenericOptionalMaterialProperty< T, is_ad > _value
static constexpr id_type invalid_property_id
The material property ID for an invalid property We only have this because there are a few cases wher...
Proxy for accessing MaterialPropertyStorage.
Definition: MaterialData.h:33
const GenericMaterialProperty< T, is_ad > & getPossiblyConstantGenericMaterialPropertyByName(const MaterialPropertyName &prop_name, MaterialData &material_data, const unsigned int state)
Retrieve the generic property named "prop_name" without any deduction for the specified material_data...
std::vector< std::unique_ptr< OptionalMaterialPropertyProxyBase< MaterialPropertyInterface > > > _optional_property_proxies
optional material properties
void checkBlockAndBoundaryCompatibility(std::shared_ptr< MaterialBase > discrete)
Check if block and boundary restrictions of a given material are compatible with the current material...
bool _get_material_property_called
Initialized to false.
OptionalMaterialPropertyProxyBase(const std::string &name, const unsigned int state)
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.
const Moose::MaterialDataType _material_data_type
The type of data.
bool _stateful_allowed
True by default.
A class for storing the names of MooseObject by tag and object name.
MaterialBase & getMaterial(const std::string &name)
Return a MaterialBase reference - usable for computing directly.
const MooseObject & _mi_moose_object
The MooseObject creating the MaterialPropertyInterface.
const ADMaterialProperty< T > * defaultADMaterialProperty(const std::string &name)
const MaterialProperty< T > & getMaterialPropertyByName(const MaterialPropertyName &name, const unsigned int state=0)
bool hasGenericMaterialProperty(const std::string &name)
generic hasMaterialProperty helper
MaterialBases compute MaterialProperties.
Definition: MaterialBase.h:62
bool hasADMaterialProperty(const std::string &name)
std::unordered_set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld(const std::string &name)
const MaterialProperty< T > & getMaterialProperty(const std::string &name, const unsigned int state=0)
unsigned int THREAD_ID
Definition: MooseTypes.h:209
std::unordered_map< SubdomainID, std::vector< MaterialBase * > > buildRequiredMaterials(bool allow_stateful=true)
get a map of MaterialBase pointers for all material objects that this object depends on for each bloc...
OptionalMaterialPropertyProxy(const std::string &name, const unsigned int state)