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

Member Typedef Documentation

◆ DNType

Definition at line 219 of file MooseADWrapper.h.

Constructor & Destructor Documentation

◆ MooseADWrapper() [1/2]

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

Definition at line 167 of file MooseADWrapper.C.

168  : _use_ad(use_ad), _val(), _dual_number(nullptr)
169 {
170  if (_use_ad)
171  _dual_number = libmesh_make_unique<RankTwoTensorTempl<DualReal>>();
172 }
std::unique_ptr< RankTwoTensorTempl< DualReal > > _dual_number

◆ MooseADWrapper() [2/2]

Member Function Documentation

◆ copyDualNumberToValue()

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

Definition at line 193 of file MooseADWrapper.C.

194 {
195  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
196  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
197  _val(i, j) = (*_dual_number)(i, j).value();
198 }
const RankTwoTensorTempl< Real > & value() const

◆ dn() [1/2]

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

Definition at line 175 of file MooseADWrapper.C.

176 {
177  if (!_dual_number)
178  _dual_number = libmesh_make_unique<RankTwoTensorTempl<DualReal>>(_val);
179  else if (!_use_ad)
180  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
181  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
182  (*_dual_number)(i, j).value() = _val(i, j);
183  return *_dual_number;
184 }
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 187 of file MooseADWrapper.C.

188 {
189  return *_dual_number;
190 }
std::unique_ptr< RankTwoTensorTempl< DualReal > > _dual_number

◆ markAD()

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

Definition at line 201 of file MooseADWrapper.C.

202 {
203  if (!use_ad && _use_ad)
204  _dual_number = nullptr;
205  else if (use_ad && !_use_ad)
206  _dual_number = libmesh_make_unique<RankTwoTensorTempl<DualReal>>();
207  _use_ad = use_ad;
208 }
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 212 of file MooseADWrapper.C.

213 {
214  _val = rhs._val;
215  if (_dual_number && rhs._dual_number)
216  *_dual_number = *rhs._dual_number;
217  else if (_dual_number)
218  *_dual_number = 0;
219  return *this;
220 }
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 221 of file MooseADWrapper.h.

221 { return _val; }

◆ value() [2/2]

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

Definition at line 223 of file MooseADWrapper.h.

223 { 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 241 of file MooseADWrapper.h.

◆ _use_ad

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

Definition at line 239 of file MooseADWrapper.h.

◆ _val

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

Definition at line 240 of file MooseADWrapper.h.


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