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

#include <MooseADWrapper.h>

Public Types

typedef RankThreeTensorTempl< DualRealDNType
 

Public Member Functions

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

Private Attributes

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

Friends

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

Detailed Description

template<>
class MooseADWrapper< RankThreeTensorTempl< Real > >

Definition at line 251 of file MooseADWrapper.h.

Member Typedef Documentation

◆ DNType

Definition at line 257 of file MooseADWrapper.h.

Constructor & Destructor Documentation

◆ MooseADWrapper() [1/2]

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

Definition at line 223 of file MooseADWrapper.C.

224  : _use_ad(use_ad), _val(), _dual_number(nullptr)
225 {
226  if (_use_ad)
227  _dual_number = libmesh_make_unique<RankThreeTensorTempl<DualReal>>();
228 }
std::unique_ptr< RankThreeTensorTempl< DualReal > > _dual_number

◆ MooseADWrapper() [2/2]

Member Function Documentation

◆ copyDualNumberToValue()

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

Definition at line 250 of file MooseADWrapper.C.

251 {
252  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
253  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
254  for (std::size_t k = 0; k < LIBMESH_DIM; ++k)
255  _val(i, j, k) = (*_dual_number)(i, j, k).value();
256 }
const RankThreeTensorTempl< Real > & value() const

◆ dn() [1/2]

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

Definition at line 231 of file MooseADWrapper.C.

232 {
233  if (!_dual_number)
234  _dual_number = libmesh_make_unique<RankThreeTensorTempl<DualReal>>(_val);
235  else if (!_use_ad)
236  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
237  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
238  for (std::size_t k = 0; k < LIBMESH_DIM; ++k)
239  (*_dual_number)(i, j, k).value() = _val(i, j, k);
240  return *_dual_number;
241 }
std::unique_ptr< RankThreeTensorTempl< DualReal > > _dual_number
const RankThreeTensorTempl< Real > & value() const

◆ dn() [2/2]

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

Definition at line 244 of file MooseADWrapper.C.

245 {
246  return *_dual_number;
247 }
std::unique_ptr< RankThreeTensorTempl< DualReal > > _dual_number

◆ markAD()

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

Definition at line 259 of file MooseADWrapper.C.

260 {
261  if (!use_ad && _use_ad)
262  _dual_number = nullptr;
263  else if (use_ad && !_use_ad)
264  _dual_number = libmesh_make_unique<RankThreeTensorTempl<DualReal>>();
265  _use_ad = use_ad;
266 }
std::unique_ptr< RankThreeTensorTempl< DualReal > > _dual_number

◆ operator=() [1/2]

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

Definition at line 270 of file MooseADWrapper.C.

271 {
272  _val = rhs._val;
273  if (_dual_number && rhs._dual_number)
274  *_dual_number = *rhs._dual_number;
275  else if (_dual_number)
276  *_dual_number = 0;
277  return *this;
278 }
std::unique_ptr< RankThreeTensorTempl< DualReal > > _dual_number
std::unique_ptr< T > _dual_number

◆ operator=() [2/2]

◆ value() [1/2]

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

Definition at line 259 of file MooseADWrapper.h.

259 { return _val; }

◆ value() [2/2]

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

Definition at line 261 of file MooseADWrapper.h.

261 { return _val; }

Friends And Related Function Documentation

◆ dataLoad

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

◆ dataStore

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

Member Data Documentation

◆ _dual_number

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

Definition at line 279 of file MooseADWrapper.h.

◆ _use_ad

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

Definition at line 277 of file MooseADWrapper.h.

◆ _val

Definition at line 278 of file MooseADWrapper.h.


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