GravitationalTree Class Reference

#include <orsa_interaction.h>

Inheritance diagram for GravitationalTree:

Inheritance graph
[legend]
Collaboration diagram for GravitationalTree:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GravitationalTree ()
 GravitationalTree (const GravitationalTree &)
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

Constructor & Destructor Documentation

GravitationalTree  ) 
 

Definition at line 417 of file orsa_interaction_tree.cc.

References orsa::GetG().

Referenced by GravitationalTree::clone().

00417                                        : Interaction() {
00418     g = GetG();
00419     theta = 0.7;
00420   }

Here is the call graph for this function:

GravitationalTree const GravitationalTree  ) 
 

Definition at line 422 of file orsa_interaction_tree.cc.

References orsa::GetG().

00422                                                                 : Interaction() {
00423     g = GetG();
00424     theta = 0.7;
00425   }

Here is the call graph for this function:


Member Function Documentation

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

Implements Interaction.

Definition at line 431 of file orsa_interaction_tree.cc.

References orsa::ComputeAcceleration().

00431                                                                         {
00432     
00433     if (f.size() < 2) return;
00434     
00435     a.resize(f.size());
00436     
00437     {
00438       unsigned int k=0;
00439       while (k<a.size()) {    
00440         a[k].Set(0.0,0.0,0.0);
00441         ++k;
00442       }
00443     }
00444     
00445     map <unsigned int, unsigned int> frame_map;
00446     {
00447       unsigned int k=0;
00448       while (k<f.size()) {
00449         frame_map[f[k].BodyId()] = k;
00450         ++k;
00451       }
00452     }
00453     
00454     TreeNode root_node;
00455     
00456     unsigned int k=0;
00457     while (k<f.size()) {
00458       root_node.b.push_back(f[k]);
00459       ++k;
00460     }
00461     
00462     root_node.BuildMesh(true);
00463     
00464     // root_node.print();
00465     
00466     list<TreeNode>::const_iterator node_body_it, node_domain_it;
00467     list<Body>::const_iterator body_it;
00468     
00469     stack<list<TreeNode>::const_iterator> stk_body, stk_domain;
00470     
00471     double angle;
00472     
00473     unsigned int num_direct=0, num_domain=0;
00474     
00475     node_body_it = root_node.child.begin();
00476     while (node_body_it != root_node.child.end()) {
00477       
00478       if (node_body_it->is_leaf()) {
00479         
00480         body_it = node_body_it->b.begin();
00481         while (body_it != node_body_it->b.end()) {
00482           
00483           node_domain_it = root_node.child.begin();
00484           while (node_domain_it != root_node.child.end()) {
00485             
00486             angle = (node_domain_it->l)/(node_domain_it->node_center_of_mass()-body_it->position()).Length();
00487             
00488             if (angle < theta) {
00489               
00490               ++num_domain;
00491               // cerr << "num_domain: " << num_domain << "  num_direct: " << num_direct << "  ratio: " << (1.0*num_domain)/(1.0*num_direct) << endl;
00492               
00493               a[frame_map[body_it->BodyId()]] += ComputeAcceleration(body_it,node_domain_it);
00494               
00495               ++node_domain_it;
00496               
00497             } else if (node_domain_it->is_leaf()) {
00498               
00499               if (body_it->BodyId() != node_domain_it->b.begin()->BodyId()) {
00500                 a[frame_map[body_it->BodyId()]] += ComputeAcceleration(body_it,node_domain_it);
00501                 ++num_direct;
00502                 // cerr << "num_domain: " << num_domain << "  num_direct: " << num_direct << "  ratio: " << (1.0*num_domain)/(1.0*num_direct) << endl;
00503               }
00504               
00505               ++node_domain_it;
00506               
00507             } else {
00508               
00509               stk_domain.push(node_domain_it);
00510               node_domain_it = node_domain_it->child.begin();
00511               
00512             }
00513             
00514             while (stk_domain.size()) {
00515               if (node_domain_it == stk_domain.top()->child.end()) {
00516                 node_domain_it = stk_domain.top();
00517                 ++node_domain_it;
00518                 stk_domain.pop();
00519               } else {
00520                 break;
00521               }
00522             }
00523             
00524           }
00525           
00526           ++body_it;
00527         }
00528         
00529         ++node_body_it;
00530         
00531       } else { // not leaf
00532         
00533         stk_body.push(node_body_it);
00534         node_body_it = node_body_it->child.begin();
00535         
00536       }
00537       
00538       while (stk_body.size()) {
00539         if (node_body_it == stk_body.top()->child.end()) {
00540           node_body_it = stk_body.top();
00541           ++node_body_it;
00542           stk_body.pop();
00543         } else {
00544           break;
00545         }
00546       }
00547       
00548     }
00549     
00550     {
00551       unsigned int k=0;
00552       while (k<a.size()) {    
00553         a[k] *= g;
00554         ++k;
00555       }
00556     }
00557     
00558   }

Here is the call graph for this function:

Interaction * clone  )  const [virtual]
 

Implements Interaction.

Definition at line 427 of file orsa_interaction_tree.cc.

References GravitationalTree::GravitationalTree().

00427                                                {
00428     return new GravitationalTree(*this);
00429   }

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.

00092 { return false; }

InteractionType GetType  )  const [inline, virtual]
 

Implements Interaction.

Definition at line 368 of file orsa_interaction.h.

References orsa::GRAVITATIONALTREE.

00368                                     {
00369       return GRAVITATIONALTREE;
00370     }

bool IsSkippingJPLPlanets  )  const [inline, inherited]
 

Definition at line 98 of file orsa_interaction.h.

References Interaction::skip_JPL_planets.

Referenced by Evolution::Integrate().

00098                                       {
00099       return skip_JPL_planets;
00100     }

double PotentialEnergy const Frame  )  [virtual]
 

Implements Interaction.

Definition at line 560 of file orsa_interaction_tree.cc.

00560                                                         {
00561     // to be done...
00562     return 0.0;
00563   }

void SkipJPLPlanets const bool  b  )  [inline, inherited]
 

Definition at line 95 of file orsa_interaction.h.

References Interaction::skip_JPL_planets.

Referenced by OrsaFile::Read().

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(), and Interaction::SkipJPLPlanets().


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