www.mooseframework.org
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
MooseADWrapper< VectorValue< Real > > Class Template Reference

#include <MooseADWrapper.h>

Public Types

typedef VectorValue< DualRealDNType
 

Public Member Functions

 MooseADWrapper (bool use_ad=false)
 
 MooseADWrapper (MooseADWrapper< VectorValue< Real >> &&)=default
 
const VectorValue< Real > & value () const
 
VectorValue< Real > & value ()
 
const VectorValue< DualReal > & dn (bool=true) const
 
VectorValue< DualReal > & dn (bool=true)
 
void copyDualNumberToValue ()
 
void markAD (bool use_ad)
 
MooseADWrapper< VectorValue< Real > > & operator= (const MooseADWrapper< VectorValue< Real >> &)
 
MooseADWrapper< VectorValue< Real > > & operator= (MooseADWrapper< VectorValue< Real >> &&)=default
 

Private Attributes

bool _use_ad
 
VectorValue< Real > _val
 
std::unique_ptr< VectorValue< DualReal > > _dual_number
 

Friends

void dataStore (std::ostream &, MooseADWrapper< VectorValue< Real >> &, void *)
 
void dataLoad (std::istream &, MooseADWrapper< VectorValue< Real >> &, void *)
 

Detailed Description

template<>
class MooseADWrapper< VectorValue< Real > >

Definition at line 131 of file MooseADWrapper.h.

Member Typedef Documentation

◆ DNType

typedef VectorValue<DualReal> MooseADWrapper< VectorValue< Real > >::DNType

Definition at line 137 of file MooseADWrapper.h.

Constructor & Destructor Documentation

◆ MooseADWrapper() [1/2]

MooseADWrapper< VectorValue< Real > >::MooseADWrapper ( bool  use_ad = false)

Definition at line 55 of file MooseADWrapper.C.

56  : _use_ad(use_ad), _val(), _dual_number(nullptr)
57 {
58  if (_use_ad)
59  _dual_number = libmesh_make_unique<VectorValue<DualReal>>();
60 }
std::unique_ptr< VectorValue< DualReal > > _dual_number

◆ MooseADWrapper() [2/2]

MooseADWrapper< VectorValue< Real > >::MooseADWrapper ( MooseADWrapper< VectorValue< Real >> &&  )
default

Member Function Documentation

◆ copyDualNumberToValue()

void MooseADWrapper< VectorValue< Real > >::copyDualNumberToValue ( )

Definition at line 80 of file MooseADWrapper.C.

81 {
82  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
83  _val(i) = (*_dual_number)(i).value();
84 }
const VectorValue< Real > & value() const

◆ dn() [1/2]

const VectorValue< DualReal > & MooseADWrapper< VectorValue< Real > >::dn ( bool  = true) const

Definition at line 63 of file MooseADWrapper.C.

64 {
65  if (!_dual_number)
66  _dual_number = libmesh_make_unique<VectorValue<DualReal>>(_val);
67  else if (!_use_ad)
68  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
69  (*_dual_number)(i).value() = _val(i);
70  return *_dual_number;
71 }
std::unique_ptr< VectorValue< DualReal > > _dual_number
const VectorValue< Real > & value() const

◆ dn() [2/2]

VectorValue< DualReal > & MooseADWrapper< VectorValue< Real > >::dn ( bool  = true)

Definition at line 74 of file MooseADWrapper.C.

75 {
76  return *_dual_number;
77 }
std::unique_ptr< VectorValue< DualReal > > _dual_number

◆ markAD()

void MooseADWrapper< VectorValue< Real > >::markAD ( bool  use_ad)

Definition at line 87 of file MooseADWrapper.C.

88 {
89  if (!use_ad && _use_ad)
90  _dual_number = nullptr;
91  else if (use_ad && !_use_ad)
92  _dual_number = libmesh_make_unique<VectorValue<DualReal>>();
93  _use_ad = use_ad;
94 }
std::unique_ptr< VectorValue< DualReal > > _dual_number

◆ operator=() [1/2]

MooseADWrapper< VectorValue< Real > > & MooseADWrapper< VectorValue< Real > >::operator= ( const MooseADWrapper< VectorValue< Real >> &  rhs)

Definition at line 97 of file MooseADWrapper.C.

98 {
99  _val = rhs._val;
100  if (_dual_number && rhs._dual_number)
101  *_dual_number = *rhs._dual_number;
102  else if (_dual_number)
103  *_dual_number = 0;
104  return *this;
105 }
std::unique_ptr< VectorValue< DualReal > > _dual_number
std::unique_ptr< T > _dual_number

◆ operator=() [2/2]

MooseADWrapper<VectorValue<Real> >& MooseADWrapper< VectorValue< Real > >::operator= ( MooseADWrapper< VectorValue< Real >> &&  )
default

◆ value() [1/2]

const VectorValue<Real>& MooseADWrapper< VectorValue< Real > >::value ( ) const
inline

Definition at line 139 of file MooseADWrapper.h.

139 { return _val; }

◆ value() [2/2]

VectorValue<Real>& MooseADWrapper< VectorValue< Real > >::value ( )
inline

Definition at line 141 of file MooseADWrapper.h.

141 { return _val; }

Friends And Related Function Documentation

◆ dataLoad

void dataLoad ( std::istream &  ,
MooseADWrapper< VectorValue< Real >> &  ,
void *   
)
friend

◆ dataStore

void dataStore ( std::ostream &  ,
MooseADWrapper< VectorValue< Real >> &  ,
void *   
)
friend

Member Data Documentation

◆ _dual_number

std::unique_ptr<VectorValue<DualReal> > MooseADWrapper< VectorValue< Real > >::_dual_number
mutableprivate

Definition at line 157 of file MooseADWrapper.h.

◆ _use_ad

bool MooseADWrapper< VectorValue< Real > >::_use_ad
private

Definition at line 155 of file MooseADWrapper.h.

◆ _val

VectorValue<Real> MooseADWrapper< VectorValue< Real > >::_val
private

Definition at line 156 of file MooseADWrapper.h.


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