Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

punnets_common::func_sineshot Class Reference

#include <func.h>

Inheritance diagram for punnets_common::func_sineshot:

punnets_common::func_base List of all members.

Public Methods

 func_sineshot (real ir, real iomega, real it0)
 Constructs a func_sineshot with amplitude r, angle velocity omega, and origin t0.

virtual real getMaxGradient (ntime_t) const
 A pure virtual function that returns the max gradient of the function after the time t.

virtual bool shouldDelete (ntime_t current)
 Return true if the function will return only zeros after the specified time.

virtual real getValue (ntime_t t) const
 A pure virtual function that returns f(t).

virtual real get1stDeriv (ntime_t t) const
 A pure virtual function that returns df(t)/dt.

virtual real get2ndDeriv (ntime_t t) const
 A pure virtual function that returns d2f(t)/dt2.

virtual ntime_t getNextIncontinuity (ntime_t from) const
virtual void getValueDomain (ntime_t t, real &upslope, real &ceil, real &downslope, real &floor) const
virtual void get1stDerivDomain (ntime_t t, real &upslope, real &ceil, real &downslope, real &floor) const
 Obtains a first--order linear envelope of the function. floor < f(t+&alpha;) < ceil, f(t)+&alpha;downslope < f(t+&alpha;) < f(t)+&alpha;upslope.

virtual void get2ndDerivDomain (ntime_t t, real &upslope, real &ceil, real &downslope, real &floor) const
 Obtains a second-order linear envelope of the function. floor < f(t+&alpha;) < ceil, f(t)+&alpha;downslope < f(t+&alpha;) < f(t)+&alpha;upslope.

virtual func_sineshot * clone ()
 Allocates and returns another instance of this function.

virtual std::string getDescription ()
 Obtains a human-readable description string of this function.

virtual bool processMessage (ntime_t t, const message_base &m)

Detailed Description

A single shot of sinusoidal function

This function represents a single shot (one cycle) of a sinusoidal function f(t) = r sin^2(&omega; (t - t0)) (t0 <= t <= t0+&pi;/&omega;).

Definition at line 477 of file func.h.


Member Function Documentation

virtual ntime_t punnets_common::func_sineshot::getNextIncontinuity ntime_t    from const [inline, virtual]
 

A virtual function that returns the next incontinuity point after the time t. In func_base, the function always returns infinity.

Reimplemented from punnets_common::func_base.

Definition at line 509 of file func.h.

References punnets_common::ntime_t.

00509 { return from < t0 ? t0 : mak::Infinity; };

void punnets_common::func_sineshot::getValueDomain ntime_t    t,
real   upslope,
real   ceil,
real   downslope,
real   floor
const [virtual]
 

A virtual function that returns the next incontinuity point after the time t. Although this function has no incontinuity, it returns t0 because the linear envelope is divided at the point.

Implements punnets_common::func_base.

Definition at line 175 of file func.cpp.

References punnets_common::ntime_t, and punnets_common::real.

00176 { 
00177     upslope = ceil = downslope = floor = 0.0;
00178     if( t < t0 || t >= t0 + duration )
00179         return;
00180     else 
00181     {
00182         real phase = omega_2 * (t - t0);
00183         real phi = phase + M_PI;
00184         if( phi >= 2*M_PI ) phi -= 2*M_PI;
00185         ( r > 0 ? ceil : floor ) = r;
00186         if( phase < 0.5 * M_PI )
00187         {
00188             ( r > 0 ? upslope : downslope ) = omega_2 * r_div_2 * cos( alpha * cos( beta * phi ) + 0.5*M_PI - alpha);
00189             ( r > 0 ? downslope : upslope ) = - omega_2 * r_div_2 * cos( alpha * cos( beta * (phi-M_PI) ) + 0.5*M_PI - alpha);
00190         }
00191         else if( phase < M_PI )
00192         {
00193             ( r > 0 ? upslope : downslope ) = r_div_2 * omega_2 * sin(phase );
00194             ( r > 0 ? downslope : upslope ) = - omega_2 * r_div_2 * cos( alpha * cos( beta * (phi-M_PI) ) + 0.5*M_PI - alpha);
00195         }
00196         else if( phase < 1.5*M_PI )
00197         {
00198             ( r > 0 ? downslope : upslope ) = - omega_2 * r_div_2 * cos( alpha * cos( beta * (phi+M_PI) ) + 0.5*M_PI - alpha);
00199         }
00200         else
00201         {
00202             ( r > 0 ? downslope : upslope ) = r_div_2 * omega_2 * sin(phase);
00203         }
00204     }
00205 }

virtual bool punnets_common::func_sineshot::processMessage ntime_t    t,
const message_base   m
[inline, virtual]
 

Process the specified message at the specified time. Return true if the message is processed. In func_base, this function always returns false (processes no message).

Reimplemented from punnets_common::func_base.

Definition at line 528 of file func.h.

References punnets_common::message_base::getMessageId(), and punnets_common::ntime_t.

00528                                                                   { 
00529 #ifdef USE_DYNAMIC
00530         if( dynamic_cast<const message_set_t0 *>(&m) != NULL ) 
00531 #else
00532         if( m.getMessageId() == message_set_t0::messageId ) 
00533 #endif
00534         {
00535             t0 = t;
00536             return true;
00537         }
00538         return func_base::processMessage(t, m); 
00539     }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:42:28 2003 for Punnets by doxygen1.2.18