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

#include <drive_.h>

Inheritance diagram for FreqSweepDriveCaller:
Collaboration diagram for FreqSweepDriveCaller:

Public Member Functions

 FreqSweepDriveCaller (const DriveHandler *pDH, doublereal d1, const DriveCaller *pOmega, const DriveCaller *pAmplitude, doublereal d2, doublereal d3, doublereal d4)
 
 ~FreqSweepDriveCaller (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
 
const DriveCallerpOmega
 
const DriveCallerpAmplitude
 
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 1069 of file drive_.h.

Constructor & Destructor Documentation

FreqSweepDriveCaller::FreqSweepDriveCaller ( const DriveHandler pDH,
doublereal  d1,
const DriveCaller pOmega,
const DriveCaller pAmplitude,
doublereal  d2,
doublereal  d3,
doublereal  d4 
)

Definition at line 792 of file drive_.cc.

References ASSERT, bNeverEnd, dEndTime, and dStartTime.

Referenced by pCopy().

799 : DriveCaller(pDH),
800 dStartTime(d1), pOmega(pOmega),
801 pAmplitude(pAmplitude),
802 dInitialValue(d2), dEndTime(d3), dFinalValue(d4),
803 bNeverEnd(false)
804 {
805  ASSERT(pOmega != 0);
806  ASSERT(pAmplitude != 0);
807 
808  if (dEndTime <= dStartTime) {
809  bNeverEnd = true;
810  }
811 }
const DriveCaller * pAmplitude
Definition: drive_.h:1073
doublereal dFinalValue
Definition: drive_.h:1076
doublereal dEndTime
Definition: drive_.h:1075
DriveCaller(const DriveHandler *pDH)
Definition: drive.cc:475
const DriveCaller * pOmega
Definition: drive_.h:1072
#define ASSERT(expression)
Definition: colamd.c:977
doublereal dInitialValue
Definition: drive_.h:1074
doublereal dStartTime
Definition: drive_.h:1071
FreqSweepDriveCaller::~FreqSweepDriveCaller ( void  )

Definition at line 813 of file drive_.cc.

References pAmplitude, pOmega, and SAFEDELETE.

814 {
815  if (pOmega) {
817  }
818 
819  if (pAmplitude) {
821  }
822 }
const DriveCaller * pAmplitude
Definition: drive_.h:1073
const DriveCaller * pOmega
Definition: drive_.h:1072
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710

Member Function Documentation

bool FreqSweepDriveCaller::bIsDifferentiable ( void  ) const
inlinevirtual

Reimplemented from DriveCaller.

Definition at line 1124 of file drive_.h.

References DriveCaller::bIsDifferentiable(), pAmplitude, and pOmega.

1125 {
1127 }
const DriveCaller * pAmplitude
Definition: drive_.h:1073
virtual bool bIsDifferentiable(void) const
Definition: drive.h:495
const DriveCaller * pOmega
Definition: drive_.h:1072

Here is the call graph for this function:

doublereal FreqSweepDriveCaller::dGet ( const doublereal dVar) const
inlinevirtual

Implements DriveCaller.

Definition at line 1109 of file drive_.h.

References bNeverEnd, dEndTime, dFinalValue, DriveCaller::dGet(), dInitialValue, dStartTime, pAmplitude, pOmega, and grad::sin().

1110 {
1111  if (dVar <= dStartTime) {
1112  return dInitialValue;
1113  }
1114 
1115  if (bNeverEnd || dVar < dEndTime) {
1116  return dInitialValue + pAmplitude->dGet(dVar)*sin(pOmega->dGet(dVar)*(dVar - dStartTime));
1117  }
1118 
1119  /* else if dVar > dEndTime */
1120  return dFinalValue;
1121 }
const DriveCaller * pAmplitude
Definition: drive_.h:1073
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
Definition: gradient.h:2977
doublereal dFinalValue
Definition: drive_.h:1076
doublereal dEndTime
Definition: drive_.h:1075
const DriveCaller * pOmega
Definition: drive_.h:1072
virtual doublereal dGet(const doublereal &dVar) const =0
doublereal dInitialValue
Definition: drive_.h:1074
doublereal dStartTime
Definition: drive_.h:1071

Here is the call graph for this function:

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

Reimplemented from DriveCaller.

Definition at line 1130 of file drive_.h.

References bNeverEnd, grad::cos(), dEndTime, DriveCaller::dGet(), DriveCaller::dGetP(), dStartTime, pAmplitude, pOmega, and grad::sin().

1131 {
1132  if (dVar < dStartTime || (!bNeverEnd && dVar > dEndTime)) {
1133  return 0.;
1134  }
1135 
1136  doublereal A = pAmplitude->dGet(dVar);
1137  doublereal w = pOmega->dGet(dVar);
1138  doublereal AP = pAmplitude->dGetP(dVar);
1139  doublereal wP = pOmega->dGetP(dVar);
1140  doublereal t = dVar - dStartTime;
1141 
1142  doublereal dVal = AP*sin(w*t) + A*cos(w*t)*(wP*t + w);
1143  if (dVar == dStartTime || (!bNeverEnd && dVar == dEndTime)) {
1144  dVal /= 2.;
1145  }
1146 
1147  return dVal;
1148 }
const DriveCaller * pAmplitude
Definition: drive_.h:1073
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
Definition: gradient.h:2977
virtual doublereal dGetP(const doublereal &dVar) const
Definition: drive.cc:499
doublereal dEndTime
Definition: drive_.h:1075
const DriveCaller * pOmega
Definition: drive_.h:1072
virtual doublereal dGet(const doublereal &dVar) const =0
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
Definition: gradient.h:2978
doublereal dStartTime
Definition: drive_.h:1071
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

DriveCaller * FreqSweepDriveCaller::pCopy ( void  ) const
virtual

Implements DriveCaller.

Definition at line 826 of file drive_.cc.

References dEndTime, dFinalValue, dInitialValue, dStartTime, FreqSweepDriveCaller(), pAmplitude, DriveCaller::pCopy(), DriveCaller::pDrvHdl, pOmega, and SAFENEWWITHCONSTRUCTOR.

827 {
828  DriveCaller* pDC = 0;
833  return pDC;
834 }
const DriveCaller * pAmplitude
Definition: drive_.h:1073
doublereal dFinalValue
Definition: drive_.h:1076
doublereal dEndTime
Definition: drive_.h:1075
const DriveCaller * pOmega
Definition: drive_.h:1072
DriveHandler * pDrvHdl
Definition: drive.h:444
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual DriveCaller * pCopy(void) const =0
doublereal dInitialValue
Definition: drive_.h:1074
doublereal dStartTime
Definition: drive_.h:1071
FreqSweepDriveCaller(const DriveHandler *pDH, doublereal d1, const DriveCaller *pOmega, const DriveCaller *pAmplitude, doublereal d2, doublereal d3, doublereal d4)
Definition: drive_.cc:792

Here is the call graph for this function:

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

Implements DriveCaller.

Definition at line 838 of file drive_.cc.

References dEndTime, dFinalValue, dInitialValue, dStartTime, pAmplitude, pOmega, and DriveCaller::Restart().

839 {
840  out
841  << " frequency sweep, " << dStartTime
842  << ", ", pOmega->Restart(out)
843  << ", ", pAmplitude->Restart(out)
844  << ", " << dInitialValue
845  << ", " << dEndTime
846  << ", " << dFinalValue;
847  return out;
848 }
const DriveCaller * pAmplitude
Definition: drive_.h:1073
doublereal dFinalValue
Definition: drive_.h:1076
virtual std::ostream & Restart(std::ostream &out) const =0
doublereal dEndTime
Definition: drive_.h:1075
const DriveCaller * pOmega
Definition: drive_.h:1072
doublereal dInitialValue
Definition: drive_.h:1074
doublereal dStartTime
Definition: drive_.h:1071

Here is the call graph for this function:

Member Data Documentation

bool FreqSweepDriveCaller::bNeverEnd
private

Definition at line 1077 of file drive_.h.

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

doublereal FreqSweepDriveCaller::dEndTime
private

Definition at line 1075 of file drive_.h.

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

doublereal FreqSweepDriveCaller::dFinalValue
private

Definition at line 1076 of file drive_.h.

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

doublereal FreqSweepDriveCaller::dInitialValue
private

Definition at line 1074 of file drive_.h.

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

doublereal FreqSweepDriveCaller::dStartTime
private

Definition at line 1071 of file drive_.h.

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

const DriveCaller* FreqSweepDriveCaller::pAmplitude
private

Definition at line 1073 of file drive_.h.

Referenced by bIsDifferentiable(), dGet(), dGetP(), pCopy(), Restart(), and ~FreqSweepDriveCaller().

const DriveCaller* FreqSweepDriveCaller::pOmega
private

Definition at line 1072 of file drive_.h.

Referenced by bIsDifferentiable(), dGet(), dGetP(), pCopy(), Restart(), and ~FreqSweepDriveCaller().


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