COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
gauss_jackson_test.cpp File Reference
#include <stdlib.h>
#include <stdio.h>
#include "mathlib.h"
Include dependency graph for gauss_jackson_test.cpp:

Macros

#define ORDER   8
 
#define AXES   1
 

Functions

double myv0 (double vi)
 
double myv1 (double vi)
 
double myv2 (double vi)
 
void mycalc (double vi, double *vd0, double *vd2, int32_t axes)
 
int main (int argc, char *argv[])
 

Variables

static double * p = NULL
 

Macro Definition Documentation

#define ORDER   8
#define AXES   1

Function Documentation

double myv0 ( double  vi)
72 {
73 int i;
74 double vd0;
75 
76 if (p == NULL)
77  {
78  p = (double *)zalloc(ORDER+1,sizeof(double));
79  for (i=0; i<ORDER+1; i++)
80  p[i] = drand48();
81  }
82 p[0] = p[1] = 0.;
83 p[2] = 1.;
84 p[3] = p[4] = p[5] = p[6] = p[7] = p[8] = 0.;
85 vd0 = 0.;
86 for (i=0; i<ORDER+1; i++)
87  {
88  vd0 += p[i]*pow(vi,i);
89  }
90 return (vd0);
91 }
int i
Definition: rw_test.cpp:37
static double * p
Definition: gauss_jackson_test.cpp:42
#define ORDER
Definition: gauss_jackson_test.cpp:39
double myv1 ( double  vi)
94 {
95 int i;
96 double vd1;
97 
98 if (p == NULL)
99  {
100  p = (double *)zalloc(ORDER+1,sizeof(double));
101  for (i=0; i<ORDER+1; i++)
102  p[i] = drand48();
103  }
104 vd1 = 0.;
105 for (i=0; i<ORDER; i++)
106  {
107  vd1 += (i+1)*p[i+1]*pow(vi,i);
108  }
109 return (vd1);
110 }
int i
Definition: rw_test.cpp:37
static double * p
Definition: gauss_jackson_test.cpp:42
#define ORDER
Definition: gauss_jackson_test.cpp:39
double myv2 ( double  vi)
113 {
114 int i;
115 double vd2;
116 
117 if (p == NULL)
118  {
119  p = (double *)zalloc(ORDER+1,sizeof(double));
120  for (i=0; i<ORDER+1; i++)
121  p[i] = drand48();
122  }
123 
124 vd2 = 0.;
125 for (i=0; i<ORDER-1; i++)
126  {
127  vd2 += (i+1)*(i+2)*p[i+2]*pow(vi,i);
128  }
129 return (vd2);
130 }
int i
Definition: rw_test.cpp:37
static double * p
Definition: gauss_jackson_test.cpp:42
#define ORDER
Definition: gauss_jackson_test.cpp:39
void mycalc ( double  vi,
double *  vd0,
double *  vd2,
int32_t  axes 
)
133 {
134 vd2[0] = myv2(vi);
135 }
double myv2(double vi)
Definition: gauss_jackson_test.cpp:112
int main ( int  argc,
char *  argv[] 
)
45 {
46 int i;
47 gj_kernel *kern;
48 gj_instance *gji;
49 double vd0[AXES], vd1[AXES], vd2[AXES];
50 
51 
52 kern = gauss_jackson_kernel(ORDER,1.);
54 
55 for (i=-ORDER/2; i<=ORDER/2; i++)
56  {
57  vd0[0] = myv0(i*1.);
58  vd1[0] = myv1(i*1.);
59  vd2[0] = myv2(i*1.);
60  gauss_jackson_setstep(gji,i*1.,vd0,vd1,vd2,i+ORDER/2);
61  }
62 
64 
66 vd0[0] = myv0(10.);
67 vd1[0] = myv1(10.);
68 vd2[0] = myv2(10.);
69 }
Gauss-Jackson Integration Instance.
Definition: mathlib.h:216
void gauss_jackson_preset(gj_instance *gji)
Converge all axes of a Gauss-Jackson integrator prior to propagation.
Definition: mathlib.cpp:1974
int i
Definition: rw_test.cpp:37
#define AXES
Definition: gauss_jackson_test.cpp:40
void gauss_jackson_extrapolate(gj_instance *gji, double target)
Propagate Gauss-Jackson integration.
Definition: mathlib.cpp:2079
pxnxm element cube
Definition: mathlib.h:178
gj_instance * gauss_jackson_instance(gj_kernel *kern, int32_t axes, void(*calc_vd2)(double vi, double *vd0, double *vd2, int32_t axes))
Initialize an Instance of a Gauss-Jackson Integrator.
Definition: mathlib.cpp:1774
double myv2(double vi)
Definition: gauss_jackson_test.cpp:112
gj_kernel * gauss_jackson_kernel(int32_t order, double dvi)
Create Gauss-Jackson Integration Kernel.
Definition: mathlib.cpp:1543
void mycalc(double vi, double *vd0, double *vd2, int32_t axes)
Definition: gauss_jackson_test.cpp:132
int gauss_jackson_setstep(gj_instance *gji, double vi, double *vd0, double *vd1, double *vd2, int32_t istep)
Set Independent and Dependent variables for Gauss-Jackson step.
Definition: mathlib.cpp:1920
double myv1(double vi)
Definition: gauss_jackson_test.cpp:93
#define ORDER
Definition: gauss_jackson_test.cpp:39
double myv0(double vi)
Definition: gauss_jackson_test.cpp:71

Variable Documentation

double* p = NULL
static