CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
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
7
namespace
Genfun {
8
9
FUNCTION_OBJECT_IMP
(EnergyFunction)
10
11
EnergyFunction
::
EnergyFunction
(const Classical::Solver & xsolver):
12
solver(xsolver)
13
{}
14
15
EnergyFunction::~EnergyFunction
() {
16
}
17
18
EnergyFunction::EnergyFunction
(
const
EnergyFunction
& right)
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
Generated on Mon May 6 2013 04:04:10 for CLHEP by
1.8.1.2