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 00051 #ifndef OGDF_CLUSTER_CHUNK_CONNECTION_H 00052 #define OGDF_CLUSTER_CHUNK_CONNECTION_H 00053 00054 #include <ogdf/basic/Array.h> 00055 #include <ogdf/basic/ArrayBuffer.h> 00056 #include <ogdf/cluster/ClusterGraph.h> 00057 #include <ogdf/internal/cluster/Cluster_EdgeVar.h> 00058 #include <ogdf/internal/cluster/basics.h> 00059 00060 #include <abacus/constraint.h> 00061 00062 namespace ogdf { 00063 00064 00065 class ChunkConnection : public BaseConstraint { 00066 #ifdef OGDF_DEBUG 00067 //Mainly for debugging output purposes 00068 friend class Master; 00069 friend class Sub; 00070 friend class CPlanarMaster; 00071 friend class CPlanarSub; 00072 #endif 00073 public: 00074 00075 ChunkConnection(ABA_MASTER *master, const ArrayBuffer<node>& chunk, const ArrayBuffer<node>& cochunk); 00076 00077 virtual ~ChunkConnection(); 00078 00079 // Computes and returns the coefficient for the given variable 00080 virtual double coeff(ABA_VARIABLE *v) { 00081 EdgeVar *ev = (EdgeVar *)v; 00082 //Save for both clustered planarity testing and maximum c-planar subgraph 00083 return (ev->theEdgeType() != EdgeVar::CONNECT) ? 0.0 : (double)coeff(ev->sourceNode(), ev->targetNode()); 00084 } 00085 inline int coeff(const nodePair& n) { return coeff(n.v1,n.v2); } 00086 int coeff(node v1, node v2); 00087 00088 void printMe(ostream& out) const { 00089 out << "[ChunkCon: ("; 00090 int j; 00091 forall_arrayindices(j,m_chunk) { 00092 Logger::slout() << m_chunk[j] << ","; 00093 } 00094 out << "|"; 00095 forall_arrayindices(j,m_cochunk) { 00096 Logger::slout() << m_cochunk[j] << ","; 00097 } 00098 out << ")]"; 00099 } 00100 00101 private: 00102 00103 // The nodePairs corresponding to the constraint 00104 Array<node> m_chunk; 00105 Array<node> m_cochunk; 00106 }; 00107 00108 } 00109 00110 #endif