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

Member Typedef Documentation

◆ DNType

Definition at line 247 of file MooseADWrapper.h.

Constructor & Destructor Documentation

◆ MooseADWrapper() [1/2]

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

Definition at line 214 of file MooseADWrapper.C.

215  : _use_ad(use_ad), _val(), _dual_number(nullptr)
216 {
217  if (_use_ad)
218  _dual_number = libmesh_make_unique<RankThreeTensorTempl<DualReal>>();
219 }
std::unique_ptr< RankThreeTensorTempl< DualReal > > _dual_number

◆ MooseADWrapper() [2/2]

Member Function Documentation

◆ copyDualNumberToValue()

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

Definition at line 241 of file MooseADWrapper.C.

242 {
243  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
244  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
245  for (std::size_t k = 0; k < LIBMESH_DIM; ++k)
246  _val(i, j, k) = (*_dual_number)(i, j, k).value();
247 }
const RankThreeTensorTempl< Real > & value() const

◆ dn() [1/2]

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

Definition at line 222 of file MooseADWrapper.C.

223 {
224  if (!_dual_number)
225  _dual_number = libmesh_make_unique<RankThreeTensorTempl<DualReal>>(_val);
226  else if (!_use_ad)
227  for (std::size_t i = 0; i < LIBMESH_DIM; ++i)
228  for (std::size_t j = 0; j < LIBMESH_DIM; ++j)
229  for (std::size_t k = 0; k < LIBMESH_DIM; ++k)
230  (*_dual_number)(i, j, k).value() = _val(i, j, k);
231  return *_dual_number;
232 }
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 235 of file MooseADWrapper.C.

236 {
237  return *_dual_number;
238 }
std::unique_ptr< RankThreeTensorTempl< DualReal > > _dual_number

◆ markAD()

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

Definition at line 250 of file MooseADWrapper.C.

251 {
252  if (!use_ad && _use_ad)
253  _dual_number = nullptr;
254  else if (use_ad && !_use_ad)
255  _dual_number = libmesh_make_unique<RankThreeTensorTempl<DualReal>>();
256  _use_ad = use_ad;
257 }
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 261 of file MooseADWrapper.C.

262 {
263  _val = rhs._val;
264  if (_dual_number && rhs._dual_number)
265  *_dual_number = *rhs._dual_number;
266  else if (_dual_number)
267  *_dual_number = 0;
268  return *this;
269 }
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 249 of file MooseADWrapper.h.

249 { return _val; }

◆ value() [2/2]

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

Definition at line 251 of file MooseADWrapper.h.

251 { 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 269 of file MooseADWrapper.h.

◆ _use_ad

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

Definition at line 267 of file MooseADWrapper.h.

◆ _val

Definition at line 268 of file MooseADWrapper.h.


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