Beispiel #1
0
// Follow connected junctions and connectors from the given junction to
// determine the hyperedge topology, saving objects to the deleted-objects
// vectors as we go.
bool HyperedgeRerouter::findAttachedObjects(size_t index,
        JunctionRef *junction, ConnRef *ignore, ConnRefSet& hyperedgeConns)
{
    bool validHyperedge = false;

    m_deleted_junctions_vector[index].push_back(junction);

    ConnRefList connectors = junction->attachedConnectors();

    if (connectors.size() > 2)
    {
        // A valid hyperedge must have at least one junction with three
        // connectors attached, i.e., more than two endpoints.
        validHyperedge |= true;
    }

    for (ConnRefList::iterator curr  = connectors.begin();
            curr != connectors.end(); ++curr)
    {
        if (*curr == ignore)
        {
            continue;
        }

        COLA_ASSERT(*curr != NULL);
        validHyperedge |= findAttachedObjects(index, (*curr), junction, hyperedgeConns);
    }
    return validHyperedge;
}
Beispiel #2
0
// This method traverses the hyperedge tree and creates connectors for each
// segment bridging junction and/or terminals.  It also sets the 
// appropriate ConnEnds for each connector.
//
void HyperEdgeTreeEdge::addConns(HyperEdgeTreeNode *ignored, Router *router,
        ConnRefList& oldConns)
{
    COLA_ASSERT(conn != NULL);
    HyperEdgeTreeNode *endNode = NULL;
    if (ends.first && (ends.first != ignored))
    {
        endNode = ends.first;
        ends.first->addConns(this, router, oldConns, conn);
    }

    if (ends.second && (ends.second != ignored))
    {
        endNode = ends.second;
        ends.second->addConns(this, router, oldConns, conn);
    }

    if (endNode->finalVertex)
    {
        // We have reached a terminal of the hyperedge, so set a ConnEnd for
        // the original connector endpoint
        ConnEnd connend;
        bool result = false;
        // Find the ConnEnd from the list of original connectors.
        for (ConnRefList::iterator curr = oldConns.begin(); 
                curr != oldConns.end(); ++curr)
        {
            result |= (*curr)->getConnEndForEndpointVertex(
                    endNode->finalVertex, connend);
            if (result)
            {
                break;
            }
        }
        if (result)
        {
            // XXX: Create new conn here.
            conn->updateEndPoint(VertID::tar, connend);
        }
    }
    else if (endNode->junction)
    {
        // Or, set a ConnEnd connecting to the junction we have reached.
        ConnEnd connend(endNode->junction);
        conn->updateEndPoint(VertID::tar, connend);
    }
}
Beispiel #3
0
// Follow connected junctions and connectors from the given junction to
// determine the hyperedge topology, saving objects to the deleted-objects
// vectors as we go.
void HyperedgeRerouter::findAttachedObjects(size_t index,
        JunctionRef *junction, ConnRef *ignore, ConnRefSet& hyperedgeConns)
{
    m_deleted_junctions_vector[index].push_back(junction);

    ConnRefList connectors = junction->attachedConnectors();

    for (ConnRefList::iterator curr  = connectors.begin();
            curr != connectors.end(); ++curr)
    {
        if (*curr == ignore)
        {
            continue;
        }

        COLA_ASSERT(*curr != NULL);
        findAttachedObjects(index, (*curr), junction, hyperedgeConns);
    }
}
Beispiel #4
0
// This method traverses the hyperedge tree and returns a list of the junctions
// and connectors that make up the hyperedge.
//
void HyperEdgeTreeEdge::listJunctionsAndConnectors(HyperEdgeTreeNode *ignored,
        JunctionRefList& junctions, ConnRefList& connectors)
{
    ConnRefList::iterator foundPosition =
            std::find(connectors.begin(), connectors.end(), conn);
    if (foundPosition == connectors.end())
    {
        // Add connector if it isn't already in the list.
        connectors.push_back(conn);
    }

    if (ends.first != ignored)
    {
        ends.first->listJunctionsAndConnectors(this, junctions, connectors);
    }
    else if (ends.second != ignored)
    {
        ends.second->listJunctionsAndConnectors(this, junctions, connectors);
    }
}