TestOdeInt.cxx File Reference

#include <iostream>
#include <cmath>
#include "TROOT.h"
#include "TNtuple.h"
#include "TFile.h"
#include "NumericalMethods/NmOdeDerivFunc.h"
#include "NumericalMethods/NmOdeInt.h"

Go to the source code of this file.

Classes

class  ExpDerivFunc
class  SinCosDerivFunc
class  ConstAccelDerivFunc

Functions

int main (void)

Function Documentation

int main ( void   ) 

Definition at line 44 of file TestOdeInt.cxx.

References NmOdeInt::Integrate().

00045 {
00046   TROOT rootieTootie("Elaeagnus umbellata","Autumn olive");
00047   TNtuple nt("nt",
00048              "TestOdeInt",
00049              "x:ye1:ysc1:ysc2:yca1:yca2:yca3:yca4:yca5:yca6");
00050 
00051   for (int i=0; i<200; ++i) {
00052     float x[10];
00053     double x1       = 0.0;
00054     double x2       = 0.0;
00055     double acc      = 1.0e-6;
00056     double stepSize = 1.0e-2;
00057     double minStep  = 1.0e-4;
00058     
00059     x2 = i*0.01;
00060 
00061     double expY1[1] = {0.0};
00062     double expY2[1];
00063     ExpDerivFunc edf;
00064     NmOdeInt expInt(expY1,1,x1,x2,acc,stepSize,minStep,edf);
00065     expInt.Integrate(expY2);
00066 
00067     double sinCosY1[2] = {1.0,0.0};
00068     double sinCosY2[2];
00069     SinCosDerivFunc scdf;
00070     NmOdeInt sinCosInt(sinCosY1,2,x1,x2,acc,stepSize,minStep,scdf);
00071     sinCosInt.Integrate(sinCosY2);
00072     
00073     double constAccelY1[6] = {1.0,1.0,1.0,0.0,0.0,0.0};
00074     double constAccelY2[6];
00075     ConstAccelDerivFunc cadf;
00076     NmOdeInt constAccelInt(constAccelY1,6,x1,x2,acc,stepSize,minStep,cadf);
00077     constAccelInt.Integrate(constAccelY2);
00078     
00079     x[0] = x2;
00080     x[1] = expY2[0];
00081     x[2] = sinCosY2[0];
00082     x[3] = sinCosY2[1];
00083     x[4] = constAccelY2[0];
00084     x[5] = constAccelY2[1];
00085     x[6] = constAccelY2[2];
00086     x[7] = constAccelY2[3];
00087     x[8] = constAccelY2[4];
00088     x[9] = constAccelY2[5];
00089     nt.Fill(x);
00090   }
00091   TFile f("TestOdeInt.root","RECREATE");
00092   nt.Write();
00093   return 0;
00094 }


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1