MappedTable Class Reference

#include <orsa_interaction.h>

List of all members.

Public Member Functions

void load (const std::vector< Body > &f, const bool skip_JPL_planets)
Vector DistanceVector (const unsigned int i, const unsigned int j) const
double Distance (const unsigned int i, const unsigned int j) const
double Distance2 (const unsigned int i, const unsigned int j) const
double Distance3 (const unsigned int i, const unsigned int j) const
double Distance4 (const unsigned int i, const unsigned int j) const
double OneOverDistance (const unsigned int i, const unsigned int j) const
double OneOverDistanceSquare (const unsigned int i, const unsigned int j) const
double OneOverDistanceCube (const unsigned int i, const unsigned int j) const
Vector DistanceVectorOverDistanceCube (const unsigned int i, const unsigned int j) const


Member Function Documentation

double Distance const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 121 of file orsa_interaction.h.

Referenced by Newton::Acceleration().

00121                                                                              {
00122       return d1[ij_to_index(i,j)];
00123     }

double Distance2 const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 125 of file orsa_interaction.h.

00125                                                                               {
00126       return d2[ij_to_index(i,j)];
00127     }

double Distance3 const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 129 of file orsa_interaction.h.

00129                                                                               {
00130       return d3[ij_to_index(i,j)];
00131     }

double Distance4 const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 133 of file orsa_interaction.h.

00133                                                                               {
00134       return d4[ij_to_index(i,j)];
00135     }

Vector DistanceVector const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 117 of file orsa_interaction.h.

Referenced by Newton::Acceleration().

00117                                                                                    {
00118       return (sign_ij(i,j)*distance_vector[ij_to_index(i,j)]);
00119     }

Vector DistanceVectorOverDistanceCube const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 149 of file orsa_interaction.h.

Referenced by Newton::Acceleration().

00149                                                                                                    {
00150       return (sign_ij(i,j)*distance_vector_over_distance_cube[ij_to_index(i,j)]);
00151     }

void load const std::vector< Body > &  f,
const bool  skip_JPL_planets
 

Definition at line 80 of file orsa_interaction.cc.

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

Referenced by Newton::Acceleration().

00080                                                                                {
00081     const unsigned int f_size = f.size();
00082     N = f_size;
00083     mapping.resize(N);
00084     M = 0;
00085     for (unsigned int k=0; k<f_size; ++k) {
00086       mapping[k] = k; 
00087       if (!f[k].has_zero_mass()) {
00088         mapping[k] = mapping[M];
00089         mapping[M] = k;
00090         ++M;
00091       }
00092     }
00093     //
00094     MN = M*N;
00095     //
00096     if (MN != distance_vector.size()) {
00097       distance_vector.resize(MN);
00098       d1.resize(MN);
00099       d2.resize(MN);
00100       d3.resize(MN);
00101       d4.resize(MN);
00102       one_over_distance.resize(MN);
00103       one_over_distance_square.resize(MN);
00104       one_over_distance_cube.resize(MN);
00105       distance_vector_over_distance_cube.resize(MN);
00106     }
00107     //
00108     Vector d;
00109     Vector v;
00110     double l;
00111     double one_over_d;
00112     double one_over_d2;
00113     double one_over_d3;
00114     unsigned int index;
00115     //
00116     for (unsigned int i=0; i<(N-1); ++i) {
00117       for (unsigned int j=i+1; j<N; ++j) {
00118         // if (i == j) continue;
00119         if (f[i].has_zero_mass() && f[j].has_zero_mass()) continue;
00120         if (skip_JPL_planets && (f[i].JPLPlanet() != NONE) && (f[i].JPLPlanet() != NONE)) continue;
00121         //
00122         index = ij_to_index(i,j);
00123         //
00124         // unsing: inline Vector Body::distanceVector(const Body & b) const { return b.position()-position(); }
00125         // so: d = f[j].position() - f[i].position();
00126         d           = f[i].DistanceVector(f[j]);
00127         //
00128         if (distance_vector[index] == d) continue; // everything already computed!
00129         //
00130         l           = d.Length();
00131         one_over_d  = 1.0/l;
00132         one_over_d2 = one_over_d*one_over_d;
00133         one_over_d3 = one_over_d*one_over_d2;
00134         //
00135         // index = ij_to_index(i,j);
00136         //
00137         //
00138         distance_vector[index]        = d;
00139         d1[index]                     = l;
00140         d2[index]                     = l*l;
00141         d3[index]                     = d2[index]*l;
00142         d4[index]                     = d3[index]*l;
00143         one_over_distance[index]        = one_over_d;
00144         one_over_distance_square[index] = one_over_d2;
00145         one_over_distance_cube[index]   = one_over_d3;
00146         distance_vector_over_distance_cube[index] = d*one_over_d3;
00147       }
00148     }
00149   }

Here is the call graph for this function:

double OneOverDistance const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 137 of file orsa_interaction.h.

Referenced by Newton::Acceleration().

00137                                                                                     {
00138       return one_over_distance[ij_to_index(i,j)];
00139     }

double OneOverDistanceCube const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 145 of file orsa_interaction.h.

Referenced by Newton::Acceleration().

00145                                                                                         {
00146       return one_over_distance_cube[ij_to_index(i,j)];
00147     }

double OneOverDistanceSquare const unsigned int  i,
const unsigned int  j
const [inline]
 

Definition at line 141 of file orsa_interaction.h.

Referenced by Newton::Acceleration().

00141                                                                                           {
00142       return one_over_distance_square[ij_to_index(i,j)];
00143     }


The documentation for this class was generated from the following files:
Generated on Tue Jan 11 15:29:14 2005 for liborsa by  doxygen 1.4.0