MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr > Class Template Reference

#include <gradient.h>

Collaboration diagram for grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >:

Public Types

typedef GradientSizeHelper
< LhsExpr::iDimension,
RhsExpr::iDimension >
::GradientType 
GradientType
 
typedef
GradientType::scalar_func_type 
scalar_func_type
 
typedef
GradientType::scalar_deriv_type 
scalar_deriv_type
 
typedef
GradientType::vector_deriv_type 
vector_deriv_type
 
typedef LhsExpr LhsExprType
 
typedef RhsExpr RhsExprType
 

Public Member Functions

 BinaryExpr (const LhsExpr &u, const RhsExpr &v)
 
scalar_func_type dGetValue () const
 
scalar_deriv_type dGetDerivativeLocal (index_type iLocalDof) const
 
vector_deriv_type dGetDerivativeLocalVector (index_type iLocalVecDof) const
 
index_type iGetStartIndexLocal () const
 
index_type iGetEndIndexLocal () const
 
index_type iGetStartIndexLocalVector () const
 
index_type iGetEndIndexLocalVector () const
 
LocalDofMappGetDofMap () const
 
bool bHaveReferenceTo (const void *p) const
 
void Compute () const
 

Static Public Member Functions

static index_type iGetMaxDerivatives ()
 

Static Public Attributes

static const bool bAlias = LhsExpr::bAlias || RhsExpr::bAlias
 
static const index_type iMaxDerivatives = MaxDerivatives<LhsExpr, RhsExpr>::iMaxDerivatives
 
static const bool bVectorize
 
static const index_type iDimension = GradientType::iDimension
 

Private Member Functions

template<typename T >
EvalDeriv (T du_dX, T dv_dX) const
 

Private Attributes

const LhsExpr oU
 
const RhsExpr oV
 
scalar_func_type f
 
scalar_deriv_type df_du
 
scalar_deriv_type df_dv
 

Detailed Description

template<typename BinFunc, typename LhsExpr, typename RhsExpr>
class grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >

Definition at line 1324 of file gradient.h.

Member Typedef Documentation

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
typedef GradientSizeHelper<LhsExpr::iDimension, RhsExpr::iDimension>::GradientType grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::GradientType

Definition at line 1330 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
typedef LhsExpr grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::LhsExprType

Definition at line 1336 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
typedef RhsExpr grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::RhsExprType

Definition at line 1337 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
typedef GradientType::scalar_deriv_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::scalar_deriv_type

Definition at line 1333 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
typedef GradientType::scalar_func_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::scalar_func_type

Definition at line 1332 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
typedef GradientType::vector_deriv_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::vector_deriv_type

Definition at line 1334 of file gradient.h.

Constructor & Destructor Documentation

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::BinaryExpr ( const LhsExpr &  u,
const RhsExpr &  v 
)
inline

Definition at line 1339 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_du, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_dv, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::f.

1340  :oU(u), oV(v) {
1341 #if GRADIENT_DEBUG > 0
1342  f = df_du = df_dv = NAN;
1343 #endif
1344  }
const RhsExpr oV
Definition: gradient.h:1433
scalar_deriv_type df_du
Definition: gradient.h:1435
scalar_func_type f
Definition: gradient.h:1434
scalar_deriv_type df_dv
Definition: gradient.h:1435
const LhsExpr oU
Definition: gradient.h:1432

Member Function Documentation

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
bool grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::bHaveReferenceTo ( const void *  p) const
inline

Definition at line 1401 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1401  {
1402  return oU.bHaveReferenceTo(p) || oV.bHaveReferenceTo(p);
1403  }
const RhsExpr oV
Definition: gradient.h:1433
const LhsExpr oU
Definition: gradient.h:1432
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
void grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::Compute ( ) const
inline

Definition at line 1409 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_du, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_dv, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::f, GRADIENT_ASSERT, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1409  {
1410  GRADIENT_ASSERT(std::isnan(f));
1411  GRADIENT_ASSERT(std::isnan(df_du));
1412  GRADIENT_ASSERT(std::isnan(df_dv));
1413 
1414  oU.Compute();
1415  oV.Compute();
1416 
1417  const scalar_func_type u = oU.dGetValue();
1418  const scalar_func_type v = oV.dGetValue();
1419 
1420  f = BinFunc::f(u, v);
1421  df_du = BinFunc::df_du(u, v);
1422  df_dv = BinFunc::df_dv(u, v);
1423  }
const RhsExpr oV
Definition: gradient.h:1433
GradientType::scalar_func_type scalar_func_type
Definition: gradient.h:1332
scalar_deriv_type df_du
Definition: gradient.h:1435
scalar_func_type f
Definition: gradient.h:1434
scalar_deriv_type df_dv
Definition: gradient.h:1435
const LhsExpr oU
Definition: gradient.h:1432
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
scalar_deriv_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::dGetDerivativeLocal ( index_type  iLocalDof) const
inline

Definition at line 1351 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_du, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_dv, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::EvalDeriv(), grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::f, GRADIENT_ASSERT, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1351  {
1352  GRADIENT_ASSERT(!std::isnan(f));
1353  GRADIENT_ASSERT(!std::isnan(df_du));
1354  GRADIENT_ASSERT(!std::isnan(df_dv));
1355 
1356  const scalar_deriv_type du_dX = oU.dGetDerivativeLocal(iLocalDof);
1357  const scalar_deriv_type dv_dX = oV.dGetDerivativeLocal(iLocalDof);
1358 
1359  return EvalDeriv(du_dX, dv_dX);
1360  }
const RhsExpr oV
Definition: gradient.h:1433
scalar_deriv_type df_du
Definition: gradient.h:1435
GradientType::scalar_deriv_type scalar_deriv_type
Definition: gradient.h:1333
scalar_func_type f
Definition: gradient.h:1434
T EvalDeriv(T du_dX, T dv_dX) const
Definition: gradient.h:1427
scalar_deriv_type df_dv
Definition: gradient.h:1435
const LhsExpr oU
Definition: gradient.h:1432
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
vector_deriv_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::dGetDerivativeLocalVector ( index_type  iLocalVecDof) const
inline

Definition at line 1362 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_du, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::df_dv, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::EvalDeriv(), grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::f, GRADIENT_ASSERT, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1362  {
1363  GRADIENT_ASSERT(!std::isnan(f));
1364  GRADIENT_ASSERT(!std::isnan(df_du));
1365  GRADIENT_ASSERT(!std::isnan(df_dv));
1366 
1367  const vector_deriv_type du_dX = oU.dGetDerivativeLocalVector(iLocalVecDof);
1368  const vector_deriv_type dv_dX = oV.dGetDerivativeLocalVector(iLocalVecDof);
1369 
1370  return EvalDeriv(du_dX, dv_dX);
1371  }
GradientType::vector_deriv_type vector_deriv_type
Definition: gradient.h:1334
const RhsExpr oV
Definition: gradient.h:1433
scalar_deriv_type df_du
Definition: gradient.h:1435
scalar_func_type f
Definition: gradient.h:1434
T EvalDeriv(T du_dX, T dv_dX) const
Definition: gradient.h:1427
scalar_deriv_type df_dv
Definition: gradient.h:1435
const LhsExpr oU
Definition: gradient.h:1432
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
scalar_func_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::dGetValue ( ) const
inline

Definition at line 1346 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::f, and GRADIENT_ASSERT.

1346  {
1347  GRADIENT_ASSERT(!std::isnan(f));
1348  return f;
1349  }
scalar_func_type f
Definition: gradient.h:1434
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
template<typename T >
T grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::EvalDeriv ( du_dX,
dv_dX 
) const
inlineprivate
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
index_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iGetEndIndexLocal ( ) const
inline

Definition at line 1377 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1377  {
1378  return std::max(oU.iGetEndIndexLocal(), oV.iGetEndIndexLocal());
1379  }
const RhsExpr oV
Definition: gradient.h:1433
const LhsExpr oU
Definition: gradient.h:1432
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
index_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iGetEndIndexLocalVector ( ) const
inline

Definition at line 1385 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1385  {
1386  return std::max(oU.iGetEndIndexLocalVector(), oV.iGetEndIndexLocalVector());
1387  }
const RhsExpr oV
Definition: gradient.h:1433
const LhsExpr oU
Definition: gradient.h:1432
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
static index_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iGetMaxDerivatives ( )
inlinestatic

Definition at line 1405 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iMaxDerivatives.

1405  {
1406  return iMaxDerivatives;
1407  }
static const index_type iMaxDerivatives
Definition: gradient.h:1327
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
index_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iGetStartIndexLocal ( ) const
inline

Definition at line 1373 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1373  {
1374  return std::min(oU.iGetStartIndexLocal(), oV.iGetStartIndexLocal());
1375  }
const RhsExpr oV
Definition: gradient.h:1433
const LhsExpr oU
Definition: gradient.h:1432
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
index_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iGetStartIndexLocalVector ( ) const
inline

Definition at line 1381 of file gradient.h.

References grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1381  {
1382  return std::min(oU.iGetStartIndexLocalVector(), oV.iGetStartIndexLocalVector());
1383  }
const RhsExpr oV
Definition: gradient.h:1433
const LhsExpr oU
Definition: gradient.h:1432
template<typename BinFunc , typename LhsExpr , typename RhsExpr >
LocalDofMap* grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::pGetDofMap ( ) const
inline

Definition at line 1389 of file gradient.h.

References GRADIENT_ASSERT, grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oU, and grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::oV.

1389  {
1390  LocalDofMap* pDofMap = oU.pGetDofMap();
1391 
1392  if (pDofMap == 0) {
1393  pDofMap = oV.pGetDofMap();
1394  } else {
1395  GRADIENT_ASSERT(oV.pGetDofMap() == 0 || pDofMap == oV.pGetDofMap());
1396  }
1397 
1398  return pDofMap;
1399  }
const RhsExpr oV
Definition: gradient.h:1433
const LhsExpr oU
Definition: gradient.h:1432
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Member Data Documentation

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
const bool grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::bAlias = LhsExpr::bAlias || RhsExpr::bAlias
static

Definition at line 1326 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
const bool grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::bVectorize
static
Initial value:
= sizeof(typename LhsExpr::vector_deriv_type) == sizeof(typename RhsExpr::vector_deriv_type)
&& LhsExpr::bVectorize && RhsExpr::bVectorize && BinFunc::bVectorize

Definition at line 1328 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
const index_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iDimension = GradientType::iDimension
static

Definition at line 1331 of file gradient.h.

template<typename BinFunc , typename LhsExpr , typename RhsExpr >
const index_type grad::BinaryExpr< BinFunc, LhsExpr, RhsExpr >::iMaxDerivatives = MaxDerivatives<LhsExpr, RhsExpr>::iMaxDerivatives
static

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