CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
ClassicalSolver.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id:
3#include "CLHEP/GenericFunctions/ClassicalSolver.hh"
4#include "CLHEP/GenericFunctions/PhaseSpace.hh"
5#include <cmath>
6
7namespace Genfun {
8
9 FUNCTION_OBJECT_IMP(EnergyFunction)
10
11 EnergyFunction::EnergyFunction(const Classical::Solver & xsolver):
12 solver(xsolver)
13 {}
14
16 }
17
19 :AbsFunction(right), solver(right.solver)
20 { }
21
22
23 double EnergyFunction::operator() (double t) const {
24 const Classical::PhaseSpace & phaseSpace=solver.phaseSpace();
25 const unsigned int DIM=phaseSpace.dim();
26 Genfun::Argument arg(2*DIM);
27 for (unsigned int i=0;i<phaseSpace.dim();i++) {
28 arg[i] =solver.equationOf(phaseSpace.coordinates()[i])(t);
29 arg[i+DIM]=solver.equationOf(phaseSpace.momenta()[i])(t);
30 }
31 Genfun::GENFUNCTION H = solver.hamiltonian();
32 return H(arg);
33 }
34
35
36} // namespace Genfun
#define FUNCTION_OBJECT_IMP(classname)
Definition: AbsFunction.hh:149
const Component & momenta() const
Definition: PhaseSpace.cc:70
const Component & coordinates() const
Definition: PhaseSpace.cc:66
unsigned int dim() const
Definition: PhaseSpace.cc:98
virtual Genfun::GENFUNCTION equationOf(const Genfun::Variable &v) const =0
virtual Genfun::GENFUNCTION hamiltonian() const =0
virtual const PhaseSpace & phaseSpace() const =0
virtual double operator()(double argument) const override
EnergyFunction(const Classical::Solver &)
Definition: Abs.hh:14