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

Member Typedef Documentation

◆ DNType

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

Definition at line 151 of file MooseADWrapper.h.

Constructor & Destructor Documentation

◆ MooseADWrapper() [1/2]

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

Definition at line 61 of file MooseADWrapper.C.

62  : _use_ad(use_ad), _val(), _dual_number(nullptr)
63 {
64  if (_use_ad)
65  _dual_number = libmesh_make_unique<VectorValue<DualReal>>();
66 }
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 86 of file MooseADWrapper.C.

87 {
88  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
89  _val(i) = (*_dual_number)(i).value();
90 }
const VectorValue< Real > & value() const

◆ dn() [1/2]

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

Definition at line 69 of file MooseADWrapper.C.

70 {
71  if (!_dual_number)
72  _dual_number = libmesh_make_unique<VectorValue<DualReal>>(_val);
73  else if (!_use_ad)
74  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
75  (*_dual_number)(i).value() = _val(i);
76  return *_dual_number;
77 }
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 80 of file MooseADWrapper.C.

81 {
82  return *_dual_number;
83 }
std::unique_ptr< VectorValue< DualReal > > _dual_number

◆ markAD()

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

Definition at line 93 of file MooseADWrapper.C.

94 {
95  if (!use_ad && _use_ad)
96  _dual_number = nullptr;
97  else if (use_ad && !_use_ad)
98  _dual_number = libmesh_make_unique<VectorValue<DualReal>>();
99  _use_ad = use_ad;
100 }
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 103 of file MooseADWrapper.C.

104 {
105  _val = rhs._val;
106  if (_dual_number && rhs._dual_number)
107  *_dual_number = *rhs._dual_number;
108  else if (_dual_number)
109  *_dual_number = 0;
110  return *this;
111 }
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 153 of file MooseADWrapper.h.

153 { return _val; }

◆ value() [2/2]

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

Definition at line 155 of file MooseADWrapper.h.

155 { 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 171 of file MooseADWrapper.h.

◆ _use_ad

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

Definition at line 169 of file MooseADWrapper.h.

◆ _val

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

Definition at line 170 of file MooseADWrapper.h.


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