X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius2.git;a=blobdiff_plain;f=bgl.cpp;h=193a75a97fac5eac1b901aa2afcb7ff511a572cf;hp=0d1f355323cb9f064281e0079e709f1e55f61d9d;hb=8e877646039cbcce06ad506f60a73785abbb3e56;hpb=47850b1d988483f5939b5bdb4a3bd60604f6930c diff --git a/bgl.cpp b/bgl.cpp index 0d1f355..193a75a 100644 --- a/bgl.cpp +++ b/bgl.cpp @@ -47,8 +47,6 @@ extern "C" { #define VMASK (YMASK|XMASK) #define ESHIFT (YBITS+XBITS) -class Graph { }; // this is a dummy as our graph has no actual representation - using namespace boost; /* @@ -98,13 +96,15 @@ class OutEdgeIterator : } static int voe_min(int _v) { return (_v & YMASK) ? 2 : 3; } - static int voe_max(int _v) { return (~_v & YMASK) ? V6 : 4; } - static int voe_degree(int _v) { return (_v & YMASK | ~_v & YMASK) ? 4 : V6; } + static int voe_max(int _v) { return (_v & YMASK)==(Y-1) ? V6 : 4; } + static int voe_degree(int _v) { return RIM_VERTEX_P(_v) ? 4 : V6; } }; typedef counting_iterator VertexIterator; namespace boost { + class Graph { }; // this is a dummy as our graph has no actual representation + // We make Graph a model of various BGL Graph concepts. // This mainly means that graph_traits has lots of stuff. @@ -115,6 +115,7 @@ namespace boost { public virtual vertex_list_graph_tag, public virtual edge_list_graph_tag { }; + template<> struct graph_traits { // Concept Graph: typedef int vertex_descriptor; /* vertex number, -1 => none */ @@ -152,7 +153,8 @@ namespace boost { } // Concept VertexListGraph: - inline std::pair vertices(const Graph&) { + inline + std::pair vertices(const Graph&) { return std::make_pair(VertexIterator(0), VertexIterator(N)); } inline unsigned num_vertices(const Graph&) { return N; } @@ -188,7 +190,7 @@ double graph_layout_cost(const Vertices v, const double vertex_areas[N]) { */ static const double d2_epsilon= 1e-6; - double edge_weights[N*V6], vertex_distances[N], total_cost=0; + double edge_weights[V6<