https://mooseframework.inl.gov
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
MaterialProperties Class Reference

#include <MaterialProperty.h>

Inheritance diagram for MaterialProperties:
[legend]

Classes

class  WriteKey
 

Public Types

using values_type = typename std::vector< std::unique_ptr< PropertyValue > >
 
using iterator = DereferenceIterator< typename values_type::iterator >
 
using const_iterator = DereferenceIterator< typename values_type::const_iterator >
 

Public Member Functions

void resizeItems (const std::size_t n_qpoints, const WriteKey)
 Resize items in this array, i.e. More...
 
void resize (const std::size_t size, const WriteKey)
 
void setPointer (const std::size_t i, std::unique_ptr< PropertyValue > &&ptr, const WriteKey)
 
std::size_t size () const
 
bool empty () const
 
bool hasValue (const std::size_t i) const
 
iterator begin ()
 Begin and end iterators to the underlying data. More...
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const PropertyValueoperator[] (const std::size_t i) const
 
PropertyValueoperator[] (const std::size_t i)
 
const PropertyValuequeryValue (const std::size_t i) const
 
PropertyValuequeryValue (const std::size_t i)
 

Protected Member Functions

void setPointer (const std::size_t i, std::unique_ptr< PropertyValue > &&ptr)
 Sets the underlying unique_ptr at index i to ptr. More...
 
PropertyValueaddPointer (std::unique_ptr< PropertyValue > &&ptr)
 Adds the given object in ptr to the storage. More...
 
void resize (const std::size_t size)
 Resizes the underlying vector. More...
 
void clear ()
 Clears the underlying vector. More...
 

Detailed Description

Definition at line 392 of file MaterialProperty.h.

Member Typedef Documentation

◆ const_iterator

using UniqueStorage< PropertyValue >::const_iterator = DereferenceIterator<typename values_type::const_iterator>
inherited

Definition at line 72 of file UniqueStorage.h.

◆ iterator

using UniqueStorage< PropertyValue >::iterator = DereferenceIterator<typename values_type::iterator>
inherited

Definition at line 71 of file UniqueStorage.h.

◆ values_type

using UniqueStorage< PropertyValue >::values_type = typename std::vector<std::unique_ptr<PropertyValue > >
inherited

Definition at line 70 of file UniqueStorage.h.

Member Function Documentation

◆ addPointer()

PropertyValue & UniqueStorage< PropertyValue >::addPointer ( std::unique_ptr< PropertyValue > &&  ptr)
inlineprotectedinherited

Adds the given object in ptr to the storage.

Definition at line 153 of file UniqueStorage.h.

154  {
155  mooseAssert(ptr, "Null object");
156  return *_values.emplace_back(std::move(ptr));
157  }
values_type _values
The underlying data.

◆ begin() [1/2]

iterator UniqueStorage< PropertyValue >::begin ( )
inlineinherited

Begin and end iterators to the underlying data.

Note that dereferencing these iterators may lead to an assertion or the dereference of a nullptr whether or not the underlying data is initialized.

Definition at line 82 of file UniqueStorage.h.

82 { return iterator(_values.begin()); }
DereferenceIterator< typename values_type::iterator > iterator
Definition: UniqueStorage.h:71
values_type _values
The underlying data.

◆ begin() [2/2]

const_iterator UniqueStorage< PropertyValue >::begin ( ) const
inlineinherited

Definition at line 84 of file UniqueStorage.h.

84 { return const_iterator(_values.begin()); }
DereferenceIterator< typename values_type::const_iterator > const_iterator
Definition: UniqueStorage.h:72
values_type _values
The underlying data.

◆ clear()

void UniqueStorage< PropertyValue >::clear ( )
inlineprotectedinherited

Clears the underlying vector.

Definition at line 167 of file UniqueStorage.h.

167 { _values.clear(); }
values_type _values
The underlying data.

◆ empty()

bool UniqueStorage< PropertyValue >::empty ( ) const
inlineinherited
Returns
Whether or not the underlying storage is empty.

Definition at line 116 of file UniqueStorage.h.

116 { return _values.empty(); }
values_type _values
The underlying data.

◆ end() [1/2]

iterator UniqueStorage< PropertyValue >::end ( )
inlineinherited

Definition at line 83 of file UniqueStorage.h.

83 { return iterator(_values.end()); }
DereferenceIterator< typename values_type::iterator > iterator
Definition: UniqueStorage.h:71
values_type _values
The underlying data.

◆ end() [2/2]

const_iterator UniqueStorage< PropertyValue >::end ( ) const
inlineinherited

Definition at line 85 of file UniqueStorage.h.

85 { return const_iterator(_values.end()); }
DereferenceIterator< typename values_type::const_iterator > const_iterator
Definition: UniqueStorage.h:72
values_type _values
The underlying data.

◆ hasValue()

bool UniqueStorage< PropertyValue >::hasValue ( const std::size_t  i) const
inlineinherited
Returns
whether or not the underlying object at index is initialized

Definition at line 121 of file UniqueStorage.h.

121 { return pointerValue(i) != nullptr; }
const std::unique_ptr< PropertyValue > & pointerValue(const std::size_t i) const
Returns a read-only reference to the underlying unique pointer at index i.

◆ operator[]() [1/2]

const PropertyValue & UniqueStorage< PropertyValue >::operator[] ( const std::size_t  i) const
inlineinherited
Returns
A reference to the underlying data at index i.

Note that the underlying data may not necessarily be initialized, in which case this will throw an assertion or dereference a nullptr.

You can check whether or not the underlying data is initialized with hasValue(i).

Definition at line 98 of file UniqueStorage.h.

99  {
100  mooseAssert(hasValue(i), "Null object");
101  return *pointerValue(i);
102  }
const std::unique_ptr< PropertyValue > & pointerValue(const std::size_t i) const
Returns a read-only reference to the underlying unique pointer at index i.
bool hasValue(const std::size_t i) const

◆ operator[]() [2/2]

PropertyValue & UniqueStorage< PropertyValue >::operator[] ( const std::size_t  i)
inlineinherited

Definition at line 103 of file UniqueStorage.h.

103 { return const_cast<T &>(std::as_const(*this)[i]); }

◆ queryValue() [1/2]

const PropertyValue * UniqueStorage< PropertyValue >::queryValue ( const std::size_t  i) const
inlineinherited
Returns
A pointer to the underlying data at index i

The pointer will be nullptr if !hasValue(i), that is, if the unique_ptr at index i is not initialized

Definition at line 130 of file UniqueStorage.h.

Referenced by resizeItems().

130 { return pointerValue(i).get(); }
const std::unique_ptr< PropertyValue > & pointerValue(const std::size_t i) const
Returns a read-only reference to the underlying unique pointer at index i.

◆ queryValue() [2/2]

PropertyValue * UniqueStorage< PropertyValue >::queryValue ( const std::size_t  i)
inlineinherited

Definition at line 131 of file UniqueStorage.h.

132  {
133  return const_cast<T *>(std::as_const(*this).queryValue(i));
134  }

◆ resize() [1/2]

void UniqueStorage< PropertyValue >::resize ( const std::size_t  size)
inlineprotectedinherited

Resizes the underlying vector.

Definition at line 162 of file UniqueStorage.h.

162 { _values.resize(size); }
values_type _values
The underlying data.

◆ resize() [2/2]

void MaterialProperties::resize ( const std::size_t  size,
const WriteKey   
)
inline

Definition at line 417 of file MaterialProperty.h.

Referenced by Material::subdomainSetup().

418  {
420  }
void resize(const std::size_t size)
Resizes the underlying vector.

◆ resizeItems()

void MaterialProperties::resizeItems ( const std::size_t  n_qpoints,
const WriteKey   
)
inline

Resize items in this array, i.e.

the number of values needed in PropertyValue array

Parameters
n_qpointsThe number of values needed to store (equals the the number of quadrature points per mesh element)

Definition at line 410 of file MaterialProperty.h.

Referenced by MaterialData::resize().

411  {
412  for (const auto i : index_range(*this))
413  if (auto value = queryValue(i))
414  value->resize(n_qpoints);
415  }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const PropertyValue * queryValue(const std::size_t i) const
auto index_range(const T &sizable)

◆ setPointer() [1/2]

void UniqueStorage< PropertyValue >::setPointer ( const std::size_t  i,
std::unique_ptr< PropertyValue > &&  ptr 
)
inlineprotectedinherited

Sets the underlying unique_ptr at index i to ptr.

This can be used to construct objects in the storage, i.e., setPointer(0, std::make_unique<T>(...));

Definition at line 144 of file UniqueStorage.h.

145  {
146  mooseAssert(size() > i, "Invalid size");
147  _values[i] = std::move(ptr);
148  }
values_type _values
The underlying data.

◆ setPointer() [2/2]

void MaterialProperties::setPointer ( const std::size_t  i,
std::unique_ptr< PropertyValue > &&  ptr,
const WriteKey   
)
inline

Definition at line 422 of file MaterialProperty.h.

423  {
424  return UniqueStorage<PropertyValue>::setPointer(i, std::move(ptr));
425  }
void setPointer(const std::size_t i, std::unique_ptr< T > &&ptr)
Sets the underlying unique_ptr at index i to ptr.

◆ size()

std::size_t UniqueStorage< PropertyValue >::size ( ) const
inlineinherited
Returns
The size of the underlying storage.

Note that this is not necessarily the size of constructed objects, as underlying objects could be uninitialized

Definition at line 112 of file UniqueStorage.h.

Referenced by resize().

112 { return _values.size(); }
values_type _values
The underlying data.

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