Templatized a function and removed its duplicate, plus minor optimization.
[PaGMO.git] / AstroToolbox / mga_dsm.h
blob9030b9436f5eb61cca77472cc6402b3e4c05e733
1 // ------------------------------------------------------------------------ //
2 // This source file is part of the 'ESA Advanced Concepts Team's //
3 // Space Mechanics Toolbox' software. //
4 // //
5 // The source files are for research use only, //
6 // and are distributed WITHOUT ANY WARRANTY. Use them on your own risk. //
7 // //
8 // Copyright (c) 2004-2007 European Space Agency //
9 // ------------------------------------------------------------------------ //
11 #ifndef MGA_DSM_H
12 #define MGA_DSM_H
14 #include <vector>
15 #include "Pl_Eph_An.h"
16 #include "Astro_Functions.h"
17 #include "propagateKEP.h"
18 #include "Lambert.h"
19 #include "time2distance.h"
20 #include "mga.h"
22 using namespace std;
24 struct mgadsmproblem {
25 int type; //problem type
26 vector<int> sequence; //fly-by sequence (ex: 3,2,3,3,5,is Earth-Venus-Earth-Earth-Jupiter)
27 double e; //insertion e (only in case total_DV_orbit_insertion)
28 double rp; //insertion rp in km (only in case total_DV_orbit_insertion)
29 customobject asteroid; //asteroid data (in case fly-by sequence has a final number = 10)
30 double AUdist; //Distance to reach in AUs (only in case of time2AUs)
31 double DVtotal; //Total DV allowed in km/s (only in case of time2AUs)
32 double DVonboard; //Total DV on the spacecraft in km/s (only in case of time2AUs)
34 //Pre-allocated memory, in order to remove allocation of heap space in MGA_DSM calls
35 std::vector<double*> r;// = std::vector<double*>(n);
36 std::vector<double*> v;// = std::vector<double*>(n);
37 std::vector<double> DV;// = std::vector<double>(n+1);
41 int MGA_DSM(
42 /* INPUT values: */
43 vector<double> x , // it is the decision vector
44 mgadsmproblem, // contains the problem specific data
46 /* OUTPUT values: */
47 double& J, // J output
48 double* DVVec// DVVec
52 #endif