Overview

The RoseMeshTopologyVertexCursor class is an iterator that computes the facets and edges that contain a given vertex. The findVertexEdges, findVertexFacets, and findVertexFacetsEdges, methods on RoseMeshTopology provide a similar functionality, but they materialize the data. Those methods are, in fact, implemented using this cursor class. This cursor class provides an efficient interface for those applications that do not need to store the instances.

To use this class, call the traverse() method to set topology object, and vertex. The vertex can also be set with the vertex() method. Then repeatedly call getNext() to get the next facet and edge touching the cursor's vertex.

The following function demonstrates how an application can print out all the facets the have a given vertex:

void find_facets_for_vertex(RoseMeshTopology * topo, unsigned v_idx)
{
    unsigned f,e;

    RoseMeshTopologyVectorCursor cur;
    cur.traverse(topo, v_idx);

    printf (Facets touching vertex %u:\n, v_idx);
    while (cur.getNext(&f, &e)) {
        printf (    %u\n, f);
    }
}

getNext()

int getNext(
        unsigned * facet, 
        unsigned * edge
);

The getNext()() function returns the next edge and the next facet for the iterator. It return 1 (true) if there are more items to be retrieved. This method returns 0 after all the items have been returned.

rewind()

void rewind();

The rewind()() function resets the cursor to the beginning.

traverse()

void traverse(
        RoseMeshTopology * topo, 
        unsigned v=ROSE_NOTFOUND
);

The traverse()() function sets the topology object, and optionally the vertex to traverse.

vertex()

void vertex(
        unsigned v_idx
);

The vertex()() function sets the vertex to traverse. The topology object must also be set by calling the traverse() method.