orbitalthread.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                        orbitalthread.h  -  description
00003                              -------------------
00004     begin                : Sun Mar 27 2005
00005     copyright            : (C) 2005-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00020 
00021 #ifndef ORBITALTHREAD_H
00022 #define ORBITALTHREAD_H
00023 
00025 
00026 // STL header files
00027 #include <vector>
00028 
00029 // Qt forward class declarations
00030 class QMutex;
00031 class QWidget;
00032 
00033 // Xbrabo header files
00034 #include "point3d.h"
00035 
00036 // Base class header files
00037 #include <qthread.h>
00038 
00040 class OrbitalThread : public QThread
00041 {
00042   public:
00044     OrbitalThread(QWidget* parentWidget, QMutex* sharedMutex, std::vector<Point3D<float> >* coordinates, const unsigned int type, const unsigned int atom, const unsigned int n, const unsigned int l, const int m, const float res, const float prob, const unsigned int dots);        // constructor
00045     ~OrbitalThread();                   // destructor
00046 
00048     enum Types{IsoProbability = 0, Density, AngularPart, AccumulatedProbability, RadialPart}; 
00049 
00051     void stop();                        // requests stopping the thread
00052     double boundingSphereRadius();      // returns the radius of the bounding sphere
00053 
00054   private:
00055     // private enums
00056     enum Precision{PRECISION_UNKNOWN, PRECISION_FLOAT, PRECISION_DOUBLE, PRECISION_LONG_DOUBLE}; 
00057 
00059     virtual void run();                 // reimplementation of this pure virtual does the actual work
00060     void calcIsoProbability();          // calculates an isoprobability
00061     void calcAccumulatedProbability();  // calculates points with the given total accumulated probability
00062     void calcRandomDots();              // calculates random points according to the probability
00063     void calcRadialPart();              // calculates only the radial part of the orbital
00064     void calcAngularPart();             // calculates only the angular part of the orbital
00065     void updateList(std::vector<Point3D<float> >& newCoords, bool final = false);         // updates the shared list of coordinates with a new set
00066     float associatedLegendre(const float x, const int m, const unsigned int l); // returns the associated Legendre polynomial
00067     float associatedLaguerre(const float x, const int m, const unsigned int n); // returns the associated Laguerre polynomial
00068     template <class T> T factorial(const unsigned int number);        // returns the factorial (n!) of the number (n)
00069     float random(const float min, const float max);         // returns a random number between min and max
00070     template <class T> T largestResult(const unsigned int n, const unsigned int l, const int m, const unsigned int Z);  // calculates the largest possible result for the given quantum numbers
00071 
00073     QWidget* receiver;                  
00074     QMutex* mutex;                      
00075     std::vector<Point3D<float> >* coords;         
00076     unsigned int atomNumber;            
00077     unsigned int qnPrincipal;           
00078     unsigned int qnOrbital;             
00079     int qnMomentum;                     
00080     unsigned int calculationType;       
00081     float probability;                  
00082     float resolution;                   
00083     unsigned int numDots;               
00084     bool stopRequested;                 
00085     float maximumRadius;                
00086     unsigned int progress;              
00087 
00088     // private static constants
00089     static const float abohr;           
00090     static const unsigned int updateSize;         // The amount of dots that have to be calculated before the list of dots is updated and the mutex is locked
00091 };
00092 
00093 #endif
00094 

Generated on Fri May 19 14:31:55 2006 for Brabosphere by  doxygen 1.4.6-NO