#include "orsa_universe.h"#include "orsa_file.h"#include "orsa_error.h"#include <iostream>#include <string>#include <limits>#include <algorithm>Include dependency graph for orsa_universe.cc:

Go to the source code of this file.
Namespaces | |
| namespace | orsa |
Functions | |
| double | FromUnits (const double x, const time_unit u, const int power) |
| double | FromUnits (const double x, const length_unit u, const int power) |
| double | FromUnits (const double x, const mass_unit u, const int power) |
| Frame | StartFrame (const vector< BodyWithEpoch > &f, vector< JPL_planets > &jf, const Interaction *itr, const Integrator *itg, const UniverseTypeAwareTime &t) |
| A good frame to start an integration with. | |
Variables | |
| Universe * | universe = 0 |
| The active universe. | |
|
||||||||||||||||
|
Definition at line 137 of file orsa_universe.cc. 00137 { return orsa::units->FromUnits(x,u,power); };
|
|
||||||||||||||||
|
Definition at line 136 of file orsa_universe.cc. 00136 { return orsa::units->FromUnits(x,u,power); };
|
|
||||||||||||||||
|
Definition at line 135 of file orsa_universe.cc. 00135 { return orsa::units->FromUnits(x,u,power); };
|
|
||||||||||||||||||||||||
|
A good frame to start an integration with.
Definition at line 584 of file orsa_universe.cc. References Evolution::clear(), orsa::FromUnits(), UniverseTypeAwareTime::GetDate(), Universe::GetUniverseType(), Evolution::Integrate(), ORSA_WARNING, Evolution::push_back(), orsa::Real, orsa::SECOND, UniverseTypeAwareTime::SetDate(), Evolution::SetIntegrator(), Evolution::SetIntegratorTimeStep(), Evolution::SetInteraction(), Evolution::SetSamplePeriod(), UniverseTypeAwareTime::SetTime(), orsa::Simulated, Evolution::size(), Frame::size(), UniverseTypeAwareTime::Time(), and orsa::universe. 00584 {
00585 // Frame StartFrame(const vector<BodyWithEpoch> & f, vector<JPL_planets> & jf, InteractionType interaction_type, IntegratorType integrator_type, const UniverseTypeAwareTime & t) {
00586
00587 // const double original_timestep = itg->timestep;
00588 const UniverseTypeAwareTimeStep original_timestep = itg->timestep;
00589
00590 Frame frame_start;
00591
00592 switch (universe->GetUniverseType()) {
00593 case Real: {
00594 frame_start.SetDate(t.GetDate());
00595 Frame running_frame;
00596 Evolution running_evolution;
00597 // running_evolution.interaction = itr->clone();
00598 // running_evolution.integrator = itg->clone();
00599 running_evolution.SetIntegrator(itg);
00600 running_evolution.SetInteraction(itr);
00601
00602 // put the JPL bodies into the frame_start
00603 /*
00604 if (jf.size()) {
00605 Date ddf = t.GetDate();
00606 unsigned int k;
00607 for (k=0;k<jf.size();++k) {
00608 jf[k].SetEpoch(ddf);
00609 Body b(jf[k].name(),
00610 jf[k].mass(),
00611 jf[k].radius(),
00612 jf[k].position(),
00613 jf[k].velocity());
00614 frame_start.push_back(b);
00615 }
00616 }
00617 */
00618 //
00619 if (jf.size()) {
00620 unsigned int k;
00621 for (k=0;k<jf.size();++k) {
00622 frame_start.push_back(JPLBody(jf[k],t.GetDate()));
00623 }
00624 }
00625
00626 if (f.size()) {
00627
00628 Frame last_frame;
00629 unsigned int base_bodies, l;
00630
00631 unsigned int j=0;
00632 while (j < f.size()) {
00633
00634 running_frame.clear();
00635 // running_frame.SetDate(f[j].epoch.GetDate());
00636 running_frame.SetDate(f[j].GetEpoch().GetDate());
00637
00638 running_frame.push_back(f[j]);
00639 ++j;
00640
00641 // while ((j<f.size()) && (f[j].epoch.GetDate() == running_frame.GetDate())) {
00642 while ((j<f.size()) && (f[j].Epoch().GetDate() == running_frame.GetDate())) {
00643 running_frame.push_back(f[j]);
00644 ++j;
00645 }
00646
00647 base_bodies = running_frame.size();
00648
00649 // JPL
00650 /*
00651 Date ddt = running_frame.GetDate();
00652 unsigned int k;
00653 for (k=0;k<jf.size();++k) {
00654 jf[k].SetEpoch(ddt);
00655 Body b(jf[k].name(),
00656 jf[k].mass(),
00657 jf[k].radius(),
00658 jf[k].position(),
00659 jf[k].velocity());
00660 running_frame.push_back(b);
00661 }
00662 */
00663 {
00664 unsigned int k;
00665 for (k=0;k<jf.size();++k) {
00666 running_frame.push_back(JPLBody(jf[k],running_frame.GetDate()));
00667 }
00668 }
00669
00670 running_evolution.clear();
00671 running_evolution.push_back(running_frame);
00672 // running_evolution.sample_period = fabs(running_frame.GetTime() - frame_start.GetTime());
00673 running_evolution.SetSamplePeriod((running_frame - frame_start).absolute());
00674 running_evolution.SetIntegratorTimeStep(original_timestep);
00675 running_evolution.Integrate(t);
00676
00677 last_frame = running_evolution[running_evolution.size()-1];
00678 if (fabs(last_frame.Time()-frame_start.Time()) > FromUnits(1.0e-3,SECOND)) {
00679 /*
00680 fprintf(stderr,"!!! last_frame.Time() != frame_start.Time() --->> %30.20f != %30.20f\n",last_frame.Time(),frame_start.Time());
00681 cerr << "|dT| = " << FromUnits(fabs(last_frame.Time()-frame_start.Time()),SECOND,-1) << " seconds" << endl;
00682 print(last_frame);
00683 */
00684 ORSA_WARNING(
00685 "last_frame.Time() != frame_start.Time() --->> %30.20f != %30.20f\n"
00686 "|dT| = %g seconds\n",
00687 last_frame.Time(),frame_start.Time(),FromUnits(fabs(last_frame.Time()-frame_start.Time()),SECOND,-1));
00688 ORSA_WARNING(" objects in frame: ");
00689 unsigned int k;
00690 for (k=0;k<last_frame.size();++k) {
00691 ORSA_WARNING(" %s", last_frame[k].name().c_str());
00692 }
00693 }
00694
00695 for (l=0;l<base_bodies;++l) {
00696 frame_start.push_back(last_frame[l]);
00697 }
00698 }
00699 }
00700 break;
00701 }
00702 case Simulated: {
00703 frame_start.SetTime(0.0);
00704 unsigned int k;
00705 for (k=0;k<f.size();++k) {
00706 frame_start.push_back(f[k]);
00707 }
00708 break;
00709 }
00710 }
00711
00712 return frame_start;
00713 }
|
Here is the call graph for this function:

|
1.4.0