Пример #1
0
 Part3D(std::shared_ptr<Part3D> parent) 
     : Stacked::Object( Final::template objectTypeID<typename Final::Part3D>::ID::value ),
     m_system(parent->m_system) {
         
     typedef typename Final::Kernel  Kernel;
     typedef typename Kernel::Scalar Scalar;
     typedef symbolic::TypeGeometry<Part3D> TypeGeometry;
     
     //we may need to setup the graph. We do this here to allow to clear the geometry and later reinitialize by setting a new geometry.
     std::shared_ptr<typename Final::Graph> cluster = std::static_pointer_cast<typename Final::Graph>(parent->m_cluster);
     std::pair<std::shared_ptr<typename Final::Graph>, graph::LocalVertex> res = cluster->createCluster();
     setVertexProperty(cluster->getGlobalVertex(res.second));
     m_cluster = res.first;
 };
Пример #2
0
	    /**
	     * @brief The graph has to be described by *edges* 
	     * (source Vertex ==> target Vertex) and
	     * the *vertices* of this graph.
	     *
	     */
	    BGL(GraphDescription graphDesc) :
		id(0){
		

		std::vector<VertexID> vertices     = graphDesc.first;
		std::vector<EdgeDescription> edges = graphDesc.second;

		graph = new BGLGraph(vertices.size());

		EdgeID edgeCount = 0;

		for(EdgeDescription edge: edges){
		    VertexID srcVertex    = std::get<0>(edge);
		    VertexID targetVertex = std::get<1>(edge);
		    BGLEdge edgeID = boost::add_edge(srcVertex, targetVertex, (*graph)).first;
		    setEdgeProperty(edgeID, Edge(edgeCount++));
		}

		// Bind vertex_descriptor and VertexProperty;
		for(unsigned vertexID = 0; vertexID < vertices.size(); ++vertexID){
		    setVertexProperty(vertexID, Vertex(vertexID));
		}
		
	    }