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

#include <matvecass.h>

Inheritance diagram for grad::GradientAssVec< Gradient< N_SIZE > >:
Collaboration diagram for grad::GradientAssVec< Gradient< N_SIZE > >:

Public Member Functions

 GradientAssVec (SparseSubMatrixHandler &mh, enum mode_t mode=RESET)
 
void AddItem (integer iRow, const Gradient< N_SIZE > &g)
 
template<index_type N_rows>
void AddItem (integer iFirstRow, const Vector< Gradient< N_SIZE >, N_rows > &v)
 

Static Public Member Functions

template<typename T >
static void AssJac (T *pElem, SparseSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, enum FunctionCall func, LocalDofMap *pDofMap, enum mode_t mode=RESET)
 
template<typename T >
static void InitialAssJac (T *pElem, SparseSubMatrixHandler &WorkMat, const VectorHandler &XCurr, enum FunctionCall func, LocalDofMap *pDofMap, enum mode_t mode=RESET)
 

Private Attributes

SparseSubMatrixHandlerWorkMat
 
integer iNextItem
 

Additional Inherited Members

- Public Types inherited from grad::GradientAssVecBase
enum  mode_t { RESET, APPEND }
 

Detailed Description

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

Definition at line 200 of file matvecass.h.

Constructor & Destructor Documentation

template<index_type N_SIZE>
grad::GradientAssVec< Gradient< N_SIZE > >::GradientAssVec ( SparseSubMatrixHandler mh,
enum mode_t  mode = RESET 
)
inline

Definition at line 202 of file matvecass.h.

References GRADIENT_ASSERT.

203  :WorkMat(mh) {
204 
205  switch (mode) {
206  case RESET:
207  iNextItem = 1;
209  WorkMat.PutItem(1, 1, 1, 0.); //FIXME: avoid SIGSEGV if the matrix is empty
210  break;
211 
212  case APPEND:
213  iNextItem = WorkMat.iGetNumRows() + 1;
214  break;
215 
216  default:
217  GRADIENT_ASSERT(0);
218  }
219 
220  }
void ResizeReset(integer iNewRow, integer iNewCol)
Definition: submat.cc:1084
SparseSubMatrixHandler & WorkMat
Definition: matvecass.h:291
void PutItem(integer iSubIt, integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:997
integer iGetNumRows(void) const
Definition: submat.h:812
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Member Function Documentation

template<index_type N_SIZE>
void grad::GradientAssVec< Gradient< N_SIZE > >::AddItem ( integer  iRow,
const Gradient< N_SIZE > &  g 
)
inline

Definition at line 263 of file matvecass.h.

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

263  {
264  for (index_type i = g.iGetStartIndexLocal(); i < g.iGetEndIndexLocal(); ++i) {
265  const double dCoef = g.dGetDerivativeLocal(i);
266  if (dCoef) {
267  const index_type iDofIndex = g.iGetGlobalDof(i);
270 #if GRADIENT_DEBUG > 0 && HAVE_FINITE == 1
271  if (!std::isfinite(dCoef)) {
272  silent_cerr("PutItem(" << iNextItem << ", " << iRow << ", " << iDofIndex << ", " << dCoef << ")" << std::endl);
273  }
274 
275  GRADIENT_ASSERT(std::isfinite(dCoef));
276 #endif
277  WorkMat.PutItem(iNextItem++, iRow, iDofIndex, dCoef);
278  }
279  }
280  }
integer index_type
Definition: gradient.h:104
void Resize(integer iNewRow, integer iNewCol)
Definition: submat.cc:1053
SparseSubMatrixHandler & WorkMat
Definition: matvecass.h:291
void PutItem(integer iSubIt, integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:997
integer iGetNumRows(void) const
Definition: submat.h:812
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Here is the call graph for this function:

template<index_type N_SIZE>
template<index_type N_rows>
void grad::GradientAssVec< Gradient< N_SIZE > >::AddItem ( integer  iFirstRow,
const Vector< Gradient< N_SIZE >, N_rows > &  v 
)
inline

Definition at line 283 of file matvecass.h.

283  {
284  // zero based index according to VectorHandler::Put(integer iRow, const Vec3& v)
285 
286  for (integer i = 0; i < N_rows; ++i) {
287  AddItem(iFirstRow + i, v(i + 1));
288  }
289  }
void AddItem(integer iRow, const Gradient< N_SIZE > &g)
Definition: matvecass.h:263
long int integer
Definition: colamd.c:51
template<index_type N_SIZE>
template<typename T >
static void grad::GradientAssVec< Gradient< N_SIZE > >::AssJac ( T *  pElem,
SparseSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr,
enum FunctionCall  func,
LocalDofMap pDofMap,
enum mode_t  mode = RESET 
)
inlinestatic

Definition at line 223 of file matvecass.h.

References grad::LocalDofMap::Reset().

230  {
231 
232  const GradientVectorHandler<Gradient<N_SIZE> > XCurr_grad(XCurr);
233  const GradientVectorHandler<Gradient<N_SIZE> > XPrimeCurr_grad(XPrimeCurr);
234 
235  GradientAssVec WorkMat_grad(WorkMat, mode);
236 
237  if (pDofMap) {
238  pDofMap->Reset(func);
239  }
240 
241  pElem->AssRes(WorkMat_grad, dCoef, XCurr_grad, XPrimeCurr_grad, func);
242  }
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
GradientAssVec(SparseSubMatrixHandler &mh, enum mode_t mode=RESET)
Definition: matvecass.h:202

Here is the call graph for this function:

template<index_type N_SIZE>
template<typename T >
static void grad::GradientAssVec< Gradient< N_SIZE > >::InitialAssJac ( T *  pElem,
SparseSubMatrixHandler WorkMat,
const VectorHandler XCurr,
enum FunctionCall  func,
LocalDofMap pDofMap,
enum mode_t  mode = RESET 
)
inlinestatic

Definition at line 245 of file matvecass.h.

References grad::LocalDofMap::Reset().

250  {
251 
252  const GradientVectorHandler<Gradient<N_SIZE> > XCurr_grad(XCurr);
253 
254  GradientAssVec WorkMat_grad(WorkMat, mode);
255 
256  if (pDofMap) {
257  pDofMap->Reset(func);
258  }
259 
260  pElem->InitialAssRes(WorkMat_grad, XCurr_grad, func);
261  }
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
GradientAssVec(SparseSubMatrixHandler &mh, enum mode_t mode=RESET)
Definition: matvecass.h:202

Here is the call graph for this function:

Member Data Documentation

template<index_type N_SIZE>
integer grad::GradientAssVec< Gradient< N_SIZE > >::iNextItem
private

Definition at line 292 of file matvecass.h.

template<index_type N_SIZE>
SparseSubMatrixHandler& grad::GradientAssVec< Gradient< N_SIZE > >::WorkMat
private

Definition at line 291 of file matvecass.h.


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