www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
ADMaterialPropertyObject< T > Class Template Reference

#include <MaterialProperty.h>

Inheritance diagram for ADMaterialPropertyObject< T >:
[legend]

Public Member Functions

 ADMaterialPropertyObject (bool use_ad=false)
 
MooseADWrapper< T >::DNType & operator[] (const unsigned int i)
 Get element i out of the array as a writeable reference. More...
 
const MooseADWrapper< T >::DNType & operator[] (const unsigned int i) const
 Get element i out of the array as a read-only reference. More...
 
const MooseArray< MooseADWrapper< T > > & get () const
 
MooseArray< MooseADWrapper< T > > & set ()
 
virtual std::string type () override
 String identifying the type of parameter stored. More...
 
virtual PropertyValueinit (int size) override
 Clone this value. More...
 
virtual void resize (int n) override
 Resizes the property to the size n. More...
 
virtual unsigned int size () const override
 
virtual void swap (PropertyValue *rhs) override
 
virtual void qpCopy (const unsigned int to_qp, PropertyValue *rhs, const unsigned int from_qp) override
 Copy the value of a Property from one specific to a specific qp in this Property. More...
 
virtual void store (std::ostream &stream) override
 Store the property into a binary stream. More...
 
virtual void load (std::istream &stream) override
 Load the property from a binary stream. More...
 
void copyDualNumberToValue (const unsigned int i) override
 copy the value portion (not the derivatives) of the DualNumber<Real> version of the material property to the Real version for the specified quadrature point More...
 
void markAD (bool use_ad) override
 Mark whether this property is in AD mode. This method is necessary for switching the state after swapping material properties during stateful material calculations. More...
 

Protected Attributes

bool _use_ad
 Whether this property was declared as AD. More...
 
std::vector< MooseADWrapper< T > > _value
 Stored parameter value. More...
 

Detailed Description

template<typename T>
class ADMaterialPropertyObject< T >

Definition at line 275 of file MaterialProperty.h.

Constructor & Destructor Documentation

◆ ADMaterialPropertyObject()

template<typename T>
ADMaterialPropertyObject< T >::ADMaterialPropertyObject ( bool  use_ad = false)
inline

Definition at line 278 of file MaterialProperty.h.

278 : MaterialProperty<T>(use_ad) {}
Concrete definition of a parameter value for a specified type.

Member Function Documentation

◆ copyDualNumberToValue()

template<typename T>
void MaterialProperty< T >::copyDualNumberToValue ( const unsigned int  i)
inlineoverridevirtualinherited

copy the value portion (not the derivatives) of the DualNumber<Real> version of the material property to the Real version for the specified quadrature point

Implements PropertyValue.

Definition at line 178 of file MaterialProperty.h.

178 { _value[i].copyDualNumberToValue(); }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ get()

template<typename T>
const MooseArray<MooseADWrapper<T> >& MaterialProperty< T >::get ( ) const
inlineinherited
Returns
a read-only reference to the parameter value.

Definition at line 115 of file MaterialProperty.h.

115 { return _value; }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ init()

template<typename T >
PropertyValue * MaterialProperty< T >::init ( int  size)
inlineoverridevirtualinherited

Clone this value.

Useful in copy-construction.

Implements PropertyValue.

Definition at line 223 of file MaterialProperty.h.

224 {
225  return _init_helper(size, this, static_cast<T *>(0), _use_ad);
226 }
bool _use_ad
Whether this property was declared as AD.
virtual unsigned int size() const override
PropertyValue * _init_helper(int size, PropertyValue *prop, const P *the_type, bool use_ad)
Scalar Init helper routine so that specialization isn&#39;t needed for basic scalar MaterialProperty type...

◆ load()

template<typename T >
void MaterialProperty< T >::load ( std::istream &  stream)
inlineoverridevirtualinherited

Load the property from a binary stream.

Implements PropertyValue.

Definition at line 268 of file MaterialProperty.h.

269 {
270  for (unsigned int i = 0; i < size(); i++)
271  loadHelper(stream, _value[i], NULL);
272 }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.
virtual unsigned int size() const override
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:727

◆ markAD()

template<typename T >
void MaterialProperty< T >::markAD ( bool  use_ad)
inlineoverridevirtualinherited

Mark whether this property is in AD mode. This method is necessary for switching the state after swapping material properties during stateful material calculations.

Implements PropertyValue.

Definition at line 207 of file MaterialProperty.h.

208 {
209  _use_ad = use_ad;
210  for (auto && moose_wrapper : _value)
211  moose_wrapper.markAD(use_ad);
212 }
bool _use_ad
Whether this property was declared as AD.
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ operator[]() [1/2]

template<typename T>
MooseADWrapper<T>::DNType& ADMaterialPropertyObject< T >::operator[] ( const unsigned int  i)
inline

Get element i out of the array as a writeable reference.

Definition at line 283 of file MaterialProperty.h.

284  {
285  return this->_value[i].dn();
286  }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ operator[]() [2/2]

template<typename T>
const MooseADWrapper<T>::DNType& ADMaterialPropertyObject< T >::operator[] ( const unsigned int  i) const
inline

Get element i out of the array as a read-only reference.

Definition at line 290 of file MaterialProperty.h.

291  {
292  return this->_value[i].dn();
293  }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ qpCopy()

template<typename T >
void MaterialProperty< T >::qpCopy ( const unsigned int  to_qp,
PropertyValue rhs,
const unsigned int  from_qp 
)
inlineoverridevirtualinherited

Copy the value of a Property from one specific to a specific qp in this Property.

Parameters
to_qpThe quadrature point in this Property that you want to copy to.
rhsThe Property you want to copy from.
from_qpThe quadrature point in rhs you want to copy from.

Implements PropertyValue.

Definition at line 250 of file MaterialProperty.h.

253 {
254  mooseAssert(rhs != NULL, "Assigning NULL?");
255  _value[to_qp] = cast_ptr<const MaterialProperty<T> *>(rhs)->_value[from_qp];
256 }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ resize()

template<typename T >
void MaterialProperty< T >::resize ( int  n)
inlineoverridevirtualinherited

Resizes the property to the size n.

Implements PropertyValue.

Definition at line 230 of file MaterialProperty.h.

Referenced by _init_helper(), MaterialPropertyInterface::getZeroMaterialProperty(), and Material::getZeroMaterialProperty().

231 {
232  auto diff = n - static_cast<int>(_value.size());
233  if (diff < 0)
234  _value.erase(_value.end() + diff, _value.end());
235  else
236  for (decltype(diff) i = 0; i < diff; ++i)
237  _value.emplace_back(MooseADWrapper<T>(_use_ad));
238 }
bool _use_ad
Whether this property was declared as AD.
std::vector< MooseADWrapper< T > > _value
Stored parameter value.
PetscInt n

◆ set()

template<typename T>
MooseArray<MooseADWrapper<T> >& MaterialProperty< T >::set ( )
inlineinherited
Returns
a writable reference to the parameter value.

Definition at line 120 of file MaterialProperty.h.

120 { return _value; }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ size()

template<typename T>
virtual unsigned int MaterialProperty< T >::size ( ) const
inlineoverridevirtualinherited

Implements PropertyValue.

Definition at line 137 of file MaterialProperty.h.

Referenced by MaterialPropertyInterface::getZeroMaterialProperty(), Material::getZeroMaterialProperty(), and MooseUtils::MaterialPropertyStorageDump().

137 { return _value.size(); }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.

◆ store()

template<typename T >
void MaterialProperty< T >::store ( std::ostream &  stream)
inlineoverridevirtualinherited

Store the property into a binary stream.

Implements PropertyValue.

Definition at line 260 of file MaterialProperty.h.

261 {
262  for (unsigned int i = 0; i < size(); i++)
263  storeHelper(stream, _value[i], NULL);
264 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:663
std::vector< MooseADWrapper< T > > _value
Stored parameter value.
virtual unsigned int size() const override

◆ swap()

template<typename T >
void MaterialProperty< T >::swap ( PropertyValue rhs)
inlineoverridevirtualinherited

Implements PropertyValue.

Definition at line 242 of file MaterialProperty.h.

243 {
244  mooseAssert(rhs != NULL, "Assigning NULL?");
245  _value.swap(cast_ptr<MaterialProperty<T> *>(rhs)->_value);
246 }
std::vector< MooseADWrapper< T > > _value
Stored parameter value.
Concrete definition of a parameter value for a specified type.

◆ type()

template<typename T >
std::string MaterialProperty< T >::type ( )
inlineoverridevirtualinherited

String identifying the type of parameter stored.

Implements PropertyValue.

Definition at line 216 of file MaterialProperty.h.

217 {
218  return typeid(T).name();
219 }

Member Data Documentation

◆ _use_ad

template<typename T>
bool MaterialProperty< T >::_use_ad
protectedinherited

Whether this property was declared as AD.

Definition at line 197 of file MaterialProperty.h.

◆ _value

template<typename T>
std::vector<MooseADWrapper<T> > MaterialProperty< T >::_value
protectedinherited

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