#include <orsa_interaction.h>
Inheritance diagram for ArmonicOscillator:
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 &) |
Interaction * | clone () const |
InteractionType | GetType () const |
virtual bool | depends_on_velocity () const |
void | SkipJPLPlanets (const bool b) |
bool | IsSkippingJPLPlanets () const |
Protected Attributes | |
bool | skip_JPL_planets |
Definition at line 401 of file orsa_interaction.h.
ArmonicOscillator | ( | const double | free_length_in, | |
const double | k_in | |||
) |
ArmonicOscillator | ( | const ArmonicOscillator & | ) |
Implements Interaction.
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:
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:
InteractionType GetType | ( | ) | const [inline, virtual] |
Implements Interaction.
Definition at line 413 of file orsa_interaction.h.
References orsa::ARMONICOSCILLATOR.
00413 { 00414 return ARMONICOSCILLATOR; 00415 }
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().
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 }
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 }
bool skip_JPL_planets [protected, inherited] |
Definition at line 102 of file orsa_interaction.h.
Referenced by Interaction::IsSkippingJPLPlanets(), Newton::Newton(), and Interaction::SkipJPLPlanets().