CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

ClassicalSolver.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: 
00003 #include "CLHEP/GenericFunctions/ClassicalSolver.hh"
00004 #include "CLHEP/GenericFunctions/PhaseSpace.hh"
00005 #include <cmath>
00006 
00007 namespace Genfun {
00008   
00009   FUNCTION_OBJECT_IMP(EnergyFunction)
00010 
00011   EnergyFunction::EnergyFunction(const Classical::Solver & xsolver):
00012   solver(xsolver)
00013   {}
00014   
00015   EnergyFunction::~EnergyFunction() {
00016   }
00017   
00018   EnergyFunction::EnergyFunction(const EnergyFunction & right) 
00019     :AbsFunction(right), solver(right.solver)
00020   {  }
00021   
00022   
00023   double EnergyFunction::operator() (double t) const {
00024     const Classical::PhaseSpace & phaseSpace=solver.phaseSpace();
00025     const unsigned int DIM=phaseSpace.dim();
00026     Genfun::Argument arg(2*DIM);
00027     for (unsigned int i=0;i<phaseSpace.dim();i++) {
00028       arg[i]    =solver.equationOf(phaseSpace.coordinates()[i])(t);
00029       arg[i+DIM]=solver.equationOf(phaseSpace.momenta()[i])(t);
00030     }
00031     Genfun::GENFUNCTION H = solver.hamiltonian(); 
00032     return H(arg);
00033   }
00034 
00035 
00036 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7