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

#include <MooseADWrapper.h>

Public Types

typedef RankTwoTensorTempl< DualRealDNType
 

Public Member Functions

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

Private Attributes

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

Friends

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

Detailed Description

template<>
class MooseADWrapper< RankTwoTensorTempl< Real > >

Definition at line 199 of file MooseADWrapper.h.

Member Typedef Documentation

◆ DNType

Definition at line 205 of file MooseADWrapper.h.

Constructor & Destructor Documentation

◆ MooseADWrapper() [1/2]

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

Definition at line 161 of file MooseADWrapper.C.

162  : _use_ad(use_ad), _val(), _dual_number(nullptr)
163 {
164  if (_use_ad)
165  _dual_number = libmesh_make_unique<RankTwoTensorTempl<DualReal>>();
166 }
std::unique_ptr< RankTwoTensorTempl< DualReal > > _dual_number

◆ MooseADWrapper() [2/2]

Member Function Documentation

◆ copyDualNumberToValue()

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

Definition at line 187 of file MooseADWrapper.C.

188 {
189  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
190  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
191  _val(i, j) = (*_dual_number)(i, j).value();
192 }
const RankTwoTensorTempl< Real > & value() const

◆ dn() [1/2]

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

Definition at line 169 of file MooseADWrapper.C.

170 {
171  if (!_dual_number)
172  _dual_number = libmesh_make_unique<RankTwoTensorTempl<DualReal>>(_val);
173  else if (!_use_ad)
174  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
175  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
176  (*_dual_number)(i, j).value() = _val(i, j);
177  return *_dual_number;
178 }
const RankTwoTensorTempl< Real > & value() const
std::unique_ptr< RankTwoTensorTempl< DualReal > > _dual_number

◆ dn() [2/2]

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

Definition at line 181 of file MooseADWrapper.C.

182 {
183  return *_dual_number;
184 }
std::unique_ptr< RankTwoTensorTempl< DualReal > > _dual_number

◆ markAD()

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

Definition at line 195 of file MooseADWrapper.C.

196 {
197  if (!use_ad && _use_ad)
198  _dual_number = nullptr;
199  else if (use_ad && !_use_ad)
200  _dual_number = libmesh_make_unique<RankTwoTensorTempl<DualReal>>();
201  _use_ad = use_ad;
202 }
std::unique_ptr< RankTwoTensorTempl< DualReal > > _dual_number

◆ operator=() [1/2]

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

Definition at line 206 of file MooseADWrapper.C.

207 {
208  _val = rhs._val;
209  if (_dual_number && rhs._dual_number)
210  *_dual_number = *rhs._dual_number;
211  else if (_dual_number)
212  *_dual_number = 0;
213  return *this;
214 }
std::unique_ptr< RankTwoTensorTempl< DualReal > > _dual_number
std::unique_ptr< T > _dual_number

◆ operator=() [2/2]

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

◆ value() [1/2]

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

Definition at line 207 of file MooseADWrapper.h.

207 { return _val; }

◆ value() [2/2]

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

Definition at line 209 of file MooseADWrapper.h.

209 { return _val; }

Friends And Related Function Documentation

◆ dataLoad

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

◆ dataStore

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

Member Data Documentation

◆ _dual_number

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

Definition at line 227 of file MooseADWrapper.h.

◆ _use_ad

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

Definition at line 225 of file MooseADWrapper.h.

◆ _val

RankTwoTensorTempl<Real> MooseADWrapper< RankTwoTensorTempl< Real > >::_val
private

Definition at line 226 of file MooseADWrapper.h.


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