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

Concrete definition of a parameter value for a specified type. More...

#include <MaterialProperty.h>

Inheritance diagram for MaterialProperty< T >:
[legend]

Public Member Functions

 MaterialProperty ()
 Explicitly declare a public constructor because we made the copy constructor private. More...
 
virtual ~MaterialProperty ()
 
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
 
T & operator[] (const unsigned int i)
 Get element i out of the array as a writeable reference. More...
 
const T & operator[] (const unsigned int i) const
 Get element i out of the array as a ready-only reference. More...
 
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 copyValueToDualNumber (const unsigned int i) override
 copy the Real version to the DualNumber<Real> version of the material property for the specified quadrature point 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...
 

Protected Attributes

MooseArray< MooseADWrapper< T > > _value
 Stored parameter value. More...
 

Private Member Functions

 MaterialProperty (const MaterialProperty< T > &)
 private copy constructor to avoid shallow copying of material properties More...
 
MaterialProperty< T > & operator= (const MaterialProperty< T > &)
 private assignment operator to avoid shallow copying of material properties More...
 

Friends

template<typename P >
PropertyValue_init_helper (int size, PropertyValue *prop, const P *the_type)
 Friend helper function to handle scalar material property initializations. More...
 

Detailed Description

template<typename T>
class MaterialProperty< T >

Concrete definition of a parameter value for a specified type.

Definition at line 105 of file MaterialProperty.h.

Constructor & Destructor Documentation

◆ MaterialProperty() [1/2]

template<typename T>
MaterialProperty< T >::MaterialProperty ( )
inline

Explicitly declare a public constructor because we made the copy constructor private.

Definition at line 109 of file MaterialProperty.h.

109  : PropertyValue()
110  { /* */
111  }
Abstract definition of a property value.

◆ ~MaterialProperty()

template<typename T>
virtual MaterialProperty< T >::~MaterialProperty ( )
inlinevirtual

Definition at line 113 of file MaterialProperty.h.

113 { _value.release(); }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.
void release()
Manually deallocates the data pointer.
Definition: MooseArray.h:51

◆ MaterialProperty() [2/2]

template<typename T>
MaterialProperty< T >::MaterialProperty ( const MaterialProperty< T > &  )
inlineprivate

private copy constructor to avoid shallow copying of material properties

Definition at line 201 of file MaterialProperty.h.

202  {
203  mooseError("Material properties must be assigned to references (missing '&')");
204  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208

Member Function Documentation

◆ copyDualNumberToValue()

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

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 197 of file MaterialProperty.h.

197 { _value[i].copyDualNumberToValue(); }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.

◆ copyValueToDualNumber()

template<typename T>
void MaterialProperty< T >::copyValueToDualNumber ( const unsigned int  i)
inlineoverridevirtual

copy the Real version to the DualNumber<Real> version of the material property for the specified quadrature point

Implements PropertyValue.

Definition at line 191 of file MaterialProperty.h.

191 { _value[i].copyValueToDualNumber(); }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.

◆ get()

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

Definition at line 118 of file MaterialProperty.h.

118 { return _value; }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.

◆ init()

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

Clone this value.

Useful in copy-construction.

Implements PropertyValue.

Definition at line 228 of file MaterialProperty.h.

229 {
230  return _init_helper(size, this, static_cast<T *>(0));
231 }
friend PropertyValue * _init_helper(int size, PropertyValue *prop, const P *the_type)
Friend helper function to handle scalar material property initializations.
virtual unsigned int size() const override

◆ load()

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

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 }
MooseArray< 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:731

◆ operator=()

template<typename T>
MaterialProperty<T>& MaterialProperty< T >::operator= ( const MaterialProperty< T > &  )
inlineprivate

private assignment operator to avoid shallow copying of material properties

Definition at line 207 of file MaterialProperty.h.

208  {
209  mooseError("Material properties must be assigned to references (missing '&')");
210  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208

◆ operator[]() [1/2]

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

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

Definition at line 145 of file MaterialProperty.h.

145 { return _value[i].value(); }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.

◆ operator[]() [2/2]

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

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

Definition at line 150 of file MaterialProperty.h.

150 { return _value[i].value(); }
MooseArray< 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 
)
inlineoverridevirtual

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 }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.

◆ resize()

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

Resizes the property to the size n.

Implements PropertyValue.

Definition at line 235 of file MaterialProperty.h.

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

236 {
237  _value.resize(n);
238 }
void resize(const unsigned int size)
Change the number of elements the array can store.
Definition: MooseArray.h:200
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.
PetscInt n

◆ set()

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

Definition at line 123 of file MaterialProperty.h.

123 { return _value; }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.

◆ size()

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

Implements PropertyValue.

Definition at line 140 of file MaterialProperty.h.

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

140 { return _value.size(); }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:245

◆ store()

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

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:667
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.
virtual unsigned int size() const override

◆ swap()

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

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 }
void swap(MooseArray &rhs)
Swap memory in this object with the &#39;rhs&#39; object.
Definition: MooseArray.h:270
MooseArray< 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 ( )
inlineoverridevirtual

String identifying the type of parameter stored.

Implements PropertyValue.

Definition at line 221 of file MaterialProperty.h.

222 {
223  return typeid(T).name();
224 }

Friends And Related Function Documentation

◆ _init_helper

template<typename T>
template<typename P >
PropertyValue* _init_helper ( int  size,
PropertyValue prop,
const P *  the_type 
)
friend

Friend helper function to handle scalar material property initializations.

Parameters
size- the size corresponding to the quadrature rule
prop- The Material property that we will resize since this is not a member
the_type- This is just a template parameter used to identify the difference between the scalar and vector template functions

Definition at line 361 of file MaterialProperty.h.

362 {
364  copy->_value.resize(size, MooseADWrapper<P>{});
365  return copy;
366 }
MooseArray< MooseADWrapper< T > > _value
Stored parameter value.
Concrete definition of a parameter value for a specified type.
virtual unsigned int size() const override

Member Data Documentation

◆ _value

template<typename T>
MooseArray<MooseADWrapper<T> > MaterialProperty< T >::_value
protected

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