ArmonicOscillator Class Reference

#include <orsa_interaction.h>

Inheritance diagram for ArmonicOscillator:

Inheritance graph
[legend]
Collaboration diagram for ArmonicOscillator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ArmonicOscillator (const double free_length_in, const double k_in)
 ArmonicOscillator (const ArmonicOscillator &)
void Acceleration (const Frame &, std::vector< Vector > &)
double PotentialEnergy (const Frame &)
Interactionclone () const
InteractionType GetType () const
virtual bool depends_on_velocity () const
void SkipJPLPlanets (const bool b)
bool IsSkippingJPLPlanets () const

Protected Attributes

bool skip_JPL_planets

Detailed Description

Definition at line 401 of file orsa_interaction.h.


Constructor & Destructor Documentation

ArmonicOscillator ( const double  free_length_in,
const double  k_in 
)

Definition at line 712 of file orsa_interaction.cc.

Referenced by ArmonicOscillator::clone().

00712                                                                                      : Interaction(), free_length(free_length_in), k(k_in) {
00713     
00714   }

ArmonicOscillator ( const ArmonicOscillator  ) 

Definition at line 716 of file orsa_interaction.cc.

00716                                                                   : Interaction(), free_length(i.free_length), k(i.k) {
00717     
00718   }


Member Function Documentation

void Acceleration ( const Frame ,
std::vector< Vector > &   
) [virtual]

Implements Interaction.

Interaction * clone (  )  const [virtual]

Implements Interaction.

Definition at line 720 of file orsa_interaction.cc.

References ArmonicOscillator::ArmonicOscillator().

00720                                                {
00721     return new ArmonicOscillator(*this);
00722   }

Here is the call graph for this function:

virtual bool depends_on_velocity (  )  const [inline, virtual, inherited]

Reimplemented in Newton, and Relativistic.

Definition at line 92 of file orsa_interaction.h.

Referenced by Radau15::Step().

00092 { return false; }

InteractionType GetType (  )  const [inline, virtual]

Implements Interaction.

Definition at line 413 of file orsa_interaction.h.

References orsa::ARMONICOSCILLATOR.

00413                                     {
00414       return ARMONICOSCILLATOR;
00415     }

bool IsSkippingJPLPlanets (  )  const [inline, inherited]

Definition at line 98 of file orsa_interaction.h.

References Interaction::skip_JPL_planets.

Referenced by Evolution::Integrate(), Stoer::Step(), DissipativeRungeKutta::Step(), RungeKutta::Step(), Radau15::Step(), Leapfrog::Step(), and OrsaFile::Write().

00098                                       {
00099       return skip_JPL_planets;
00100     }

double PotentialEnergy ( const Frame  )  [virtual]

Implements Interaction.

Definition at line 774 of file orsa_interaction.cc.

References Vector::IsZero(), Vector::Length(), ORSA_WARNING, and Frame::size().

00774                                                           {
00775     
00776     double energy=0.0;
00777     
00778     if (f.size() < 2) return(0.0);
00779     
00780     unsigned int i,j;
00781     
00782     Vector d;
00783     
00784     double ls;
00785     
00786     for (i=1;i<f.size();++i) {
00787       
00788       if (f[i].mass()==0) continue;
00789       
00790       for (j=0;j<i;++j) {
00791         
00792         // if ((f[i].mass==0) && (f[j].mass==0)) continue;
00793         
00794         // d  =  f[i].position;
00795         // d -=  f[j].position;
00796         
00797         d = f[i].DistanceVector(f[j]);
00798         
00799         if (d.IsZero()) {
00800           ORSA_WARNING("two objects in the same position! (%s and %s)",f[i].name().c_str(),f[j].name().c_str());
00801           continue;
00802         }
00803         
00804         // ls = secure_pow(d.Length()-free_length,2);
00805         ls = pow(d.Length()-free_length,2); // don't use the secure version for performance reasons
00806         
00807         energy += ls/2.0;
00808         
00809       } 
00810     }  
00811     
00812     return (energy*k);
00813     
00814   }

Here is the call graph for this function:

void SkipJPLPlanets ( const bool  b  )  [inline, inherited]

Definition at line 95 of file orsa_interaction.h.

References Interaction::skip_JPL_planets.

00095                                       {
00096       skip_JPL_planets = b;
00097     }


Member Data Documentation

bool skip_JPL_planets [protected, inherited]

Definition at line 102 of file orsa_interaction.h.

Referenced by Interaction::IsSkippingJPLPlanets(), Newton::Newton(), and Interaction::SkipJPLPlanets().


The documentation for this class was generated from the following files:
Generated on Fri Nov 3 20:38:28 2006 for liborsa by  doxygen 1.4.7