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
00074 static Vector Forces(3);
00075 static Vector Velocity(3);
00076 static Vector stateDot(6);
00077 static AttitudeState tempAttState;
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
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122