www.mooseframework.org
Public Member Functions | Private Member Functions | Private Attributes | 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 ()
 
MooseArray< T > & get ()
 
MooseArray< T > & set ()
 
virtual std::string type ()
 String identifying the type of parameter stored. More...
 
virtual PropertyValueinit (int size)
 Clone this value. More...
 
virtual void resize (int n)
 Resizes the property to the size n. More...
 
T & operator[] (const unsigned int i)
 Get element i out of the array. More...
 
unsigned int size () const
 
const T & operator[] (const unsigned int i) const
 Get element i out of the array. More...
 
virtual void swap (PropertyValue *rhs)
 
virtual void qpCopy (const unsigned int to_qp, PropertyValue *rhs, const unsigned int from_qp)
 Copy the value of a Property from one specific to a specific qp in this Property. More...
 
virtual void store (std::ostream &stream)
 Store the property into a binary stream. More...
 
virtual void load (std::istream &stream)
 Load the property from a binary stream. 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...
 

Private Attributes

MooseArray< T > _value
 Stored parameter value. 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...
 
template<typename P >
PropertyValue_init_helper (int size, PropertyValue *prop, const std::vector< P > *the_type)
 Friend helper function to handle vector material property initializations This function is an overload for the vector version. More...
 

Detailed Description

template<typename T>
class MaterialProperty< T >

Concrete definition of a parameter value for a specified type.

Definition at line 104 of file MaterialProperty.h.

Constructor & Destructor Documentation

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

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

Definition at line 108 of file MaterialProperty.h.

108 : PropertyValue() { /* */}
Abstract definition of a property value.
template<typename T>
virtual MaterialProperty< T >::~MaterialProperty ( )
inlinevirtual

Definition at line 110 of file MaterialProperty.h.

110 { _value.release(); }
MooseArray< T > _value
Stored parameter value.
template<typename T>
MaterialProperty< T >::MaterialProperty ( const MaterialProperty< T > &  )
inlineprivate

private copy constructor to avoid shallow copying of material properties

Definition at line 193 of file MaterialProperty.h.

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

Member Function Documentation

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

Definition at line 115 of file MaterialProperty.h.

115 { return _value; }
MooseArray< T > _value
Stored parameter value.
template<typename T >
PropertyValue * MaterialProperty< T >::init ( int  size)
inlinevirtual

Clone this value.

Useful in copy-construction.

Implements PropertyValue.

Definition at line 219 of file MaterialProperty.h.

220 {
221  return _init_helper(size, this, static_cast<T *>(0));
222 }
friend PropertyValue * _init_helper(int size, PropertyValue *prop, const P *the_type)
Friend helper function to handle scalar material property initializations.
unsigned int size() const
template<typename T >
void MaterialProperty< T >::load ( std::istream &  stream)
inlinevirtual

Load the property from a binary stream.

Implements PropertyValue.

Definition at line 259 of file MaterialProperty.h.

260 {
261  for (unsigned int i = 0; i < _value.size(); i++)
262  loadHelper(stream, _value[i], NULL);
263 }
MooseArray< T > _value
Stored parameter value.
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:592
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 199 of file MaterialProperty.h.

200  {
201  mooseError("Material properties must be assigned to references (missing '&')");
202  }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
template<typename T>
T& MaterialProperty< T >::operator[] ( const unsigned int  i)
inline

Get element i out of the array.

Definition at line 140 of file MaterialProperty.h.

140 { return _value[i]; }
MooseArray< T > _value
Stored parameter value.
template<typename T>
const T& MaterialProperty< T >::operator[] ( const unsigned int  i) const
inline

Get element i out of the array.

Definition at line 147 of file MaterialProperty.h.

147 { return _value[i]; }
MooseArray< T > _value
Stored parameter value.
template<typename T >
void MaterialProperty< T >::qpCopy ( const unsigned int  to_qp,
PropertyValue rhs,
const unsigned int  from_qp 
)
inlinevirtual

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

244 {
245  mooseAssert(rhs != NULL, "Assigning NULL?");
246  _value[to_qp] = cast_ptr<const MaterialProperty<T> *>(rhs)->_value[from_qp];
247 }
MooseArray< T > _value
Stored parameter value.
template<typename T >
void MaterialProperty< T >::resize ( int  n)
inlinevirtual

Resizes the property to the size n.

Implements PropertyValue.

Definition at line 226 of file MaterialProperty.h.

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

227 {
228  _value.resize(n);
229 }
PetscInt n
MooseArray< T > _value
Stored parameter value.
template<typename T>
MooseArray<T>& MaterialProperty< T >::set ( )
inline
Returns
a writable reference to the parameter value.

Definition at line 120 of file MaterialProperty.h.

120 { return _value; }
MooseArray< T > _value
Stored parameter value.
template<typename T>
unsigned int MaterialProperty< T >::size ( ) const
inlinevirtual

Implements PropertyValue.

Definition at line 142 of file MaterialProperty.h.

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

142 { return _value.size(); }
MooseArray< T > _value
Stored parameter value.
template<typename T >
void MaterialProperty< T >::store ( std::ostream &  stream)
inlinevirtual

Store the property into a binary stream.

Implements PropertyValue.

Definition at line 251 of file MaterialProperty.h.

252 {
253  for (unsigned int i = 0; i < _value.size(); i++)
254  storeHelper(stream, _value[i], NULL);
255 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:528
MooseArray< T > _value
Stored parameter value.
template<typename T >
void MaterialProperty< T >::swap ( PropertyValue rhs)
inlinevirtual

Implements PropertyValue.

Definition at line 233 of file MaterialProperty.h.

234 {
235  mooseAssert(rhs != NULL, "Assigning NULL?");
236  _value.swap(cast_ptr<MaterialProperty<T> *>(rhs)->_value);
237 }
Concrete definition of a parameter value for a specified type.
MooseArray< T > _value
Stored parameter value.
template<typename T >
std::string MaterialProperty< T >::type ( )
inlinevirtual

String identifying the type of parameter stored.

Implements PropertyValue.

Definition at line 212 of file MaterialProperty.h.

213 {
214  return typeid(T).name();
215 }

Friends And Related Function Documentation

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

331 {
333  copy->_value.resize(size, P{});
334  return copy;
335 }
Concrete definition of a parameter value for a specified type.
unsigned int size() const
MooseArray< T > _value
Stored parameter value.
template<typename T>
template<typename P >
PropertyValue* _init_helper ( int  size,
PropertyValue prop,
const std::vector< P > *  the_type 
)
friend

Friend helper function to handle vector material property initializations This function is an overload for the vector version.

Definition at line 340 of file MaterialProperty.h.

341 {
342  typedef MaterialProperty<std::vector<P>> PropType;
343  PropType * copy = new PropType;
344  copy->_value.resize(size, std::vector<P>{});
345 
346  // We don't know the size of the underlying vector at each
347  // quadrature point, the user will be responsible for resizing it
348  // and filling in the entries...
349 
350  // Return the copy we allocated
351  return copy;
352 }
Concrete definition of a parameter value for a specified type.
unsigned int size() const
MooseArray< T > _value
Stored parameter value.

Member Data Documentation

template<typename T>
MooseArray<T> MaterialProperty< T >::_value
private

Stored parameter value.

Definition at line 205 of file MaterialProperty.h.

Referenced by _init_helper().


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