https://mooseframework.inl.gov
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
GenericOptionalMaterialProperty< T, is_ad > Class Template Reference

Wrapper around a material property pointer. More...

#include <MaterialProperty.h>

Inheritance diagram for GenericOptionalMaterialProperty< T, is_ad >:
[legend]

Public Member Functions

 GenericOptionalMaterialProperty (const P *pointer)
 
 GenericOptionalMaterialProperty (const GenericOptionalMaterialProperty< T, is_ad > &)=delete
 no copy construction is permitted More...
 
GenericOptionalMaterialPropertyoperator= (const GenericOptionalMaterialProperty< T, is_ad > &)=delete
 no copy assignment is permitted More...
 
const Moose::GenericType< T, is_ad > & operator[] (const unsigned int i) const
 pass through operator[] to provide a similar API as MaterialProperty More...
 
unsigned int size () const
 pass through size calls More...
 
 operator bool () const
 implicit cast to bool to check the if the material property exists More...
 
const Pget () const
 get a pointer to the underlying property (only do this in initialSetup or later) More...
 

Private Types

typedef GenericMaterialProperty< T, is_ad > P
 

Private Member Functions

 GenericOptionalMaterialProperty ()
 the default constructor is only called from the friend class More...
 
void set (const P *pointer)
 setting the pointer is only permitted through the optional material proxy system More...
 

Private Attributes

const P_pointer
 

Friends

class OptionalMaterialPropertyProxy< Material, T, is_ad >
 
class OptionalMaterialPropertyProxy< MaterialPropertyInterface, T, is_ad >
 

Detailed Description

template<typename T, bool is_ad>
class GenericOptionalMaterialProperty< T, is_ad >

Wrapper around a material property pointer.

Copying this wrapper is disabled to enforce capture via reference. Used by the optional material property API, which requires late binding updates of the stored pointer.

Definition at line 461 of file MaterialProperty.h.

Member Typedef Documentation

◆ P

template<typename T, bool is_ad>
typedef GenericMaterialProperty<T, is_ad> GenericOptionalMaterialProperty< T, is_ad >::P
private

Definition at line 463 of file MaterialProperty.h.

Constructor & Destructor Documentation

◆ GenericOptionalMaterialProperty() [1/3]

template<typename T, bool is_ad>
GenericOptionalMaterialProperty< T, is_ad >::GenericOptionalMaterialProperty ( const P pointer)
inline

Definition at line 466 of file MaterialProperty.h.

466 : _pointer(pointer) {}

◆ GenericOptionalMaterialProperty() [2/3]

template<typename T, bool is_ad>
GenericOptionalMaterialProperty< T, is_ad >::GenericOptionalMaterialProperty ( const GenericOptionalMaterialProperty< T, is_ad > &  )
delete

no copy construction is permitted

◆ GenericOptionalMaterialProperty() [3/3]

template<typename T, bool is_ad>
GenericOptionalMaterialProperty< T, is_ad >::GenericOptionalMaterialProperty ( )
inlineprivate

the default constructor is only called from the friend class

Definition at line 496 of file MaterialProperty.h.

496 : _pointer(nullptr) {}

Member Function Documentation

◆ get()

template<typename T, bool is_ad>
const P* GenericOptionalMaterialProperty< T, is_ad >::get ( ) const
inline

get a pointer to the underlying property (only do this in initialSetup or later)

Definition at line 492 of file MaterialProperty.h.

492 { return _pointer; }

◆ operator bool()

template<typename T, bool is_ad>
GenericOptionalMaterialProperty< T, is_ad >::operator bool ( ) const
inline

implicit cast to bool to check the if the material property exists

Definition at line 489 of file MaterialProperty.h.

489 { return _pointer; }

◆ operator=()

template<typename T, bool is_ad>
GenericOptionalMaterialProperty& GenericOptionalMaterialProperty< T, is_ad >::operator= ( const GenericOptionalMaterialProperty< T, is_ad > &  )
delete

no copy assignment is permitted

◆ operator[]()

template<typename T, bool is_ad>
const Moose::GenericType<T, is_ad>& GenericOptionalMaterialProperty< T, is_ad >::operator[] ( const unsigned int  i) const
inline

pass through operator[] to provide a similar API as MaterialProperty

Definition at line 475 of file MaterialProperty.h.

476  {
477  // check if the optional property is valid in debug mode
478  mooseAssert(
479  _pointer,
480  "Attempting to access an optional material property that was not provided by any material "
481  "class. Make sure to check optional material properties before using them.");
482  return (*_pointer)[i];
483  }

◆ set()

template<typename T, bool is_ad>
void GenericOptionalMaterialProperty< T, is_ad >::set ( const P pointer)
inlineprivate

setting the pointer is only permitted through the optional material proxy system

Definition at line 499 of file MaterialProperty.h.

499 { _pointer = pointer; }

◆ size()

template<typename T, bool is_ad>
unsigned int GenericOptionalMaterialProperty< T, is_ad >::size ( ) const
inline

pass through size calls

Definition at line 486 of file MaterialProperty.h.

486 { return (*_pointer).size(); }

Friends And Related Function Documentation

◆ OptionalMaterialPropertyProxy< Material, T, is_ad >

template<typename T, bool is_ad>
friend class OptionalMaterialPropertyProxy< Material, T, is_ad >
friend

Definition at line 502 of file MaterialProperty.h.

◆ OptionalMaterialPropertyProxy< MaterialPropertyInterface, T, is_ad >

template<typename T, bool is_ad>
friend class OptionalMaterialPropertyProxy< MaterialPropertyInterface, T, is_ad >
friend

Definition at line 503 of file MaterialProperty.h.

Member Data Documentation

◆ _pointer

template<typename T, bool is_ad>
const P* GenericOptionalMaterialProperty< T, is_ad >::_pointer
private

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