Open
Graph Drawing
Framework

 v.2012.05
 

EnergyFunction.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00046 #ifdef _MSC_VER
00047 #pragma once
00048 #endif
00049 
00050 #ifndef OGDF_ENERGY_FUNCTION_H
00051 #define OGDF_ENERGY_FUNCTION_H
00052 
00053 
00054 #include <ogdf/basic/GraphAttributes.h>
00055 
00056 
00057 namespace ogdf {
00058 
00060 
00063 class EnergyFunction {
00064 public:
00066     EnergyFunction(const String &funcname, GraphAttributes &AG);
00067     virtual ~EnergyFunction() { }
00068     
00070     virtual void computeEnergy()=0;
00072     double computeCandidateEnergy(
00073         const node v,
00074         const DPoint &newPos);
00076     String getName() const {return m_name;}
00078     void candidateTaken();
00079 #ifdef OGDF_DEBUG
00080 
00081     void printStatus() const;
00082 #endif
00083     double energy() const {return m_energy;}
00084 protected:
00085     const Graph &m_G;
00086     const String m_name;
00087     double m_candidateEnergy;
00088     double m_energy;
00089 
00090     DPoint testPos() {return m_testPos;}
00092     DPoint currentPos(const node v) const {return DPoint(m_AG.x(v),m_AG.y(v));}
00094     node testNode() const {return m_testNode;}
00096     virtual void internalCandidateTaken() = 0;
00098     virtual void compCandEnergy()=0;
00099 #ifdef OGDF_DEBUG
00100     virtual void printInternalData() const = 0;
00101 #endif
00102 private:
00104     EnergyFunction(const EnergyFunction &e):m_G(e.m_G),m_name(e.m_name),m_AG(e.m_AG) {};
00106     EnergyFunction& operator=(const EnergyFunction &e);
00107     GraphAttributes& m_AG;  
00108     node m_testNode;
00109     DPoint m_testPos;
00110 };
00111 
00112 }// end namespace
00113 #endif