TwoBodyDynamics.h

Go to the documentation of this file.
00001 
00002 
00008 /* 
00009 */
00011 
00012 #ifndef __OSESSAME_TWOBODYDYNAMICS_H__
00013 #define __OSESSAME_TWOBODYDYNAMICS_H__
00014 #include "matrix/Matrix.h"
00015 #include "Integrator.h"
00016 #include "Time.h"
00017 #include "Orbit.h"
00018 #include "OrbitState.h"
00019 #include "Attitude.h"
00020 #include <vector.h>
00021 using namespace std;
00022 using namespace O_SESSAME;
00023 
00036 static void PositionVelocityConvFunc(const Matrix &_meshPoint, OrbitState &_convertedOrbitState)
00037 {
00038     static Vector tempPosVelVector(_meshPoint[MatrixColsIndex].getIndexBound() - 1);
00039     tempPosVelVector(_) = ~_meshPoint(_,_(MatrixIndexBase+1, _meshPoint[MatrixColsIndex].getIndexBound()));
00040     _convertedOrbitState.GetStateRepresentation()->SetPositionVelocity(tempPosVelVector);
00041     return;
00042 }
00043 
00071 static Vector TwoBodyDynamics(const ssfTime &_time, const Vector& _integratingState, Orbit *_pOrbit, Attitude *_pAttitude, const Matrix &_parameters, const Functor &_forceFunctorPtr)
00072 {
00073 //    _Orbit->SetStateObject(OrbitState(new PositionVelocity(_integratingState)));
00074     static Vector Forces(3);
00075     static Vector Velocity(3);
00076     static Vector stateDot(6);
00077     static AttitudeState tempAttState; // don't need this except to pass an empty one if there is no attitude
00078     static OrbitState orbState(new PositionVelocity);
00079 
00080     orbState.GetStateRepresentation()->SetPositionVelocity(_integratingState);
00081 
00082     if(_pAttitude)
00083         Forces = _forceFunctorPtr.Call(_time, orbState, _pAttitude->GetStateObject());
00084     else 
00085         Forces = _forceFunctorPtr.Call(_time, orbState, tempAttState);
00086 
00087     Velocity(_) = _integratingState(_(VectorIndexBase+3,VectorIndexBase+5));
00088     
00089 
00090     stateDot(_(VectorIndexBase, VectorIndexBase+2)) = Velocity(_);
00091     stateDot(_(VectorIndexBase+3, VectorIndexBase+5)) = Forces(_);
00092     return stateDot;
00093 }
00094 
00095 #endif
00096 // Do not change the comments below - they will be added automatically by CVS
00097 /*****************************************************************************
00098 *       $Log: TwoBodyDynamics.h,v $
00099 *       Revision 1.7  2003/06/12 18:02:37  nilspace
00100 *       Fixed evaluation.
00101 *       
00102 *       Revision 1.6  2003/05/22 21:03:26  nilspace
00103 *       Fixed to run faster with static variables.
00104 *       
00105 *       Revision 1.5  2003/05/20 17:47:59  nilspace
00106 *       Updated comments.
00107 *       
00108 *       Revision 1.4  2003/05/13 18:49:41  nilspace
00109 *       Fixed to get the StateObjects.
00110 *       
00111 *       Revision 1.3  2003/05/10 00:43:13  nilspace
00112 *       Updated the includes for Orbit.h and Attitude.h
00113 *       
00114 *       Revision 1.2  2003/04/22 20:25:44  simpliciter
00115 *       Updated LaTeX formulas for \ddot{r} and \dot{state vector} for
00116 *       proper display.
00117 *       
00118 *       Revision 1.1  2003/04/08 22:48:29  nilspace
00119 *       Initial Submission.
00120 *       
00121 *
00122 ******************************************************************************/

Generated on Wed Aug 6 12:58:54 2003 for Open-Sessame Framework by doxygen1.3