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 135 of file MooseADWrapper.h.

Member Typedef Documentation

◆ DNType

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

Definition at line 141 of file MooseADWrapper.h.

Constructor & Destructor Documentation

◆ MooseADWrapper() [1/2]

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

Definition at line 52 of file MooseADWrapper.C.

53  : _use_ad(use_ad), _val(), _dual_number(nullptr)
54 {
55  if (_use_ad)
56  _dual_number = libmesh_make_unique<VectorValue<DualReal>>();
57 }
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 77 of file MooseADWrapper.C.

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

◆ dn() [1/2]

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

Definition at line 60 of file MooseADWrapper.C.

61 {
62  if (!_dual_number)
63  _dual_number = libmesh_make_unique<VectorValue<DualReal>>(_val);
64  else if (!_use_ad)
65  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
66  (*_dual_number)(i).value() = _val(i);
67  return *_dual_number;
68 }
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 71 of file MooseADWrapper.C.

72 {
73  return *_dual_number;
74 }
std::unique_ptr< VectorValue< DualReal > > _dual_number

◆ markAD()

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

Definition at line 84 of file MooseADWrapper.C.

85 {
86  if (!use_ad && _use_ad)
87  _dual_number = nullptr;
88  else if (use_ad && !_use_ad)
89  _dual_number = libmesh_make_unique<VectorValue<DualReal>>();
90  _use_ad = use_ad;
91 }
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 94 of file MooseADWrapper.C.

95 {
96  _val = rhs._val;
97  if (_dual_number && rhs._dual_number)
98  *_dual_number = *rhs._dual_number;
99  else if (_dual_number)
100  *_dual_number = 0;
101  return *this;
102 }
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 143 of file MooseADWrapper.h.

143 { return _val; }

◆ value() [2/2]

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

Definition at line 145 of file MooseADWrapper.h.

145 { 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 161 of file MooseADWrapper.h.

◆ _use_ad

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

Definition at line 159 of file MooseADWrapper.h.

◆ _val

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

Definition at line 160 of file MooseADWrapper.h.


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