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

ClassicalSolver.hh

Go to the documentation of this file.
00001 // This is a class the creates an N-Dimensional Phase Space     //
00002 
00003 // It is for use in computing the time development of classical //
00004 // Hamiltonian Systems.                                         //
00005 
00006 // Joe Boudreau October 2011                                    //
00007 
00008 //--------------------------------------------------------------//
00009 
00010 #ifndef _ClassicalSolver_h__
00011 #define _ClassicalSolver_h__
00012 
00013 #include "CLHEP/GenericFunctions/PhaseSpace.hh"
00014 #include "CLHEP/GenericFunctions/Variable.hh"
00015 #include "CLHEP/GenericFunctions/Parameter.hh"
00016 
00017 
00018 namespace Genfun {
00019   class EnergyFunction;
00020 }
00021 
00022 
00023 namespace Classical {
00024 
00025 
00026   class Solver {
00027         
00028   public:
00029     //
00030     // Constructor--takes a hamiltonian and a point in p-space: 
00031     //
00032     Solver(){};
00033     //
00034     // Destructor:
00035     //
00036     virtual ~Solver(){};
00037     //
00038     // Returns the time evolution for a variable (q_i or p_i)
00039     //
00040     virtual Genfun::GENFUNCTION equationOf(const Genfun::Variable & v) const=0;
00041     //
00042     // Returns the phase space 
00043     //
00044     virtual const PhaseSpace & phaseSpace() const=0;
00045     //
00046     // Returns the Hamiltonian (function of the 2N phase space variables). 
00047     //
00048     virtual Genfun::GENFUNCTION hamiltonian() const=0;
00049     //
00050     // Returns the energy (function of time).
00051     //
00052     virtual Genfun::GENFUNCTION energy() const=0;
00053     //
00054     // This is in the rare case that the user needs to edit starting values.
00055     // or parameterize the Hamiltonian.  Most users:  can ignore.  
00056     virtual Genfun::Parameter *takeQ0(unsigned int index)=0;
00057     virtual Genfun::Parameter *takeP0(unsigned int index)=0;
00058     virtual Genfun::Parameter *createControlParameter(const std::string & variableName="anon",
00059                                                       double defStartingValue=0.0,
00060                                                       double startingValueMin=0.0,
00061                                                       double startingValueMax=0.0) const = 0;
00062     
00063 
00064 
00065   private:
00066     
00067     // Illegal Operations:
00068     Solver (const Solver &);
00069     Solver & operator=(const Solver &);
00070     
00071   };
00072 }
00073 
00074 namespace Genfun {
00075 
00076   class EnergyFunction: public Genfun::AbsFunction {
00077   
00078     FUNCTION_OBJECT_DEF(EnergyFunction)
00079 
00080       public:
00081 
00082     // Constructor
00083     EnergyFunction(const Classical::Solver &);
00084 
00085     // Destructor
00086     virtual ~EnergyFunction();
00087   
00088     // Copy constructor
00089     EnergyFunction(const EnergyFunction &right);
00090   
00091     // Retreive function value
00092     virtual double operator ()(double argument) const;
00093     virtual double operator ()(const Argument & a) const {return operator() (a[0]);}
00094 
00095   private:
00096 
00097     // It is illegal to assign a EnergyFunction
00098     const EnergyFunction & operator=(const EnergyFunction &right);
00099 
00100     const Classical::Solver & solver;
00101 
00102   };
00103 
00104 }
00105 
00106 
00107 
00108 #endif

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7