orsa_frame.cc File Reference

#include "orsa_frame.h"
#include "orsa_universe.h"
#include "orsa_config.h"
#include <iostream>

Include dependency graph for orsa_frame.cc:

Go to the source code of this file.

Namespaces

namespace  orsa

Functions

void print (const Frame &f)
static double modified_mu (const vector< Body > &f, const unsigned int i)
Vector CenterOfMass (const vector< Body > &f)
Vector CenterOfMassVelocity (const vector< Body > &f)
Vector Barycenter (const vector< Body > &f)
Vector BarycenterVelocity (const vector< Body > &f)
Vector RelativisticBarycenter (const vector< Body > &f)
Vector RelativisticBarycenterVelocity (const vector< Body > &f)
Vector AngularMomentum (const vector< Body > &f, const Vector &center)
Vector BarycentricAngularMomentum (const vector< Body > &f)
double KineticEnergy (const vector< Body > &f)


Function Documentation

Vector AngularMomentum const vector< Body > &  f,
const Vector &  center
 

Definition at line 188 of file orsa_frame.cc.

References orsa::ExternalProduct().

00188                                                                         {
00189     Vector vec_sum;
00190     unsigned int k;
00191     for (k=0;k<f.size();++k) {
00192       if (f[k].mass() > 0) {
00193         vec_sum += f[k].mass()*ExternalProduct(f[k].position()-center,f[k].velocity());
00194       }
00195     }
00196     return (vec_sum);
00197   }

Here is the call graph for this function:

Vector Barycenter const vector< Body > &  f  ) 
 

Definition at line 148 of file orsa_frame.cc.

Referenced by orsa::BarycentricAngularMomentum().

00148                                             {
00149     return (orsa::CenterOfMass(f));
00150   }

Vector BarycenterVelocity const vector< Body > &  f  ) 
 

Definition at line 152 of file orsa_frame.cc.

00152                                                     {
00153     return (orsa::CenterOfMassVelocity(f));
00154   }

Vector BarycentricAngularMomentum const vector< Body > &  f  ) 
 

Definition at line 203 of file orsa_frame.cc.

References orsa::Barycenter().

00203                                                             {
00204     return (orsa::AngularMomentum(f,Barycenter(f)));
00205   }

Here is the call graph for this function:

Vector CenterOfMass const vector< Body > &  f  ) 
 

Definition at line 122 of file orsa_frame.cc.

00122                                               {
00123     Vector sum_vec(0,0,0);
00124     double sum_mass = 0.0;
00125     for (unsigned int k=0; k<f.size(); ++k) {
00126       const double mass = f[k].mass();
00127       if (mass > 0.0) {
00128         sum_vec  += mass*f[k].position();
00129         sum_mass += mass;
00130       }
00131     }
00132     return (sum_vec/sum_mass);
00133   }

Vector CenterOfMassVelocity const vector< Body > &  f  ) 
 

Definition at line 135 of file orsa_frame.cc.

00135                                                       {
00136     Vector sum_vec(0,0,0);
00137     double sum_mass = 0.0;
00138     for (unsigned int k=0; k<f.size(); ++k) {
00139       const double mass = f[k].mass();
00140       if (mass > 0.0) {
00141         sum_vec  += mass*f[k].velocity();
00142         sum_mass += mass;
00143       }
00144     }
00145     return (sum_vec/sum_mass);
00146   }

double KineticEnergy const vector< Body > &  f  ) 
 

Definition at line 207 of file orsa_frame.cc.

00207                                                {
00208     if (f.size()==0) return (0.0);
00209     double energy=0.0;
00210     unsigned int k=0;
00211     while (k<f.size()) {
00212       energy += f[k].KineticEnergy();
00213       k++;
00214     }
00215     return (energy);
00216   }

static double modified_mu const vector< Body > &  f,
const unsigned int  i
[static]
 

Definition at line 89 of file orsa_frame.cc.

References orsa::GetC(), and Vector::Length().

Referenced by orsa::RelativisticBarycenter(), and orsa::RelativisticBarycenterVelocity().

00089                                                                           {
00090     if (f[i].has_zero_mass()) return 0.0;
00091     const double one_over_two_c = 1.0/(2.0*GetC());
00092     // const double g = GetG();
00093     //
00094     vector<double> mu(f.size());
00095     for (unsigned int j=0; j<f.size(); ++j) {
00096       if (f[j].has_zero_mass()) {
00097         mu[j] = 0.0;
00098       } else {
00099         mu[j] = f[j].mu();
00100       }
00101     }
00102     //
00103     double mod_mu = 0.0;
00104     double tmp_sum = 0.0;
00105     for (unsigned int j=0; j<f.size(); ++j) {   
00106       if (j == i) continue;
00107       tmp_sum += mu[j]/(f[j].position()-f[i].position()).Length();
00108     }
00109     //
00110     mod_mu += mu[i]*(1.0+one_over_two_c*(f[i].velocity().LengthSquared()-tmp_sum));
00111     return mod_mu;
00112   }

Here is the call graph for this function:

void print const Frame &  f  ) 
 

Definition at line 59 of file orsa_frame.cc.

References orsa::print().

00059                              {
00060     cout << "Frame time: " << f.Time() << endl;
00061     cout << "Frame size: " << f.size() << endl;
00062     unsigned int l;
00063     for (l=0;l<f.size();l++) print(f[l]);
00064   }

Here is the call graph for this function:

Vector RelativisticBarycenter const vector< Body > &  f  ) 
 

Definition at line 156 of file orsa_frame.cc.

References orsa::modified_mu().

00156                                                         {
00157     Vector sum_vec(0,0,0);
00158     double sum_mu = 0.0;
00159     for (unsigned int i=0; i<f.size(); ++i) {
00160       const double mod_mu = modified_mu(f,i);
00161       if (mod_mu > 0.0) {
00162         sum_vec += mod_mu * f[i].position();
00163         sum_mu  += mod_mu;
00164       }
00165     }
00166     //
00167     return (sum_vec/sum_mu);
00168   }

Here is the call graph for this function:

Vector RelativisticBarycenterVelocity const vector< Body > &  f  ) 
 

Definition at line 170 of file orsa_frame.cc.

References orsa::modified_mu().

00170                                                                 {
00171     Vector sum_vec(0,0,0);
00172     double sum_mu = 0.0;
00173     for (unsigned int i=0; i<f.size(); ++i) {
00174       const double mod_mu = modified_mu(f,i);
00175       if (mod_mu > 0.0) {
00176         sum_vec += mod_mu * f[i].velocity();
00177         sum_mu  += mod_mu;
00178       }
00179     }
00180     //
00181     return (sum_vec/sum_mu);
00182   }

Here is the call graph for this function:


Generated on Tue Jan 11 15:26:57 2005 for liborsa by  doxygen 1.4.0