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

#include <drive_.h>

Inheritance diagram for CosineDriveCaller:
Collaboration diagram for CosineDriveCaller:

Public Member Functions

 CosineDriveCaller (const DriveHandler *pDH, doublereal d1, doublereal d2, doublereal d3, integer iNumCyc, doublereal d4)
 
 ~CosineDriveCaller (void)
 
virtual DriveCallerpCopy (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
doublereal dGet (const doublereal &dVar) const
 
virtual bool bIsDifferentiable (void) const
 
virtual doublereal dGetP (const doublereal &dVar) const
 
- Public Member Functions inherited from DriveCaller
 DriveCaller (const DriveHandler *pDH)
 
virtual ~DriveCaller (void)
 
virtual doublereal dGet (void) const
 
virtual doublereal dGetP (void) const
 
virtual void SetDrvHdl (const DriveHandler *pDH)
 
virtual const DriveHandlerpGetDrvHdl (void) const
 
virtual void Output (OutputHandler &OH) const
 
virtual void Trace (OutputHandler &OH) 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 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 Traceable
 Traceable (flag fTrace=0)
 
virtual ~Traceable (void)
 
virtual flag fToBeTraced (void) const
 
virtual void SetTraceFlag (flag f=TRACE)
 

Private Attributes

doublereal dStartTime
 
doublereal dOmega
 
doublereal dAmplitude
 
integer iNumCycles
 
doublereal dInitialValue
 
doublereal dEndTime
 
doublereal dFinalValue
 
bool bNeverEnd
 

Additional Inherited Members

- Public Types inherited from DriveCaller
enum  OutputFlags { OUTPUT_VALUE = OUTPUT_PRIVATE << 0, OUTPUT_DERIVATIVE = OUTPUT_PRIVATE << 1 }
 
enum  TraceFlags { TRACE_VALUE = TRACE_PRIVATE << 0, TRACE_DERIVATIVE = TRACE_PRIVATE << 1 }
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from Traceable
enum  { TRACE = 0x01U, TRACE_PUBLIC_MASK = 0x0FU, TRACE_PRIVATE = 0x10U, TRACE_PRIVATE_MASK = ~TRACE_PUBLIC_MASK }
 
- Protected Attributes inherited from DriveCaller
DriveHandlerpDrvHdl
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 

Detailed Description

Definition at line 840 of file drive_.h.

Constructor & Destructor Documentation

CosineDriveCaller::CosineDriveCaller ( const DriveHandler pDH,
doublereal  d1,
doublereal  d2,
doublereal  d3,
integer  iNumCyc,
doublereal  d4 
)

Definition at line 692 of file drive_.cc.

References bNeverEnd, dAmplitude, dEndTime, dFinalValue, dInitialValue, dOmega, dStartTime, iNumCycles, and M_PI.

Referenced by pCopy().

696 : DriveCaller(pDH),
697 dStartTime(d1), dOmega(d2), dAmplitude(d3),
698 iNumCycles(iNumCyc), dInitialValue(d4), bNeverEnd(false)
699 {
700  /* Onde di coseno che partono da zero ed arrivano a 0 */
701  if (iNumCycles > 0) {
704 
705  /* Onde di coseno che continuano all'infinito */
706  } else if (iNumCycles == 0) {
707  dEndTime = 0.;
708  bNeverEnd = true;
709 
710  /* Onde di coseno che partono da 0 ed arrivano ad 1
711  * con tangente orizzontale */
712  } else {
715  }
716 }
doublereal dStartTime
Definition: drive_.h:842
#define M_PI
Definition: gradienttest.cc:67
doublereal dOmega
Definition: drive_.h:843
doublereal dEndTime
Definition: drive_.h:847
DriveCaller(const DriveHandler *pDH)
Definition: drive.cc:475
integer iNumCycles
Definition: drive_.h:845
doublereal dFinalValue
Definition: drive_.h:848
double doublereal
Definition: colamd.c:52
doublereal dAmplitude
Definition: drive_.h:844
doublereal dInitialValue
Definition: drive_.h:846
CosineDriveCaller::~CosineDriveCaller ( void  )

Definition at line 718 of file drive_.cc.

References NO_OP.

719 {
720  NO_OP;
721 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

bool CosineDriveCaller::bIsDifferentiable ( void  ) const
inlinevirtual

Reimplemented from DriveCaller.

Definition at line 892 of file drive_.h.

893 {
894  return true;
895 }
doublereal CosineDriveCaller::dGet ( const doublereal dVar) const
inlinevirtual

Implements DriveCaller.

Definition at line 877 of file drive_.h.

References bNeverEnd, grad::cos(), dAmplitude, dEndTime, dFinalValue, dInitialValue, dOmega, and dStartTime.

878 {
879  if (dVar < dStartTime) {
880  return dInitialValue;
881  }
882 
883  if (bNeverEnd || dVar < dEndTime) {
884  return dInitialValue + dAmplitude*(1. - cos(dOmega*(dVar - dStartTime)));
885  }
886 
887  /* else if dTime > dEndTime */
888  return dFinalValue;
889 }
doublereal dStartTime
Definition: drive_.h:842
doublereal dOmega
Definition: drive_.h:843
doublereal dEndTime
Definition: drive_.h:847
doublereal dFinalValue
Definition: drive_.h:848
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
Definition: gradient.h:2978
doublereal dAmplitude
Definition: drive_.h:844
doublereal dInitialValue
Definition: drive_.h:846

Here is the call graph for this function:

doublereal CosineDriveCaller::dGetP ( const doublereal dVar) const
inlinevirtual

Reimplemented from DriveCaller.

Definition at line 898 of file drive_.h.

References bNeverEnd, dAmplitude, dEndTime, dOmega, dStartTime, and grad::sin().

899 {
900  if (dVar < dStartTime) {
901  return 0.;
902  }
903 
904  if (!bNeverEnd && dVar > dEndTime) {
905  return 0.;
906  }
907 
908  return dAmplitude*dOmega*sin(dOmega*(dVar - dStartTime));
909 }
doublereal dStartTime
Definition: drive_.h:842
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
Definition: gradient.h:2977
doublereal dOmega
Definition: drive_.h:843
doublereal dEndTime
Definition: drive_.h:847
doublereal dAmplitude
Definition: drive_.h:844

Here is the call graph for this function:

DriveCaller * CosineDriveCaller::pCopy ( void  ) const
virtual

Implements DriveCaller.

Definition at line 725 of file drive_.cc.

References CosineDriveCaller(), dAmplitude, dInitialValue, dOmega, dStartTime, iNumCycles, DriveCaller::pDrvHdl, and SAFENEWWITHCONSTRUCTOR.

726 {
727  DriveCaller* pDC = 0;
731  return pDC;
732 }
doublereal dStartTime
Definition: drive_.h:842
doublereal dOmega
Definition: drive_.h:843
CosineDriveCaller(const DriveHandler *pDH, doublereal d1, doublereal d2, doublereal d3, integer iNumCyc, doublereal d4)
Definition: drive_.cc:692
integer iNumCycles
Definition: drive_.h:845
DriveHandler * pDrvHdl
Definition: drive.h:444
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
doublereal dAmplitude
Definition: drive_.h:844
doublereal dInitialValue
Definition: drive_.h:846

Here is the call graph for this function:

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

Implements DriveCaller.

Definition at line 736 of file drive_.cc.

References dAmplitude, dInitialValue, dOmega, dStartTime, and iNumCycles.

737 {
738  return out
739  << " cosine, " << dStartTime
740  << ", " << dOmega
741  << ", " << dAmplitude
742  << ", " << iNumCycles
743  << ", " << dInitialValue;
744 }
doublereal dStartTime
Definition: drive_.h:842
doublereal dOmega
Definition: drive_.h:843
integer iNumCycles
Definition: drive_.h:845
doublereal dAmplitude
Definition: drive_.h:844
doublereal dInitialValue
Definition: drive_.h:846

Member Data Documentation

bool CosineDriveCaller::bNeverEnd
private

Definition at line 849 of file drive_.h.

Referenced by CosineDriveCaller(), dGet(), and dGetP().

doublereal CosineDriveCaller::dAmplitude
private

Definition at line 844 of file drive_.h.

Referenced by CosineDriveCaller(), dGet(), dGetP(), pCopy(), and Restart().

doublereal CosineDriveCaller::dEndTime
private

Definition at line 847 of file drive_.h.

Referenced by CosineDriveCaller(), dGet(), and dGetP().

doublereal CosineDriveCaller::dFinalValue
private

Definition at line 848 of file drive_.h.

Referenced by CosineDriveCaller(), and dGet().

doublereal CosineDriveCaller::dInitialValue
private

Definition at line 846 of file drive_.h.

Referenced by CosineDriveCaller(), dGet(), pCopy(), and Restart().

doublereal CosineDriveCaller::dOmega
private

Definition at line 843 of file drive_.h.

Referenced by CosineDriveCaller(), dGet(), dGetP(), pCopy(), and Restart().

doublereal CosineDriveCaller::dStartTime
private

Definition at line 842 of file drive_.h.

Referenced by CosineDriveCaller(), dGet(), dGetP(), pCopy(), and Restart().

integer CosineDriveCaller::iNumCycles
private

Definition at line 845 of file drive_.h.

Referenced by CosineDriveCaller(), pCopy(), and Restart().


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