MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
grad::Gradient< N_SIZE > Class Template Reference

#include <gradient.h>

Collaboration diagram for grad::Gradient< N_SIZE >:

Public Types

typedef Gradient GradientType
 
typedef grad::scalar_func_type scalar_func_type
 
typedef MapVectorType::scalar_type scalar_deriv_type
 
typedef MapVectorType::vector_type vector_deriv_type
 

Public Member Functions

 Gradient (scalar_func_type a=0., LocalDofMap *pDofMap=0)
 
 Gradient (scalar_func_type a, const MapVectorType &da)
 
 Gradient (const Gradient &g)
 
template<index_type N_SIZE2>
 Gradient (const Gradient< N_SIZE2 > &g)
 
template<index_type N_SIZE2>
 Gradient (const Gradient< N_SIZE2 > &g, LocalDofMap *pDofMap)
 
template<typename Expression >
 Gradient (const GradientExpression< Expression > &f)
 
template<index_type N_SIZE2>
void Copy (const Gradient< N_SIZE2 > &g, LocalDofMap *pDofMap)
 
void Reset ()
 
void Reserve (index_type iSize)
 
Gradientoperator= (scalar_func_type d)
 
template<typename Expression >
Gradientoperator= (const GradientExpression< Expression > &f)
 
template<index_type N_SIZE2>
Gradientoperator= (const Gradient< N_SIZE2 > &g)
 
Gradientoperator= (const Gradient &g)
 
Gradientoperator+= (const Gradient &g)
 
Gradientoperator-= (const Gradient &g)
 
Gradientoperator*= (const Gradient &g)
 
Gradientoperator/= (const Gradient &g)
 
Gradientoperator++ ()
 
Gradientoperator-- ()
 
Gradient operator++ (int)
 
Gradient operator-- (int)
 
template<typename Expression >
Gradientoperator+= (const GradientExpression< Expression > &f)
 
template<typename Expression >
Gradientoperator-= (const GradientExpression< Expression > &f)
 
template<typename Expression >
Gradientoperator*= (const GradientExpression< Expression > &f)
 
template<typename Expression >
Gradientoperator/= (const GradientExpression< Expression > &f)
 
Gradientoperator+= (scalar_func_type d)
 
Gradientoperator-= (scalar_func_type d)
 
Gradientoperator*= (scalar_func_type d)
 
Gradientoperator/= (scalar_func_type d)
 
scalar_func_type dGetValue () const
 
void SetValue (scalar_func_type dVal)
 
void SetValuePreserve (scalar_func_type dVal)
 
scalar_deriv_type dGetDerivativeLocal (index_type iLocalDof) const
 
vector_deriv_type dGetDerivativeLocalVector (index_type iLocalVecDof) const
 
const MapVector< N_SIZE > & GetDerivativeLocal () const
 
scalar_deriv_type dGetDerivativeGlobal (index_type iGlobalDof) const
 
void DerivativeResizeReset (LocalDofMap *pMap, index_type iStartGlobal, index_type iEndGlobal, MapVectorBase::GlobalScope s, scalar_deriv_type dVal)
 
void DerivativeResizeReset (LocalDofMap *pMap, index_type iStartLocal, index_type iEndLocal, MapVectorBase::LocalScope s, scalar_deriv_type dVal)
 
void DerivativeResizeReset (LocalDofMap *pMap, index_type iGlobal, MapVectorBase::GlobalScope s, scalar_deriv_type dVal)
 
void DerivativeResizeReset (LocalDofMap *pMap, index_type iLocal, MapVectorBase::LocalScope s, scalar_deriv_type dVal)
 
void SetDerivativeLocal (index_type iLocalDof, scalar_deriv_type dCoef)
 
void SetDerivativeLocalVector (index_type iLocalVecDof, vector_deriv_type dVec)
 
void SetDerivativeGlobal (index_type iGlobalDof, scalar_deriv_type dCoef)
 
index_type iGetGlobalDof (index_type iLocalDof) const
 
index_type iGetStartIndexLocal () const
 
index_type iGetEndIndexLocal () const
 
index_type iGetStartIndexLocalVector () const
 
index_type iGetEndIndexLocalVector () const
 
index_type iGetLocalSize () const
 
index_type iGetMaxDerivatives () const
 
index_type iGetMaxDerivativesVector () const
 
bool bIsEqual (const Gradient &g) const
 
template<typename Expression >
bool bIsEqual (const GradientExpression< Expression > &g) const
 
LocalDofMappGetDofMap () const
 
bool bHaveReferenceTo (const void *p) const
 

Static Public Attributes

static const index_type iDimension = N_SIZE
 
static const index_type iMaxDerivatives = MapVectorType::iMaxSize
 

Private Types

typedef MapVector< N_SIZE > MapVectorType
 

Private Member Functions

template<typename Expression >
void ApplyNoAlias (const GradientExpression< Expression > &f)
 
template<typename Expression >
void ApplyWithAlias (const GradientExpression< Expression > &f)
 
template<typename Expression >
void ApplyDerivative (const GradientExpression< Expression > &f)
 
template<typename BinFunc , typename Expression >
void ApplyBinaryFunction (const GradientExpression< Expression > &f)
 
template<typename BinFunc , typename Expression >
void ApplyBinaryFunctionNoAlias (const GradientExpression< Expression > &f, const BinFunc &)
 
template<typename BinFunc , typename Expression >
void ApplyBinaryFunctionWithAlias (const GradientExpression< Expression > &f, const BinFunc &)
 

Private Attributes

scalar_func_type a
 
MapVectorType ad
 

Friends

struct ApplyAliasHelper< true >
 
struct ApplyAliasHelper< false >
 

Detailed Description

template<index_type N_SIZE>
class grad::Gradient< N_SIZE >

Definition at line 107 of file gradient.h.

Member Typedef Documentation

template<index_type N_SIZE>
typedef Gradient grad::Gradient< N_SIZE >::GradientType

Definition at line 2240 of file gradient.h.

template<index_type N_SIZE>
typedef MapVector<N_SIZE> grad::Gradient< N_SIZE >::MapVectorType
private

Definition at line 2237 of file gradient.h.

template<index_type N_SIZE>
typedef MapVectorType::scalar_type grad::Gradient< N_SIZE >::scalar_deriv_type

Definition at line 2244 of file gradient.h.

template<index_type N_SIZE>
typedef grad::scalar_func_type grad::Gradient< N_SIZE >::scalar_func_type

Definition at line 2243 of file gradient.h.

template<index_type N_SIZE>
typedef MapVectorType::vector_type grad::Gradient< N_SIZE >::vector_deriv_type

Definition at line 2245 of file gradient.h.

Constructor & Destructor Documentation

template<index_type N_SIZE>
grad::Gradient< N_SIZE >::Gradient ( scalar_func_type  a = 0.,
LocalDofMap pDofMap = 0 
)
inlineexplicit

Definition at line 2247 of file gradient.h.

Referenced by grad::Gradient< N_SIZE >::ApplyBinaryFunctionWithAlias(), grad::Gradient< N_SIZE >::ApplyWithAlias(), and grad::Gradient< N_SIZE >::bIsEqual().

2248  :a(a), ad(pDofMap){
2249  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
grad::Gradient< N_SIZE >::Gradient ( scalar_func_type  a,
const MapVectorType da 
)
inline

Definition at line 2251 of file gradient.h.

2252  :a(a), ad(da) {
2253 
2254  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
grad::Gradient< N_SIZE >::Gradient ( const Gradient< N_SIZE > &  g)
inline

Definition at line 2256 of file gradient.h.

2257  :a(g.a), ad(g.ad) {
2258 
2259  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
template<index_type N_SIZE2>
grad::Gradient< N_SIZE >::Gradient ( const Gradient< N_SIZE2 > &  g)
inline

Definition at line 2262 of file gradient.h.

2263  :a(g.a), ad(g.ad) {
2264 
2265  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
template<index_type N_SIZE2>
grad::Gradient< N_SIZE >::Gradient ( const Gradient< N_SIZE2 > &  g,
LocalDofMap pDofMap 
)
inline

Definition at line 2268 of file gradient.h.

References grad::Gradient< N_SIZE >::a, and grad::Gradient< N_SIZE >::Copy().

2268  {
2269 #if GRADIENT_DEBUG > 0
2270  a = NAN;
2271 #endif
2272  Copy(g, pDofMap);
2273  }
scalar_func_type a
Definition: gradient.h:2822
void Copy(const Gradient< N_SIZE2 > &g, LocalDofMap *pDofMap)
Definition: gradient.h:2289

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename Expression >
grad::Gradient< N_SIZE >::Gradient ( const GradientExpression< Expression > &  f)
inline

Definition at line 2276 of file gradient.h.

References grad::Gradient< N_SIZE >::a, grad::Gradient< N_SIZE >::ApplyDerivative(), and GRADIENT_ASSERT.

2277  :ad(f.pGetDofMap(), f.iGetStartIndexLocal(), f.iGetEndIndexLocal(), MapVector<N_SIZE>::LOCAL, 0.) {
2278 
2279  // No aliases are possible because the object did not exist before
2280  GRADIENT_ASSERT(!f.bHaveReferenceTo(this));
2281 
2282  f.Compute();
2283  a = f.dGetValue();
2284 
2285  ApplyDerivative(f);
2286  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
void ApplyDerivative(const GradientExpression< Expression > &f)
Definition: gradient.h:2661
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

Member Function Documentation

template<index_type N_SIZE>
template<typename BinFunc , typename Expression >
void grad::Gradient< N_SIZE >::ApplyBinaryFunction ( const GradientExpression< Expression > &  f)
inlineprivate

Definition at line 2672 of file gradient.h.

2672  {
2673  ApplyAliasHelper<GradientExpression<Expression>::bAlias>::ApplyBinaryFunction(*this, f, BinFunc());
2674  }
void ApplyBinaryFunction(const GradientExpression< Expression > &f)
Definition: gradient.h:2672
template<index_type N_SIZE>
template<typename BinFunc , typename Expression >
void grad::Gradient< N_SIZE >::ApplyBinaryFunctionNoAlias ( const GradientExpression< Expression > &  f,
const BinFunc &   
)
inlineprivate

Definition at line 2677 of file gradient.h.

References grad::Gradient< N_SIZE >::a, grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, GRADIENT_TRACE, grad::Gradient< N_SIZE >::iGetEndIndexLocal(), grad::LocalDofMap::iGetGlobalDof(), grad::LocalDofMap::iGetLocalIndex(), grad::Gradient< N_SIZE >::iGetStartIndexLocal(), grad::LocalDofMap::INVALID_INDEX, grad::MapVectorBase::LOCAL, and grad::Gradient< N_SIZE >::pGetDofMap().

2677  {
2678  typedef typename MaxSizeCheck<iMaxDerivatives >= Expression::iMaxDerivatives>::CheckType check_iMaxDerivatives;
2679  const bool bVectorize = sizeof(vector_deriv_type) == sizeof(typename GradientExpression<Expression>::vector_deriv_type)
2680  && GradientExpression<Expression>::bVectorize;
2681 
2682  GRADIENT_ASSERT(!f.bHaveReferenceTo(this));
2683  LocalDofMap* pDofMap = pGetDofMap();
2684  LocalDofMap* pDofMap2 = f.pGetDofMap();
2685 
2686  if (pDofMap2 == 0) {
2687  pDofMap2 = pDofMap;
2688  }
2689 
2690  if (pDofMap == 0) {
2691  pDofMap = pDofMap2;
2692  }
2693 
2694  f.Compute();
2695 
2696  const scalar_func_type u = a;
2697  const scalar_func_type v = f.dGetValue();
2698 
2699  a = BinFunc::f(u, v);
2700  const scalar_deriv_type df_du = BinFunc::df_du(u, v);
2701  const scalar_deriv_type df_dv = BinFunc::df_dv(u, v);
2702 
2703  const index_type iStartFunc = f.iGetStartIndexLocal();
2704  const index_type iEndFunc = f.iGetEndIndexLocal();
2705 
2706  if (pDofMap == pDofMap2) {
2707  index_type iStartLocal = std::min(iGetStartIndexLocal(), iStartFunc);
2708  index_type iEndLocal = std::max(iGetEndIndexLocal(), iEndFunc);
2709 
2710  ad.ResizePreserve(pDofMap, iStartLocal, iEndLocal, MapVector<N_SIZE>::LOCAL);
2711 
2712  if (df_du == 1.) {
2713  // Optimize for operator+=() and operator-=()
2714  iStartLocal = iStartFunc;
2715  iEndLocal = iEndFunc;
2716  }
2717 
2718  ApplyDerivativeHelper<bVectorize>::ApplyBinaryFunction1(ad, f, iStartLocal, iEndLocal, df_du, df_dv);
2719  } else {
2720  index_type iFirstLocal = std::numeric_limits<index_type>::max();
2721  index_type iLastLocal = 0;
2722 
2723  for (index_type i = iStartFunc; i < iEndFunc; ++i) {
2724  if (f.dGetDerivativeLocal(i) == 0.) {
2725  // FIXME: In case of complex expressions, this extra function call might be expensive
2726 
2727  // FIXME: Checking for zero could cause problems with the KLU linear solver
2728  // because the matrix structure could change.
2729  // But we have to omit zeros here, otherwise we could allocate
2730  // too much local degrees of freedom and cause a buffer overflow
2731  // in case of stack based Gradients.
2732  continue;
2733  }
2734 
2735  const index_type iGlobal = pDofMap2->iGetGlobalDof(i);
2736  const index_type iLocal = pDofMap->AllocateLocalDof(iGlobal);
2737 
2738  if (iLocal < iFirstLocal) {
2739  iFirstLocal = iLocal;
2740  }
2741 
2742  if (iLocal > iLastLocal) {
2743  iLastLocal = iLocal;
2744  }
2745  }
2746 
2747  ++iLastLocal;
2748 
2749  if (iLastLocal <= iFirstLocal) {
2750  // empty vector
2751  iFirstLocal = std::numeric_limits<index_type>::max();
2752  iLastLocal = 0;
2753  }
2754 
2755  GRADIENT_TRACE("iFirstLocal=" << iFirstLocal << std::endl);
2756  GRADIENT_TRACE("iLastLocal=" << iLastLocal << std::endl);
2757  GRADIENT_TRACE("*pDofMap=" << *pDofMap << std::endl);
2758 
2759  ad.ResizePreserve(pDofMap,
2760  std::min(ad.iGetStartIndexLocal(), iFirstLocal),
2761  std::max(ad.iGetEndIndexLocal(), iLastLocal),
2763 
2764  GRADIENT_TRACE("*pDofMap2=" << *pDofMap2 << std::endl);
2765  GRADIENT_TRACE("*pDofMap=" << *pDofMap << std::endl);
2766  GRADIENT_TRACE("ad=" << ad.iGetStartIndexLocal() << ":" << ad.iGetEndIndexLocal() << std::endl);
2767 
2768  if (df_du == 1.) {
2769  // optimized loop for operator+= and operator-=
2770  for (index_type i = iStartFunc; i < iEndFunc; ++i) {
2771  const scalar_deriv_type vd = f.dGetDerivativeLocal(i);
2772 
2773  if (vd == 0.) {
2774  // no effect for the current index
2775  continue;
2776  }
2777 
2778  const index_type iGlobal = pDofMap2->iGetGlobalDof(i);
2779  const index_type iLocal = pDofMap->iGetLocalIndex(iGlobal);
2780 
2781  GRADIENT_ASSERT(iLocal != LocalDofMap::INVALID_INDEX); // because vd != 0
2782 
2783  const scalar_deriv_type ud = ad.dGetLocalVector(iLocal);
2784 
2785  GRADIENT_TRACE("i=" << i << " iLocal=" << iLocal << " ud=" << ud << " vd=" << vd << std::endl);
2786 
2787  ad.SetLocalVector(iLocal, ud + df_dv * vd);
2788  }
2789  } else {
2790  // generic loop for operator*= and operator/=
2791  for (index_type i = ad.iGetStartIndexLocal(); i < ad.iGetEndIndexLocal(); ++i) {
2792  const scalar_deriv_type ud = ad.dGetLocalVector(i);
2793  const index_type iGlobal = pDofMap->iGetGlobalDof(i);
2794  const index_type iLocal2 = pDofMap2->iGetLocalIndex(iGlobal);
2795  scalar_deriv_type vd;
2796 
2797  if (iLocal2 == LocalDofMap::INVALID_INDEX) {
2798  // Note: It can happen that there is no
2799  // corresponding entry in pDofMap2.
2800  // However it should be safe to ignore such entries.
2801  vd = 0.;
2802  } else {
2803  vd = f.dGetDerivativeLocal(iLocal2);
2804  }
2805 
2806  GRADIENT_TRACE("i=" << i << " iLocal2=" << iLocal2 << " ud=" << ud << " vd=" << vd << std::endl);
2807 
2808  ad.SetLocalVector(i, df_du * ud + df_dv * vd);
2809  }
2810  }
2811  }
2812  }
index_type iGetStartIndexLocal() const
Definition: gradient.h:2576
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
grad::scalar_func_type scalar_func_type
Definition: gradient.h:2243
integer index_type
Definition: gradient.h:104
#define GRADIENT_TRACE(expr)
Definition: gradient.h:85
MapVectorType::scalar_type scalar_deriv_type
Definition: gradient.h:2244
LocalDofMap * pGetDofMap() const
Definition: gradient.h:2626
static const index_type INVALID_INDEX
Definition: gradient.h:1051
RangeVectorBase< scalar_func_type >::vector_type vector_deriv_type
Definition: gradient.h:375
MapVectorType::vector_type vector_deriv_type
Definition: gradient.h:2245
index_type iGetEndIndexLocal() const
Definition: gradient.h:2580
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename BinFunc , typename Expression >
void grad::Gradient< N_SIZE >::ApplyBinaryFunctionWithAlias ( const GradientExpression< Expression > &  f,
const BinFunc &   
)
inlineprivate

Definition at line 2815 of file gradient.h.

References grad::Gradient< N_SIZE >::Gradient().

2815  {
2816  typedef typename MaxSizeCheck<iMaxDerivatives >= Expression::iMaxDerivatives>::CheckType check_iMaxDerivatives;
2817 
2818  *this = Gradient(GradientExpression<BinaryExpr<BinFunc, DirectExpr<Gradient>, Expression> >(*this, f));
2819  }
Gradient(scalar_func_type a=0., LocalDofMap *pDofMap=0)
Definition: gradient.h:2247

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename Expression >
void grad::Gradient< N_SIZE >::ApplyDerivative ( const GradientExpression< Expression > &  f)
inlineprivate

Definition at line 2661 of file gradient.h.

References grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, and grad::Gradient< N_SIZE >::iGetMaxDerivatives().

Referenced by grad::Gradient< N_SIZE >::ApplyNoAlias(), and grad::Gradient< N_SIZE >::Gradient().

2661  {
2662  // compile time check for the maximum number of derivatives
2663  typedef typename MaxSizeCheck<iMaxDerivatives >= Expression::iMaxDerivatives>::CheckType check_iMaxDerivatives;
2664  const bool bVectorize = sizeof(vector_deriv_type) == sizeof(typename GradientExpression<Expression>::vector_deriv_type)
2665  && GradientExpression<Expression>::bVectorize;
2666  GRADIENT_ASSERT(f.iGetMaxDerivatives() <= iGetMaxDerivatives());
2667 
2668  ApplyDerivativeHelper<bVectorize>::ApplyDerivative(ad, f);
2669  }
MapVectorType ad
Definition: gradient.h:2823
RangeVectorBase< scalar_func_type >::vector_type vector_deriv_type
Definition: gradient.h:375
MapVectorType::vector_type vector_deriv_type
Definition: gradient.h:2245
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
index_type iGetMaxDerivatives() const
Definition: gradient.h:2596

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename Expression >
void grad::Gradient< N_SIZE >::ApplyNoAlias ( const GradientExpression< Expression > &  f)
inlineprivate

Definition at line 2639 of file gradient.h.

References grad::Gradient< N_SIZE >::a, grad::Gradient< N_SIZE >::ad, grad::Gradient< N_SIZE >::ApplyDerivative(), GRADIENT_ASSERT, and grad::Gradient< N_SIZE >::iGetMaxDerivatives().

2639  {
2640  GRADIENT_ASSERT(f.iGetMaxDerivatives() <= iGetMaxDerivatives());
2641  GRADIENT_ASSERT(!f.bHaveReferenceTo(this));
2642 
2643  f.Compute();
2644 
2645  a = f.dGetValue();
2646 
2647  ad.ResizeReset(f.pGetDofMap(), f.iGetStartIndexLocal(), f.iGetEndIndexLocal(), MapVector<N_SIZE>::LOCAL, 0.);
2648 
2649  ApplyDerivative(f);
2650  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
void ApplyDerivative(const GradientExpression< Expression > &f)
Definition: gradient.h:2661
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
index_type iGetMaxDerivatives() const
Definition: gradient.h:2596

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename Expression >
void grad::Gradient< N_SIZE >::ApplyWithAlias ( const GradientExpression< Expression > &  f)
inlineprivate

Definition at line 2653 of file gradient.h.

References grad::Gradient< N_SIZE >::Gradient().

2653  {
2654  // Attention: If we have an expression like a = (a + x)
2655  // we must not overwrite the contents of a
2656  // until the expression (a + x) has been evaluated
2657  *this = Gradient(f);
2658  }
Gradient(scalar_func_type a=0., LocalDofMap *pDofMap=0)
Definition: gradient.h:2247

Here is the call graph for this function:

template<index_type N_SIZE>
bool grad::Gradient< N_SIZE >::bHaveReferenceTo ( const void *  p) const
inline

Definition at line 2630 of file gradient.h.

2630  {
2631  return this == p;
2632  }
template<index_type N_SIZE>
bool grad::Gradient< N_SIZE >::bIsEqual ( const Gradient< N_SIZE > &  g) const
inline

Definition at line 2604 of file gradient.h.

References grad::Gradient< N_SIZE >::dGetDerivativeLocal(), grad::Gradient< N_SIZE >::dGetValue(), grad::Gradient< N_SIZE >::iGetEndIndexLocal(), and grad::Gradient< N_SIZE >::iGetStartIndexLocal().

Referenced by grad::Gradient< N_SIZE >::bIsEqual(), testGradientLin(), testMatVecGradient(), and testMatVecProductGradient().

2604  {
2605  if (dGetValue() != g.dGetValue()) {
2606  return false;
2607  }
2608 
2609  const index_type iStart = std::min(iGetStartIndexLocal(), g.iGetStartIndexLocal());
2610  const index_type iEnd = std::max(iGetEndIndexLocal(), g.iGetEndIndexLocal());
2611 
2612  for (index_type i = iStart; i < iEnd; ++i) {
2613  if (dGetDerivativeLocal(i) != g.dGetDerivativeLocal(i)) {
2614  return false;
2615  }
2616  }
2617 
2618  return true;
2619  }
index_type iGetStartIndexLocal() const
Definition: gradient.h:2576
integer index_type
Definition: gradient.h:104
scalar_func_type dGetValue() const
Definition: gradient.h:2502
scalar_deriv_type dGetDerivativeLocal(index_type iLocalDof) const
Definition: gradient.h:2516
index_type iGetEndIndexLocal() const
Definition: gradient.h:2580

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename Expression >
bool grad::Gradient< N_SIZE >::bIsEqual ( const GradientExpression< Expression > &  g) const
inline

Definition at line 2622 of file gradient.h.

References grad::Gradient< N_SIZE >::bIsEqual(), and grad::Gradient< N_SIZE >::Gradient().

2622  {
2623  return bIsEqual(Gradient(g));
2624  }
bool bIsEqual(const Gradient &g) const
Definition: gradient.h:2604
Gradient(scalar_func_type a=0., LocalDofMap *pDofMap=0)
Definition: gradient.h:2247

Here is the call graph for this function:

template<index_type N_SIZE>
template<index_type N_SIZE2>
void grad::Gradient< N_SIZE >::Copy ( const Gradient< N_SIZE2 > &  g,
LocalDofMap pDofMap 
)
inline

Definition at line 2289 of file gradient.h.

References grad::Gradient< N_SIZE >::a, grad::Gradient< N_SIZE >::ad, grad::LocalDofMap::AllocateLocalDof(), GRADIENT_ASSERT, GRADIENT_TRACE, grad::LocalDofMap::iGetGlobalDof(), grad::LocalDofMap::iGetLocalIndex(), grad::LocalDofMap::INVALID_INDEX, and grad::MapVectorBase::LOCAL.

Referenced by grad::Gradient< N_SIZE >::Gradient().

2289  {
2290  LocalDofMap* pDofMap2 = g.pGetDofMap();
2291 
2292  index_type iFirstLocal = std::numeric_limits<index_type>::max();
2293  index_type iLastLocal = 0;
2294 
2295  GRADIENT_TRACE("g=" << g << std::endl);
2296  GRADIENT_TRACE("*pDofMap=" << *pDofMap << std::endl);
2297  GRADIENT_TRACE("*pDofMap2=" << *pDofMap2 << std::endl);
2298 
2299  for (index_type i = g.iGetStartIndexLocal(); i < g.iGetEndIndexLocal(); ++i) {
2300  if (g.dGetDerivativeLocal(i) == 0.) {
2301  // FIXME: Checking for zero could cause problems with the KLU linear solver
2302  // because the matrix structure could change.
2303  // But we have to omit zeros here, otherwise we could allocate
2304  // too much local degrees of freedom and cause a buffer overflow
2305  // in case of stack based Gradients.
2306  continue;
2307  }
2308 
2309  const index_type iGlobal = pDofMap2->iGetGlobalDof(i);
2310  const index_type iLocal = pDofMap->AllocateLocalDof(iGlobal);
2311 
2312  if (iLocal < iFirstLocal) {
2313  iFirstLocal = iLocal;
2314  }
2315 
2316  if (iLocal > iLastLocal) {
2317  iLastLocal = iLocal;
2318  }
2319  }
2320 
2321  ++iLastLocal;
2322 
2323  if (iLastLocal <= iFirstLocal) {
2324  iFirstLocal = iLastLocal = 0;
2325  }
2326 
2327  GRADIENT_TRACE("*pDofMap=" << *pDofMap << std::endl);
2328 
2329  a = g.dGetValue();
2330  ad.ResizeReset(pDofMap, iFirstLocal, iLastLocal, MapVectorBase::LOCAL, 0.);
2331 
2332  GRADIENT_TRACE("*pDofMap2=" << *pDofMap2 << std::endl);
2333  GRADIENT_TRACE("*pDofMap=" << *pDofMap << std::endl);
2334 
2335  for (index_type i = iFirstLocal; i < iLastLocal; ++i) {
2336  const index_type iGlobal = pDofMap->iGetGlobalDof(i);
2337  const index_type iLocal2 = pDofMap2->iGetLocalIndex(iGlobal);
2338 
2339  if (iLocal2 == LocalDofMap::INVALID_INDEX) {
2340  // Note: It can happen that there is no
2341  // corresponding entry in pDofMap2.
2342  // However it should be safe to ignore such entries.
2343  continue;
2344  }
2345 
2346  ad.SetLocalVector(i, g.dGetDerivativeLocal(iLocal2));
2347  }
2348 
2349 #if GRADIENT_DEBUG > 0
2350  for (index_type i = iFirstLocal; i < iLastLocal; ++i) {
2351  const index_type iGlobal = ad.iGetGlobalDof(i);
2352  const index_type iLocal2 = g.pGetDofMap()->iGetLocalIndex(iGlobal);
2353  if (iLocal2 != LocalDofMap::INVALID_INDEX) {
2354  GRADIENT_ASSERT(g.dGetDerivativeGlobal(iGlobal) == ad.dGetLocalVector(i));
2355  }
2356  }
2357 
2358  for (index_type i = g.iGetStartIndexLocal(); i < g.iGetEndIndexLocal(); ++i) {
2359  if (g.dGetDerivativeLocal(i) != 0.) {
2360  const index_type iGlobal = g.iGetGlobalDof(i);
2361  GRADIENT_ASSERT(ad.dGetGlobalVector(iGlobal) == g.dGetDerivativeLocal(i));
2362  }
2363  }
2364 #endif
2365  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
integer index_type
Definition: gradient.h:104
#define GRADIENT_TRACE(expr)
Definition: gradient.h:85
static const index_type INVALID_INDEX
Definition: gradient.h:1051
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::DerivativeResizeReset ( LocalDofMap pMap,
index_type  iStartGlobal,
index_type  iEndGlobal,
MapVectorBase::GlobalScope  s,
scalar_deriv_type  dVal 
)
inline
template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::DerivativeResizeReset ( LocalDofMap pMap,
index_type  iStartLocal,
index_type  iEndLocal,
MapVectorBase::LocalScope  s,
scalar_deriv_type  dVal 
)
inline

Definition at line 2542 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

2542  {
2543  ad.ResizeReset(pMap, iStartLocal, iEndLocal, s, dVal);
2544  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::DerivativeResizeReset ( LocalDofMap pMap,
index_type  iGlobal,
MapVectorBase::GlobalScope  s,
scalar_deriv_type  dVal 
)
inline

Definition at line 2546 of file gradient.h.

References grad::Gradient< N_SIZE >::DerivativeResizeReset().

2546  {
2547  DerivativeResizeReset(pMap, iGlobal, iGlobal + 1, s, dVal);
2548  }
void DerivativeResizeReset(LocalDofMap *pMap, index_type iStartGlobal, index_type iEndGlobal, MapVectorBase::GlobalScope s, scalar_deriv_type dVal)
Definition: gradient.h:2538

Here is the call graph for this function:

template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::DerivativeResizeReset ( LocalDofMap pMap,
index_type  iLocal,
MapVectorBase::LocalScope  s,
scalar_deriv_type  dVal 
)
inline

Definition at line 2550 of file gradient.h.

References grad::Gradient< N_SIZE >::DerivativeResizeReset().

2550  {
2551  DerivativeResizeReset(pMap, iLocal, iLocal + 1, s, dVal);
2552  }
void DerivativeResizeReset(LocalDofMap *pMap, index_type iStartGlobal, index_type iEndGlobal, MapVectorBase::GlobalScope s, scalar_deriv_type dVal)
Definition: gradient.h:2538

Here is the call graph for this function:

template<index_type N_SIZE>
scalar_deriv_type grad::Gradient< N_SIZE >::dGetDerivativeGlobal ( index_type  iGlobalDof) const
inline

Definition at line 2532 of file gradient.h.

References grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, and grad::Gradient< N_SIZE >::iGetMaxDerivatives().

Referenced by func2ad(), testDifferentDofMaps(), testGradient(), testMatVecProductGradient_testData::testGradient(), testGradient2(), testGradientLin(), and testMatVecCopy().

2532  {
2533  GRADIENT_ASSERT(ad.pGetDofMap()->iGetLocalIndex(iGlobalDof) >= 0);
2534  GRADIENT_ASSERT(ad.pGetDofMap()->iGetLocalIndex(iGlobalDof) < iGetMaxDerivatives());
2535  return ad.dGetGlobalVector(iGlobalDof);
2536  }
MapVectorType ad
Definition: gradient.h:2823
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
index_type iGetMaxDerivatives() const
Definition: gradient.h:2596

Here is the call graph for this function:

template<index_type N_SIZE>
scalar_deriv_type grad::Gradient< N_SIZE >::dGetDerivativeLocal ( index_type  iLocalDof) const
inline

Definition at line 2516 of file gradient.h.

References grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, and grad::Gradient< N_SIZE >::iGetMaxDerivatives().

Referenced by grad::GradientAssVec< Gradient< N_SIZE > >::AddItem(), bCompare(), and grad::Gradient< N_SIZE >::bIsEqual().

2516  {
2517  GRADIENT_ASSERT(iLocalDof >= 0);
2518  GRADIENT_ASSERT(iLocalDof < iGetMaxDerivatives());
2519  return ad.dGetLocalVector(iLocalDof);
2520  }
MapVectorType ad
Definition: gradient.h:2823
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
index_type iGetMaxDerivatives() const
Definition: gradient.h:2596

Here is the call graph for this function:

template<index_type N_SIZE>
vector_deriv_type grad::Gradient< N_SIZE >::dGetDerivativeLocalVector ( index_type  iLocalVecDof) const
inline

Definition at line 2522 of file gradient.h.

References grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, and grad::Gradient< N_SIZE >::iGetMaxDerivativesVector().

2522  {
2523  GRADIENT_ASSERT(iLocalVecDof >= 0);
2524  GRADIENT_ASSERT(iLocalVecDof < iGetMaxDerivativesVector());
2525  return ad.dGetLocalVectorVector(iLocalVecDof);
2526  }
MapVectorType ad
Definition: gradient.h:2823
index_type iGetMaxDerivativesVector() const
Definition: gradient.h:2600
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<index_type N_SIZE>
scalar_func_type grad::Gradient< N_SIZE >::dGetValue ( ) const
inline
template<index_type N_SIZE>
const MapVector<N_SIZE>& grad::Gradient< N_SIZE >::GetDerivativeLocal ( ) const
inline

Definition at line 2528 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

2528  {
2529  return ad;
2530  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
index_type grad::Gradient< N_SIZE >::iGetEndIndexLocalVector ( ) const
inline

Definition at line 2588 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

Referenced by grad::Gradient< N_SIZE >::SetDerivativeLocalVector().

2588  {
2589  return ad.iGetEndIndexLocalVector();
2590  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
index_type grad::Gradient< N_SIZE >::iGetGlobalDof ( index_type  iLocalDof) const
inline

Definition at line 2572 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

Referenced by grad::GradientAssVec< Gradient< N_SIZE > >::AddItem().

2572  {
2573  return ad.iGetGlobalDof(iLocalDof);
2574  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
index_type grad::Gradient< N_SIZE >::iGetLocalSize ( ) const
inline

Definition at line 2592 of file gradient.h.

References grad::Gradient< N_SIZE >::iGetEndIndexLocal(), and grad::Gradient< N_SIZE >::iGetStartIndexLocal().

2592  {
2594  }
index_type iGetStartIndexLocal() const
Definition: gradient.h:2576
index_type iGetEndIndexLocal() const
Definition: gradient.h:2580

Here is the call graph for this function:

template<index_type N_SIZE>
index_type grad::Gradient< N_SIZE >::iGetMaxDerivatives ( ) const
inline
template<index_type N_SIZE>
index_type grad::Gradient< N_SIZE >::iGetMaxDerivativesVector ( ) const
inline

Definition at line 2600 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

Referenced by grad::Gradient< N_SIZE >::dGetDerivativeLocalVector().

2600  {
2601  return ad.iGetMaxSizeVector();
2602  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
index_type grad::Gradient< N_SIZE >::iGetStartIndexLocalVector ( ) const
inline

Definition at line 2584 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

Referenced by grad::Gradient< N_SIZE >::SetDerivativeLocalVector().

2584  {
2585  return ad.iGetStartIndexLocalVector();
2586  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator*= ( const Gradient< N_SIZE > &  g)
inline

Definition at line 2416 of file gradient.h.

2416  {
2417  ApplyBinaryFunction<FuncMult>(GradientExpression<DirectExpr<Gradient> >(g));
2418  return *this;
2419  }
template<index_type N_SIZE>
template<typename Expression >
Gradient& grad::Gradient< N_SIZE >::operator*= ( const GradientExpression< Expression > &  f)
inline

Definition at line 2461 of file gradient.h.

2461  {
2462  ApplyBinaryFunction<FuncMult>(f);
2463  return *this;
2464  }
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator*= ( scalar_func_type  d)
inline

Definition at line 2482 of file gradient.h.

References grad::Gradient< N_SIZE >::a, grad::Gradient< N_SIZE >::ad, grad::Gradient< N_SIZE >::iGetEndIndexLocal(), and grad::Gradient< N_SIZE >::iGetStartIndexLocal().

2482  {
2483  a *= d;
2484 
2485  for (index_type i = iGetStartIndexLocal(); i < iGetEndIndexLocal(); ++i) {
2486  ad.SetLocalVector(i, ad.dGetLocalVector(i) * d);
2487  }
2488 
2489  return *this;
2490  }
index_type iGetStartIndexLocal() const
Definition: gradient.h:2576
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
integer index_type
Definition: gradient.h:104
index_type iGetEndIndexLocal() const
Definition: gradient.h:2580

Here is the call graph for this function:

template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator++ ( void  )
inline

Definition at line 2426 of file gradient.h.

References grad::Gradient< N_SIZE >::a.

2426  {
2427  ++a;
2428  return *this;
2429  }
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
Gradient grad::Gradient< N_SIZE >::operator++ ( int  )
inline

Definition at line 2436 of file gradient.h.

References grad::Gradient< N_SIZE >::a.

2436  {
2437  const Gradient<N_SIZE> tmp(*this);
2438  a++;
2439  return tmp;
2440  }
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator+= ( const Gradient< N_SIZE > &  g)
inline

Definition at line 2406 of file gradient.h.

2406  {
2407  ApplyBinaryFunction<FuncPlus>(GradientExpression<DirectExpr<Gradient> >(g));
2408  return *this;
2409  }
template<index_type N_SIZE>
template<typename Expression >
Gradient& grad::Gradient< N_SIZE >::operator+= ( const GradientExpression< Expression > &  f)
inline

Definition at line 2449 of file gradient.h.

2449  {
2450  ApplyBinaryFunction<FuncPlus>(f);
2451  return *this;
2452  }
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator+= ( scalar_func_type  d)
inline

Definition at line 2472 of file gradient.h.

References grad::Gradient< N_SIZE >::a.

2472  {
2473  a += d;
2474  return *this;
2475  }
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator-- ( )
inline

Definition at line 2431 of file gradient.h.

References grad::Gradient< N_SIZE >::a.

2431  {
2432  --a;
2433  return *this;
2434  }
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
Gradient grad::Gradient< N_SIZE >::operator-- ( int  )
inline

Definition at line 2442 of file gradient.h.

References grad::Gradient< N_SIZE >::a.

2442  {
2443  const Gradient<N_SIZE> tmp(*this);
2444  a--;
2445  return tmp;
2446  }
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator-= ( const Gradient< N_SIZE > &  g)
inline

Definition at line 2411 of file gradient.h.

2411  {
2412  ApplyBinaryFunction<FuncMinus>(GradientExpression<DirectExpr<Gradient> >(g));
2413  return *this;
2414  }
template<index_type N_SIZE>
template<typename Expression >
Gradient& grad::Gradient< N_SIZE >::operator-= ( const GradientExpression< Expression > &  f)
inline

Definition at line 2455 of file gradient.h.

2455  {
2456  ApplyBinaryFunction<FuncMinus>(f);
2457  return *this;
2458  }
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator-= ( scalar_func_type  d)
inline

Definition at line 2477 of file gradient.h.

References grad::Gradient< N_SIZE >::a.

2477  {
2478  a -= d;
2479  return *this;
2480  }
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator/= ( const Gradient< N_SIZE > &  g)
inline

Definition at line 2421 of file gradient.h.

2421  {
2422  ApplyBinaryFunction<FuncDiv>(GradientExpression<DirectExpr<Gradient> >(g));
2423  return *this;
2424  }
template<index_type N_SIZE>
template<typename Expression >
Gradient& grad::Gradient< N_SIZE >::operator/= ( const GradientExpression< Expression > &  f)
inline

Definition at line 2467 of file gradient.h.

2467  {
2468  ApplyBinaryFunction<FuncDiv>(f);
2469  return *this;
2470  }
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator/= ( scalar_func_type  d)
inline

Definition at line 2492 of file gradient.h.

References grad::Gradient< N_SIZE >::a, grad::Gradient< N_SIZE >::ad, grad::Gradient< N_SIZE >::iGetEndIndexLocal(), and grad::Gradient< N_SIZE >::iGetStartIndexLocal().

2492  {
2493  a /= d;
2494 
2495  for (index_type i = iGetStartIndexLocal(); i < iGetEndIndexLocal(); ++i) {
2496  ad.SetLocalVector(i, ad.dGetLocalVector(i) / d);
2497  }
2498 
2499  return *this;
2500  }
index_type iGetStartIndexLocal() const
Definition: gradient.h:2576
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
integer index_type
Definition: gradient.h:104
index_type iGetEndIndexLocal() const
Definition: gradient.h:2580

Here is the call graph for this function:

template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator= ( scalar_func_type  d)
inline

Definition at line 2376 of file gradient.h.

References grad::Gradient< N_SIZE >::SetValue().

2376  {
2377  // This operator is needed for matrix/vector expressions with different base types
2378  SetValue(d);
2379  return *this;
2380  }
void SetValue(scalar_func_type dVal)
Definition: gradient.h:2506

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename Expression >
Gradient& grad::Gradient< N_SIZE >::operator= ( const GradientExpression< Expression > &  f)
inline

Definition at line 2383 of file gradient.h.

2383  {
2384  ApplyAliasHelper<GradientExpression<Expression>::bAlias>::ApplyExpression(*this, f);
2385 
2386  return *this;
2387  }
template<index_type N_SIZE>
template<index_type N_SIZE2>
Gradient& grad::Gradient< N_SIZE >::operator= ( const Gradient< N_SIZE2 > &  g)
inline

Definition at line 2390 of file gradient.h.

References grad::Gradient< N_SIZE >::a, and grad::Gradient< N_SIZE >::ad.

2390  {
2391  a = g.dGetValue();
2392  ad = g.GetDerivativeLocal();
2393 
2394  return *this;
2395  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
Gradient& grad::Gradient< N_SIZE >::operator= ( const Gradient< N_SIZE > &  g)
inline

Definition at line 2397 of file gradient.h.

References grad::Gradient< N_SIZE >::a, and grad::Gradient< N_SIZE >::ad.

2397  {
2398  if (&g != this) {
2399  a = g.a;
2400  ad = g.ad;
2401  }
2402 
2403  return *this;
2404  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
LocalDofMap* grad::Gradient< N_SIZE >::pGetDofMap ( ) const
inline

Definition at line 2626 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

Referenced by grad::Gradient< N_SIZE >::ApplyBinaryFunctionNoAlias().

2626  {
2627  return ad.pGetDofMap();
2628  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::Reserve ( index_type  iSize)
inline

Definition at line 2372 of file gradient.h.

References grad::Gradient< N_SIZE >::ad.

2372  {
2373  ad.Reserve(iSize);
2374  }
MapVectorType ad
Definition: gradient.h:2823
template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::Reset ( void  )
inline

Definition at line 2367 of file gradient.h.

References grad::Gradient< N_SIZE >::a, and grad::Gradient< N_SIZE >::ad.

2367  {
2368  a = 0.;
2369  ad.Reset();
2370  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::SetDerivativeGlobal ( index_type  iGlobalDof,
scalar_deriv_type  dCoef 
)
inline

Definition at line 2566 of file gradient.h.

References grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, grad::Gradient< N_SIZE >::iGetEndIndexLocal(), and grad::Gradient< N_SIZE >::iGetStartIndexLocal().

Referenced by grad::GradientVectorHandler< Gradient< N_SIZE > >::GetVec(), testGradient(), and testSubVecAss().

2566  {
2567  GRADIENT_ASSERT(ad.pGetDofMap()->iGetLocalIndex(iGlobalDof) >= iGetStartIndexLocal());
2568  GRADIENT_ASSERT(ad.pGetDofMap()->iGetLocalIndex(iGlobalDof) < iGetEndIndexLocal());
2569  ad.SetGlobalVector(iGlobalDof, dCoef);
2570  }
index_type iGetStartIndexLocal() const
Definition: gradient.h:2576
MapVectorType ad
Definition: gradient.h:2823
index_type iGetEndIndexLocal() const
Definition: gradient.h:2580
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::SetDerivativeLocal ( index_type  iLocalDof,
scalar_deriv_type  dCoef 
)
inline

Definition at line 2554 of file gradient.h.

References grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, grad::Gradient< N_SIZE >::iGetEndIndexLocal(), and grad::Gradient< N_SIZE >::iGetStartIndexLocal().

2554  {
2555  GRADIENT_ASSERT(iLocalDof >= iGetStartIndexLocal());
2556  GRADIENT_ASSERT(iLocalDof < iGetEndIndexLocal());
2557  ad.SetLocalVector(iLocalDof, dCoef);
2558  }
index_type iGetStartIndexLocal() const
Definition: gradient.h:2576
MapVectorType ad
Definition: gradient.h:2823
index_type iGetEndIndexLocal() const
Definition: gradient.h:2580
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::SetDerivativeLocalVector ( index_type  iLocalVecDof,
vector_deriv_type  dVec 
)
inline

Definition at line 2560 of file gradient.h.

References grad::Gradient< N_SIZE >::ad, GRADIENT_ASSERT, grad::Gradient< N_SIZE >::iGetEndIndexLocalVector(), and grad::Gradient< N_SIZE >::iGetStartIndexLocalVector().

2560  {
2561  GRADIENT_ASSERT(iLocalVecDof >= iGetStartIndexLocalVector());
2562  GRADIENT_ASSERT(iLocalVecDof < iGetEndIndexLocalVector());
2563  ad.SetLocalVectorVector(iLocalVecDof, dVec);
2564  }
index_type iGetEndIndexLocalVector() const
Definition: gradient.h:2588
MapVectorType ad
Definition: gradient.h:2823
index_type iGetStartIndexLocalVector() const
Definition: gradient.h:2584
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::SetValue ( scalar_func_type  dVal)
inline

Definition at line 2506 of file gradient.h.

References grad::Gradient< N_SIZE >::a, and grad::Gradient< N_SIZE >::ad.

Referenced by grad::Gradient< N_SIZE >::operator=(), testMatVecGradient(), and testSubVecAss().

2506  {
2507  a = dVal;
2508  ad.ResizeReset(0, 0, 0, MapVector<N_SIZE>::LOCAL, 0.);
2509  }
MapVectorType ad
Definition: gradient.h:2823
scalar_func_type a
Definition: gradient.h:2822
template<index_type N_SIZE>
void grad::Gradient< N_SIZE >::SetValuePreserve ( scalar_func_type  dVal)
inline

Definition at line 2511 of file gradient.h.

References grad::Gradient< N_SIZE >::a.

Referenced by grad::GradientVectorHandler< Gradient< N_SIZE > >::dGetCoef(), grad::GradientVectorHandler< Gradient< N_SIZE > >::GetVec(), testGradient(), testGradient2(), and testGradientLin().

2511  {
2512  // Keep the same derivatives - needed for the Node class for example
2513  a = dVal;
2514  }
scalar_func_type a
Definition: gradient.h:2822

Friends And Related Function Documentation

template<index_type N_SIZE>
friend struct ApplyAliasHelper< false >
friend

Definition at line 2636 of file gradient.h.

template<index_type N_SIZE>
friend struct ApplyAliasHelper< true >
friend

Definition at line 2635 of file gradient.h.

Member Data Documentation

template<index_type N_SIZE>
const index_type grad::Gradient< N_SIZE >::iDimension = N_SIZE
static

Definition at line 2241 of file gradient.h.

template<index_type N_SIZE>
const index_type grad::Gradient< N_SIZE >::iMaxDerivatives = MapVectorType::iMaxSize
static

Definition at line 2242 of file gradient.h.


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