MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
GenelStateSpaceMIMO Class Reference

#include <genfilt.h>

Inheritance diagram for GenelStateSpaceMIMO:
Collaboration diagram for GenelStateSpaceMIMO:

Public Member Functions

 GenelStateSpaceMIMO (unsigned int uLabel, const DofOwner *pDO, unsigned int iNumOut, const ScalarDof *y, std::vector< ScalarValue * > &u, unsigned int Order, doublereal *pE, doublereal *pA, doublereal *pB, doublereal *pC, doublereal *pD, bool bBalance, doublereal *pdX0, doublereal *pdXP0, flag fOutput)
 
virtual ~GenelStateSpaceMIMO (void)
 
virtual unsigned int iGetNumDof (void) const
 
virtual DofOrder::Order GetDofType (unsigned int i) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual Genel::Type GetGenelType (void) const
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &, const VectorHandler &)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
virtual void Output (OutputHandler &OH) const
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
- Public Member Functions inherited from Genel
 Genel (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~Genel (void)
 
virtual Elem::Type GetElemType (void) const
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual unsigned int iGetNumPrivData (void) const
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i) const
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from ElemWithDofs
 ElemWithDofs (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~ElemWithDofs (void)
 
- Public Member Functions inherited from DofOwnerOwner
 DofOwnerOwner (const DofOwner *pDO)
 
virtual ~DofOwnerOwner ()
 
virtual const DofOwnerpGetDofOwner (void) const
 
virtual integer iGetFirstIndex (void) const
 
virtual void SetInitialValue (VectorHandler &X)
 

Protected Attributes

unsigned int iNumOutputs
 
unsigned int iNumInputs
 
ScalarDofpvSD_y
 
std::vector< ScalarValue * > SV_u
 
unsigned int iNumDofs
 
doublerealpdE
 
doublerealpdA
 
doublerealpdB
 
doublerealpdC
 
doublerealpdD
 
doublerealpdX
 
doublerealpdXP
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 

Additional Inherited Members

- Public Types inherited from Genel
enum  Type {
  UNKNOWN = -1, SWASHPLATE = 0, ROTORTRIM, CLAMP,
  DISTANCE, SPRING, SPRINGSUPPORT, CROSSSPRINGSUPPORT,
  SPRINGDAMPER, SPRINGDAMPERSUPPORT, CROSSSPRINGDAMPERSUPPORT, MASS,
  SCALARFILTER, STATESPACESISO, STATESPACEMIMO, LASTGENELTYPE
}
 
- Public Types inherited from Elem
enum  Type {
  UNKNOWN = -1, AIRPROPERTIES = 0, INDUCEDVELOCITY, AUTOMATICSTRUCTURAL,
  GRAVITY, BODY, JOINT, JOINT_REGULARIZATION,
  BEAM, PLATE, FORCE, INERTIA,
  ELECTRICBULK, ELECTRIC, THERMAL, HYDRAULIC,
  BULK, LOADABLE, DRIVEN, EXTERNAL,
  AEROMODAL, AERODYNAMIC, GENEL, SOCKETSTREAM_OUTPUT,
  RTAI_OUTPUT = SOCKETSTREAM_OUTPUT, LASTELEMTYPE
}
 
- Public Types inherited from SimulationEntity
typedef std::vector< Hint * > Hints
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 

Detailed Description

Definition at line 123 of file genfilt.h.

Constructor & Destructor Documentation

GenelStateSpaceMIMO::GenelStateSpaceMIMO ( unsigned int  uLabel,
const DofOwner pDO,
unsigned int  iNumOut,
const ScalarDof y,
std::vector< ScalarValue * > &  u,
unsigned int  Order,
doublereal pE,
doublereal pA,
doublereal pB,
doublereal pC,
doublereal pD,
bool  bBalance,
doublereal pdX0,
doublereal pdXP0,
flag  fOutput 
)

Definition at line 416 of file genfilt.cc.

References ASSERT, DEBUGCOUT, iNumDofs, iNumInputs, iNumOutputs, pdA, pdB, pdC, pdE, pdX, pdXP, pvSD_y, and SAFENEWARR.

431 : Elem(uLabel, fOutput),
432 Genel(uLabel, pDO, fOutput),
433 iNumOutputs(iNumOut), iNumInputs(u.size()),
434 pvSD_y(const_cast<ScalarDof *>(y)), SV_u(u),
435 iNumDofs(Order),
436 pdE(pE), pdA(pA), pdB(pB), pdC(pC), pdD(pD),
437 pdX(0), pdXP(0)
438 {
439  ASSERT(iNumDofs > 0);
440  ASSERT(iNumOutputs > 0);
441  ASSERT(pvSD_y != 0);
442  for (int i = iNumOutputs; i-- > 0; ) {
443  ASSERT(pvSD_y[i].iOrder == 0);
444  }
445  ASSERT(iNumInputs > 0);
446  ASSERT(pdA != 0);
447  ASSERT(pdB != 0);
448  ASSERT(pdC != 0);
449  DEBUGCOUT("GenelStateSpaceMIMO " << uLabel
450  << ", NumDofs: " << iNumDofs << std::endl);
451 
452 #ifdef USE_LAPACK
453  // try balancing the matrix?
454  if (bBalance) {
455  int rc;
456  char JOB = 'S';
457  integer N = Order;
458  integer LDA = Order;
459  integer LDB = Order;
460  integer ILO;
461  integer IHI;
462  integer INFO;
463 
464  std::vector<doublereal> RSCALE(Order);
465  std::vector<doublereal> LSCALE(Order);
466 
467  if (pdE != 0) {
468  std::vector<doublereal> WORK(6*Order);
469 
470  rc = __FC_DECL__(dggbal)(&JOB, &N, pdA, &LDA,
471  pdE, &LDB, &ILO, &IHI,
472  &LSCALE[0], &RSCALE[0], &WORK[0], &INFO);
473 
474  } else {
475  rc = __FC_DECL__(dgebal)(&JOB, &N, pdA, &LDA,
476  &ILO, &IHI, &RSCALE[0], &INFO);
477 
478  for (unsigned i = 0; i < Order; i++) {
479  LSCALE[i] = 1./RSCALE[i];
480  }
481  }
482 
483  if (INFO != 0) {
484  silent_cout("GenelStateSpaceMIMO(" << uLabel << "): "
485  "balancing failed (ignored)" << std::endl);
486 
487  } else {
488  doublereal *pd = pdB;
489 
490  for (unsigned i = 0; i < Order; i++) {
491  doublereal d = RSCALE[i];
492  for (unsigned j = 0; j < iNumInputs; j++) {
493  *pd++ *= d;
494  }
495  }
496 
497  pd = pdC;
498  for (unsigned j = 0; j < iNumOutputs; j++) {
499  for (unsigned i = 0; i < Order; i++) {
500  *pd++ *= LSCALE[i];
501  }
502  }
503  }
504  }
505 #endif // USE_LAPACK
506 
507  SAFENEWARR(pdX, doublereal, 2*Order);
508  pdXP = pdX + Order;
509 
510  for (unsigned i = 0; i < 2*Order; i++) {
511  pdX[i] = 0.;
512  }
513 
514  if (pdX0) {
515  for (unsigned i = 0; i < Order; i++) {
516  pdX[i] = pdX0[i];
517  }
518 
519  if (pdXP0) {
520  for (unsigned i = 0; i < Order; i++) {
521  pdXP[i] = pdXP0[i];
522  }
523  }
524  }
525 }
doublereal * pdD
Definition: genfilt.h:136
doublereal * pdB
Definition: genfilt.h:134
flag fOutput
Definition: output.h:658
doublereal * pdA
Definition: genfilt.h:133
unsigned int iNumOutputs
Definition: genfilt.h:125
ScalarDof * pvSD_y
Definition: genfilt.h:127
doublereal * pdX
Definition: genfilt.h:138
doublereal * pdC
Definition: genfilt.h:135
#define DEBUGCOUT(msg)
Definition: myassert.h:232
unsigned int uLabel
Definition: withlab.h:44
#define ASSERT(expression)
Definition: colamd.c:977
Order
Definition: shapefnc.h:42
Genel(unsigned int uL, const DofOwner *pDO, flag fOut)
Definition: genel.cc:44
std::vector< ScalarValue * > SV_u
Definition: genfilt.h:128
doublereal * pdXP
Definition: genfilt.h:139
doublereal * pdE
Definition: genfilt.h:132
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
unsigned int iNumInputs
Definition: genfilt.h:126
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
double doublereal
Definition: colamd.c:52
unsigned int iNumDofs
Definition: genfilt.h:130
long int integer
Definition: colamd.c:51
GenelStateSpaceMIMO::~GenelStateSpaceMIMO ( void  )
virtual

Definition at line 527 of file genfilt.cc.

References pdA, pdB, pdC, pdD, pdE, pdX, pvSD_y, SAFEDELETEARR, and SV_u.

528 {
529  if (pdX != 0) {
531  }
532 
533  if (pdD != 0) {
535  }
536 
537  if (pdC != 0) {
539  }
540 
541  if (pdB != 0) {
543  }
544 
545  if (pdA != 0) {
547  }
548 
549  if (pdE != 0) {
551  }
552 
553  for (std::vector<ScalarValue *>::iterator i = SV_u.begin();
554  i != SV_u.end(); ++i)
555  {
556  delete *i;
557  }
558 
559  if (pvSD_y != 0) {
561  }
562 }
doublereal * pdD
Definition: genfilt.h:136
doublereal * pdB
Definition: genfilt.h:134
doublereal * pdA
Definition: genfilt.h:133
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
ScalarDof * pvSD_y
Definition: genfilt.h:127
doublereal * pdX
Definition: genfilt.h:138
doublereal * pdC
Definition: genfilt.h:135
std::vector< ScalarValue * > SV_u
Definition: genfilt.h:128
doublereal * pdE
Definition: genfilt.h:132

Member Function Documentation

VariableSubMatrixHandler & GenelStateSpaceMIMO::AssJac ( VariableSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler ,
const VectorHandler  
)
virtual

Implements Elem.

Definition at line 599 of file genfilt.cc.

References DEBUGCOUT, Node::iGetFirstColIndex(), DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), FullSubMatrixHandler::IncCoef(), iNumDofs, iNumInputs, iNumOutputs, ScalarDof::iOrder, pdA, pdB, pdC, pdE, ScalarDof::pNode, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), pvSD_y, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), SV_u, and WorkSpaceDim().

603 {
604  DEBUGCOUT("Entering GenelStateSpaceMIMO::AssJac()" << std::endl);
605 
606  FullSubMatrixHandler& WM = WorkMat.SetFull();
607  integer iNumRows = 0;
608  integer iNumCols = 0;
609  WorkSpaceDim(&iNumRows, &iNumCols);
610  WM.ResizeReset(iNumRows, iNumCols);
611 
612  // inputs may contribute to the Jacobian matrix
613  integer iIdx_u = iNumDofs + iNumOutputs;
614  for (unsigned int j = 0; j < iNumInputs; j++) {
615  ScalarDofValue *SDV_u = dynamic_cast<ScalarDofValue *>(SV_u[j]);
616  if (SDV_u != 0) {
617  ScalarDof& SD_u = dynamic_cast<ScalarDof &>(*SV_u[j]);
618  integer iColIndex_u = SD_u.pNode->iGetFirstRowIndex() + 1;
619  iIdx_u += 1;
620  WM.PutColIndex(iIdx_u, iColIndex_u);
621 
622  doublereal dd;
623  if (SD_u.iOrder == 0) {
624  dd = dCoef;
625  } else {
626  dd = 1.;
627  }
628 
629  doublereal *pdb = &pdB[j];
630  for (unsigned int i = 1; i <= iNumDofs; i++) {
631  WM.PutCoef(i, iIdx_u, pdb[0]*dd);
632  pdb += iNumInputs;
633  }
634  }
635  }
636 
637  integer iFirstIndex = iGetFirstIndex();
638  doublereal* pdc = pdC + iNumOutputs*iNumDofs - 1;
639  for (unsigned int i = iNumOutputs; i > 0; i--) {
640  integer iRowIndex_y = pvSD_y[i - 1].pNode->iGetFirstRowIndex() + 1;
641  integer iColIndex_y = pvSD_y[i - 1].pNode->iGetFirstColIndex() + 1;
642 
643  WM.PutRowIndex(iNumDofs + i, iRowIndex_y);
644  WM.PutColIndex(iNumDofs + i, iColIndex_y);
645  // 1 sulla diagonale
646  WM.PutCoef(iNumDofs + i, iNumDofs + i, dCoef);
647 
648  pdc -= iNumDofs;
649  for (unsigned int j = iNumDofs; j > 0; j--) {
650  /* Attenzione: si assume C orientata per righe:
651  * c_11, c_12, ..., c_1n, c_21, ..., c_2n, ..., c_nn */
652  WM.PutCoef(iNumDofs + i, j, -pdc[j]*dCoef);
653  }
654  }
655 
656  doublereal* pda = pdA + iNumDofs*iNumDofs - 1;
657  if (pdE) {
658  doublereal* pde = pdE + iNumDofs*iNumDofs - 1;
659 
660  for (unsigned int i = iNumDofs; i > 0; i--) {
661  WM.PutRowIndex(i, iFirstIndex + i);
662  WM.PutColIndex(i, iFirstIndex + i);
663  pde -= iNumDofs;
664  pda -= iNumDofs;
665  for (unsigned int j = iNumDofs; j > 0; j--) {
666  /* Attenzione: si assume A orientata per righe:
667  * a_11, a_12, ..., a_1n, a_21, ..., a_2n,
668  * ..., a_nn */
669  WM.PutCoef(i, j, pde[j] - pda[j]*dCoef);
670  }
671  }
672 
673  } else {
674  for (unsigned int i = iNumDofs; i > 0; i--) {
675  WM.PutRowIndex(i, iFirstIndex + i);
676  WM.PutColIndex(i, iFirstIndex + i);
677  pda -= iNumDofs;
678  for (unsigned int j = iNumDofs; j > 0; j--) {
679  /* Attenzione: si assume A orientata per righe:
680  * a_11, a_12, ..., a_1n, a_21, ..., a_2n,
681  * ..., a_nn */
682  WM.PutCoef(i, j, -pda[j]*dCoef);
683  }
684  WM.IncCoef(i, i, 1.);
685  }
686  }
687 
688  return WorkMat;
689 }
ScalarNode * pNode
Definition: node.h:708
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
doublereal * pdB
Definition: genfilt.h:134
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
doublereal * pdA
Definition: genfilt.h:133
int iOrder
Definition: node.h:710
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
unsigned int iNumOutputs
Definition: genfilt.h:125
void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:683
ScalarDof * pvSD_y
Definition: genfilt.h:127
doublereal * pdC
Definition: genfilt.h:135
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstRowIndex(void) const
Definition: node.cc:82
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: genfilt.cc:583
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
std::vector< ScalarValue * > SV_u
Definition: genfilt.h:128
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
doublereal * pdE
Definition: genfilt.h:132
unsigned int iNumInputs
Definition: genfilt.h:126
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
unsigned int iNumDofs
Definition: genfilt.h:130
long int integer
Definition: colamd.c:51
virtual integer iGetFirstColIndex(void) const
Definition: node.cc:88

Here is the call graph for this function:

SubVectorHandler & GenelStateSpaceMIMO::AssRes ( SubVectorHandler WorkVec,
doublereal  ,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 693 of file genfilt.cc.

References DEBUGCOUT, ScalarNode::dGetX(), DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), iNumDofs, iNumInputs, iNumOutputs, pdA, pdB, pdC, pdD, pdE, pdX, pdXP, ScalarDof::pNode, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), pvSD_y, VectorHandler::ResizeReset(), SV_u, and WorkSpaceDim().

697 {
698  DEBUGCOUT("Entering GenelStateSpaceMIMO::AssRes()" << std::endl);
699 
700  integer iNumRows = 0;
701  integer iNumCols = 0;
702  WorkSpaceDim(&iNumRows, &iNumCols);
703  WorkVec.ResizeReset(iNumRows);
704 
705  integer iFirstIndex = iGetFirstIndex();
706 
707  doublereal* pdx = pdX-1;
708  doublereal* pdxp = pdXP-1;
709  for (unsigned int i = iNumDofs; i > 0; i--) {
710  WorkVec.PutRowIndex(i, iFirstIndex+i);
711  pdx[i] = XCurr(iFirstIndex+i);
712  pdxp[i] = XPrimeCurr(iFirstIndex+i);
713  }
714 
715  doublereal* pdc = pdC + iNumOutputs*iNumDofs - 1;
716  if (pdD != 0) {
717  doublereal* pdd = pdD + iNumOutputs*iNumInputs - 1;
718  for (int i = iNumOutputs; i > 0; i--) {
719  integer iRowIndex_y = pvSD_y[i - 1].pNode->iGetFirstRowIndex()+1;
720  WorkVec.PutRowIndex(iNumDofs+i, iRowIndex_y);
721  doublereal y = pvSD_y[i - 1].pNode->dGetX();
722  doublereal d = -y;
723  pdc -= iNumDofs;
724  for (unsigned int j = iNumDofs; j > 0; j--) {
725  d += pdc[j]*pdx[j];
726  }
727  pdd -= iNumInputs;
728  for (unsigned int j = iNumInputs; j > 0; j--) {
729  d += pdd[j]*SV_u[j - 1]->dGetValue();
730  }
731  WorkVec.PutCoef(iNumDofs + i, d);
732  }
733 
734  } else {
735  for (int i = iNumOutputs; i > 0; i--) {
736  integer iRowIndex_y = pvSD_y[i - 1].pNode->iGetFirstRowIndex() + 1;
737  WorkVec.PutRowIndex(iNumDofs + i, iRowIndex_y);
738  doublereal y = pvSD_y[i - 1].pNode->dGetX();
739  doublereal d = -y;
740  pdc -= iNumDofs;
741  for (unsigned int j = iNumDofs; j > 0; j--) {
742  d += pdc[j]*pdx[j];
743  }
744  WorkVec.PutCoef(iNumDofs + i, d);
745  }
746  }
747 
748  doublereal* pda = pdA + iNumDofs*iNumDofs;
749  doublereal* pdb = pdB + iNumDofs*iNumInputs;
750  pdxp = pdXP;
751  pdx = pdX;
752  if (pdE) {
753  doublereal* pde = pdE + iNumDofs*iNumDofs;
754  for (unsigned int i = iNumDofs; i-- > 0; ) {
755  doublereal d = 0.;
756  pdb -= iNumInputs;
757  for (unsigned int j = iNumInputs; j-- > 0; ) {
758  d += pdb[j]*SV_u[j]->dGetValue();
759  }
760  pde -= iNumDofs;
761  pda -= iNumDofs;
762  for (unsigned int j = iNumDofs; j-- > 0; ) {
763  d += pda[j]*pdx[j] - pde[j]*pdxp[j];
764  }
765  WorkVec.PutCoef(i + 1, d);
766  }
767 
768  } else {
769  for (unsigned int i = iNumDofs; i-- > 0; ) {
770  doublereal d = -pdxp[i];
771  pdb -= iNumInputs;
772  for (unsigned int j = iNumInputs; j-- > 0; ) {
773  d += pdb[j]*SV_u[j]->dGetValue();
774  }
775  pda -= iNumDofs;
776  for (unsigned int j = iNumDofs; j-- > 0; ) {
777  d += pda[j]*pdx[j];
778  }
779  WorkVec.PutCoef(i + 1, d);
780  }
781  }
782 
783  return WorkVec;
784 }
ScalarNode * pNode
Definition: node.h:708
doublereal * pdD
Definition: genfilt.h:136
virtual void ResizeReset(integer)
Definition: vh.cc:55
doublereal * pdB
Definition: genfilt.h:134
doublereal * pdA
Definition: genfilt.h:133
unsigned int iNumOutputs
Definition: genfilt.h:125
virtual const doublereal & dGetX(void) const =0
ScalarDof * pvSD_y
Definition: genfilt.h:127
doublereal * pdX
Definition: genfilt.h:138
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
doublereal * pdC
Definition: genfilt.h:135
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstRowIndex(void) const
Definition: node.cc:82
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: genfilt.cc:583
std::vector< ScalarValue * > SV_u
Definition: genfilt.h:128
doublereal * pdXP
Definition: genfilt.h:139
doublereal * pdE
Definition: genfilt.h:132
unsigned int iNumInputs
Definition: genfilt.h:126
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
unsigned int iNumDofs
Definition: genfilt.h:130
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void GenelStateSpaceMIMO::GetConnectedNodes ( std::vector< const Node * > &  connectedNodes) const
virtual

Reimplemented from Elem.

Definition at line 833 of file genfilt.cc.

References iNumOutputs, NodeDof::pNode, ScalarDof::pNode, pvSD_y, and SV_u.

834  {
835  unsigned i, iNodes = iNumOutputs;
836  for (std::vector<ScalarValue *>::const_iterator u = SV_u.begin();
837  u != SV_u.end(); ++u)
838  {
839  if (dynamic_cast<NodeDof *>(*u)) {
840  iNodes++;
841  }
842  }
843 
844  connectedNodes.resize(iNodes);
845  for (i = 0; i < iNumOutputs; i++) {
846  connectedNodes[i] = pvSD_y[i].pNode;
847  }
848 
849  for (std::vector<ScalarValue *>::const_iterator u = SV_u.begin();
850  u != SV_u.end(); ++u)
851  {
852  NodeDof* ndp = dynamic_cast<NodeDof *>(*u);
853  if (ndp) {
854  connectedNodes[i++] = ndp->pNode;
855  }
856  }
857 }
ScalarNode * pNode
Definition: node.h:708
unsigned int iNumOutputs
Definition: genfilt.h:125
ScalarDof * pvSD_y
Definition: genfilt.h:127
std::vector< ScalarValue * > SV_u
Definition: genfilt.h:128
Definition: node.h:578
Node * pNode
Definition: node.h:582
DofOrder::Order GenelStateSpaceMIMO::GetDofType ( unsigned int  i) const
virtual

Reimplemented from Elem.

Definition at line 570 of file genfilt.cc.

References ASSERT, DofOrder::DIFFERENTIAL, and iNumDofs.

571 {
572  ASSERT(i < iNumDofs);
573  return DofOrder::DIFFERENTIAL;
574 }
#define ASSERT(expression)
Definition: colamd.c:977
unsigned int iNumDofs
Definition: genfilt.h:130
virtual Genel::Type GenelStateSpaceMIMO::GetGenelType ( void  ) const
inlinevirtual

Implements Genel.

Definition at line 165 of file genfilt.h.

References Genel::STATESPACEMIMO.

165  {
166  return Genel::STATESPACEMIMO;
167  };
unsigned int GenelStateSpaceMIMO::iGetNumDof ( void  ) const
virtual

Reimplemented from Elem.

Definition at line 564 of file genfilt.cc.

References iNumDofs.

565 {
566  return iNumDofs;
567 }
unsigned int iNumDofs
Definition: genfilt.h:130
void GenelStateSpaceMIMO::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 817 of file genfilt.cc.

References ToBeOutput::bToBeOutput(), OutputHandler::Genels(), WithLabel::GetLabel(), iNumDofs, pdX, and pdXP.

818 {
819  if (bToBeOutput()) {
820  std::ostream& out(OH.Genels());
821  out << std::setw(8) << GetLabel();
822  for (unsigned int i = 0; i < iNumDofs; i++) {
823  out << " " << pdX[i];
824  }
825  for (unsigned int i = 0; i < iNumDofs; i++) {
826  out << " " << pdXP[i];
827  }
828  out << "\n";
829  }
830 }
std::ostream & Genels(void) const
Definition: output.h:513
virtual bool bToBeOutput(void) const
Definition: output.cc:890
doublereal * pdX
Definition: genfilt.h:138
doublereal * pdXP
Definition: genfilt.h:139
unsigned int iNumDofs
Definition: genfilt.h:130
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

std::ostream & GenelStateSpaceMIMO::Restart ( std::ostream &  out) const
virtual

Reimplemented from Genel.

Definition at line 577 of file genfilt.cc.

578 {
579  return out << "GenelStateSpaceMIMO: not implemented yet!" << std::endl;
580 }
void GenelStateSpaceMIMO::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph = 0 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 787 of file genfilt.cc.

References DofOwnerOwner::iGetFirstIndex(), iNumDofs, iNumInputs, pdA, pdB, pdE, pdX, pdXP, and SV_u.

790 {
791  integer iFirstIndex = iGetFirstIndex() + 1;
792 
793  if (pdE == 0) {
794  doublereal* pda = pdA + iNumDofs*iNumDofs;
795  doublereal* pdb = pdB + iNumDofs*iNumInputs;
796 
797  for (unsigned int i = iNumDofs; i-- > 0; ) {
798  pdXP[i] = 0.;
799  pdb -= iNumInputs;
800  for (unsigned int j = iNumInputs; j-- > 0; ) {
801  pdXP[i] += pdb[j]*SV_u[j]->dGetValue();
802  }
803  pda -= iNumDofs;
804  for (unsigned int j = iNumDofs; j-- > 0; ) {
805  pdXP[i] += pda[j]*pdX[j];
806  }
807  }
808  }
809 
810  for (unsigned i = 0; i < iNumDofs; i++) {
811  X(iFirstIndex + i) = pdX[i];
812  XP(iFirstIndex + i) = pdXP[i];
813  }
814 }
doublereal * pdB
Definition: genfilt.h:134
doublereal * pdA
Definition: genfilt.h:133
doublereal * pdX
Definition: genfilt.h:138
std::vector< ScalarValue * > SV_u
Definition: genfilt.h:128
doublereal * pdXP
Definition: genfilt.h:139
doublereal * pdE
Definition: genfilt.h:132
unsigned int iNumInputs
Definition: genfilt.h:126
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
unsigned int iNumDofs
Definition: genfilt.h:130
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void GenelStateSpaceMIMO::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Definition at line 583 of file genfilt.cc.

References iNumDofs, iNumInputs, iNumOutputs, and SV_u.

Referenced by AssJac(), and AssRes().

585 {
586  *piNumRows = iNumDofs + iNumOutputs;
587  *piNumCols = iNumDofs + iNumOutputs;
588 
589  // inputs may contribute to the Jacobian matrix
590  for (unsigned int j = iNumInputs; j-- > 0; ) {
591  if (dynamic_cast<ScalarDofValue *>(SV_u[j]) != 0) {
592  *piNumCols += 1;
593  }
594  }
595 }
unsigned int iNumOutputs
Definition: genfilt.h:125
std::vector< ScalarValue * > SV_u
Definition: genfilt.h:128
unsigned int iNumInputs
Definition: genfilt.h:126
unsigned int iNumDofs
Definition: genfilt.h:130

Member Data Documentation

unsigned int GenelStateSpaceMIMO::iNumDofs
protected
unsigned int GenelStateSpaceMIMO::iNumInputs
protected

Definition at line 126 of file genfilt.h.

Referenced by AssJac(), AssRes(), GenelStateSpaceMIMO(), SetValue(), and WorkSpaceDim().

unsigned int GenelStateSpaceMIMO::iNumOutputs
protected

Definition at line 125 of file genfilt.h.

Referenced by AssJac(), AssRes(), GenelStateSpaceMIMO(), GetConnectedNodes(), and WorkSpaceDim().

doublereal* GenelStateSpaceMIMO::pdA
protected

Definition at line 133 of file genfilt.h.

Referenced by AssJac(), AssRes(), GenelStateSpaceMIMO(), SetValue(), and ~GenelStateSpaceMIMO().

doublereal* GenelStateSpaceMIMO::pdB
protected

Definition at line 134 of file genfilt.h.

Referenced by AssJac(), AssRes(), GenelStateSpaceMIMO(), SetValue(), and ~GenelStateSpaceMIMO().

doublereal* GenelStateSpaceMIMO::pdC
protected

Definition at line 135 of file genfilt.h.

Referenced by AssJac(), AssRes(), GenelStateSpaceMIMO(), and ~GenelStateSpaceMIMO().

doublereal* GenelStateSpaceMIMO::pdD
protected

Definition at line 136 of file genfilt.h.

Referenced by AssRes(), and ~GenelStateSpaceMIMO().

doublereal* GenelStateSpaceMIMO::pdE
protected

Definition at line 132 of file genfilt.h.

Referenced by AssJac(), AssRes(), GenelStateSpaceMIMO(), SetValue(), and ~GenelStateSpaceMIMO().

doublereal* GenelStateSpaceMIMO::pdX
protected

Definition at line 138 of file genfilt.h.

Referenced by AssRes(), GenelStateSpaceMIMO(), Output(), SetValue(), and ~GenelStateSpaceMIMO().

doublereal* GenelStateSpaceMIMO::pdXP
protected

Definition at line 139 of file genfilt.h.

Referenced by AssRes(), GenelStateSpaceMIMO(), Output(), and SetValue().

ScalarDof* GenelStateSpaceMIMO::pvSD_y
protected
std::vector<ScalarValue *> GenelStateSpaceMIMO::SV_u
protected

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